Skip to content

Commit c97db3e

Browse files
committed
Update for Bridgetown 2.0
1 parent 8aa15b9 commit c97db3e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/toottown/models/mastodon_connection.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module Toottown
22
module Models
33
class MastodonConnection
4+
using Bridgetown::Refinements
5+
46
attr_reader :connection
57

68
def initialize(instance_url:, access_token:)
@@ -16,9 +18,9 @@ def initialize(instance_url:, access_token:)
1618
def get(path, **params)
1719
response = connection.get(path, **params)
1820
if response.body.is_a?(Array)
19-
response.body.map(&:with_dot_access)
21+
response.body.map(&:as_dots)
2022
else
21-
response.body.with_dot_access
23+
response.body.as_dots
2224
end
2325
end
2426

test/test_routes.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
require_relative "./helper"
44

55
class TestToottown < Bridgetown::TestCase
6+
using Bridgetown::Refinements
67
include Rack::Test::Methods
78

8-
REPLIES_FIXTURE = [{"id"=>"109808869101409105", "created_at"=>"2023-02-04T22:39:30.814Z", "in_reply_to_id"=>"109773954858643930", "in_reply_to_account_id"=>"108195559450330916", "sensitive"=>false, "spoiler_text"=>"", "visibility"=>"unlisted", "language"=>"en", "uri"=>"https://indieweb.social/users/jaredwhite/statuses/109808869101409105", "url"=>"https://indieweb.social/@jaredwhite/109808869101409105", "replies_count"=>0, "reblogs_count"=>0, "favourites_count"=>0, "edited_at"=>nil, "favourited"=>false, "reblogged"=>false, "muted"=>false, "bookmarked"=>false, "pinned"=>false, "content"=>"<p>reply test (please ignore 🙃)</p>", "filtered"=>[], "reblog"=>nil, "application"=>{"name"=>"Ivory for iOS", "website"=>"https://tapbots.com/"}, "account"=>{"id"=>"108195559450330916", "username"=>"jaredwhite", "acct"=>"jaredwhite", "display_name"=>"Jared White", "locked"=>false, "bot"=>false, "discoverable"=>true, "group"=>false, "created_at"=>"2022-04-26T00:00:00.000Z", "note"=>"<p>A hearty hello from <a href=\"https://indieweb.social/tags/Portland\" class=\"mention hashtag\" rel=\"tag\">#<span>Portland</span></a> &amp; the Pacific Northwest! 🌲 I&#39;m a b/v+logger, podcaster, <a href=\"https://indieweb.social/tags/Ruby\" class=\"mention hashtag\" rel=\"tag\">#<span>Ruby</span></a> &amp; <a href=\"https://indieweb.social/tags/WebDev\" class=\"mention hashtag\" rel=\"tag\">#<span>WebDev</span></a>-eloper, photographer, and musician.</p><p>I work on <span class=\"h-card\"><a href=\"https://ruby.social/@bridgetown\" class=\"u-url mention\">@<span>bridgetown</span></a></span>, a Ruby web framework. I also talk about ethics in content creation and activism against unregulated generative AI. Nice to meet you!</p>", "url"=>"https://indieweb.social/@jaredwhite", "avatar"=>"https://cdn.masto.host/indiewebsocial/accounts/avatars/108/195/559/450/330/916/original/b5265e6aace48a28.jpeg", "avatar_static"=>"https://cdn.masto.host/indiewebsocial/accounts/avatars/108/195/559/450/330/916/original/b5265e6aace48a28.jpeg", "header"=>"https://cdn.masto.host/indiewebsocial/accounts/headers/108/195/559/450/330/916/original/389bbeeb5b85f950.jpeg", "header_static"=>"https://cdn.masto.host/indiewebsocial/accounts/headers/108/195/559/450/330/916/original/389bbeeb5b85f950.jpeg", "followers_count"=>1360, "following_count"=>869, "statuses_count"=>1658, "last_status_at"=>"2023-02-04", "noindex"=>false, "emojis"=>[], "fields"=>[{"name"=>"Website", "value"=>"<a href=\"https://jaredwhite.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">jaredwhite.com</span><span class=\"invisible\"></span></a>", "verified_at"=>"2022-04-30T17:25:02.602+00:00"}, {"name"=>"Photos on Glass", "value"=>"<a href=\"https://glass.photo/jaredcwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">glass.photo/jaredcwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>nil}, {"name"=>"GitHub", "value"=>"<a href=\"https://github.com/jaredcwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">github.com/jaredcwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>"2023-02-01T18:29:08.969+00:00"}, {"name"=>"Support via ☕️", "value"=>"<a href=\"https://www.buymeacoffee.com/jaredwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://www.</span><span class=\"\">buymeacoffee.com/jaredwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>nil}]}, "media_attachments"=>[], "mentions"=>[], "tags"=>[], "emojis"=>[], "card"=>nil, "poll"=>nil}].map(&:with_dot_access)
9+
REPLIES_FIXTURE = [{"id"=>"109808869101409105", "created_at"=>"2023-02-04T22:39:30.814Z", "in_reply_to_id"=>"109773954858643930", "in_reply_to_account_id"=>"108195559450330916", "sensitive"=>false, "spoiler_text"=>"", "visibility"=>"unlisted", "language"=>"en", "uri"=>"https://indieweb.social/users/jaredwhite/statuses/109808869101409105", "url"=>"https://indieweb.social/@jaredwhite/109808869101409105", "replies_count"=>0, "reblogs_count"=>0, "favourites_count"=>0, "edited_at"=>nil, "favourited"=>false, "reblogged"=>false, "muted"=>false, "bookmarked"=>false, "pinned"=>false, "content"=>"<p>reply test (please ignore 🙃)</p>", "filtered"=>[], "reblog"=>nil, "application"=>{"name"=>"Ivory for iOS", "website"=>"https://tapbots.com/"}, "account"=>{"id"=>"108195559450330916", "username"=>"jaredwhite", "acct"=>"jaredwhite", "display_name"=>"Jared White", "locked"=>false, "bot"=>false, "discoverable"=>true, "group"=>false, "created_at"=>"2022-04-26T00:00:00.000Z", "note"=>"<p>A hearty hello from <a href=\"https://indieweb.social/tags/Portland\" class=\"mention hashtag\" rel=\"tag\">#<span>Portland</span></a> &amp; the Pacific Northwest! 🌲 I&#39;m a b/v+logger, podcaster, <a href=\"https://indieweb.social/tags/Ruby\" class=\"mention hashtag\" rel=\"tag\">#<span>Ruby</span></a> &amp; <a href=\"https://indieweb.social/tags/WebDev\" class=\"mention hashtag\" rel=\"tag\">#<span>WebDev</span></a>-eloper, photographer, and musician.</p><p>I work on <span class=\"h-card\"><a href=\"https://ruby.social/@bridgetown\" class=\"u-url mention\">@<span>bridgetown</span></a></span>, a Ruby web framework. I also talk about ethics in content creation and activism against unregulated generative AI. Nice to meet you!</p>", "url"=>"https://indieweb.social/@jaredwhite", "avatar"=>"https://cdn.masto.host/indiewebsocial/accounts/avatars/108/195/559/450/330/916/original/b5265e6aace48a28.jpeg", "avatar_static"=>"https://cdn.masto.host/indiewebsocial/accounts/avatars/108/195/559/450/330/916/original/b5265e6aace48a28.jpeg", "header"=>"https://cdn.masto.host/indiewebsocial/accounts/headers/108/195/559/450/330/916/original/389bbeeb5b85f950.jpeg", "header_static"=>"https://cdn.masto.host/indiewebsocial/accounts/headers/108/195/559/450/330/916/original/389bbeeb5b85f950.jpeg", "followers_count"=>1360, "following_count"=>869, "statuses_count"=>1658, "last_status_at"=>"2023-02-04", "noindex"=>false, "emojis"=>[], "fields"=>[{"name"=>"Website", "value"=>"<a href=\"https://jaredwhite.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">jaredwhite.com</span><span class=\"invisible\"></span></a>", "verified_at"=>"2022-04-30T17:25:02.602+00:00"}, {"name"=>"Photos on Glass", "value"=>"<a href=\"https://glass.photo/jaredcwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">glass.photo/jaredcwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>nil}, {"name"=>"GitHub", "value"=>"<a href=\"https://github.com/jaredcwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">github.com/jaredcwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>"2023-02-01T18:29:08.969+00:00"}, {"name"=>"Support via ☕️", "value"=>"<a href=\"https://www.buymeacoffee.com/jaredwhite\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://www.</span><span class=\"\">buymeacoffee.com/jaredwhite</span><span class=\"invisible\"></span></a>", "verified_at"=>nil}]}, "media_attachments"=>[], "mentions"=>[], "tags"=>[], "emojis"=>[], "card"=>nil, "poll"=>nil}].map(&:as_dots)
910

1011
# def setup
1112
# Bridgetown.reset_configuration!

toottown.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
1818

1919
spec.required_ruby_version = ">= 2.7.0"
2020

21-
spec.add_dependency "bridgetown", ">= 1.2.0", "< 2.0"
21+
spec.add_dependency "bridgetown", ">= 2.0.0.beta2", "< 3.0"
2222
spec.add_dependency "phlex", "~> 1.3"
2323
spec.add_dependency "redis", "~> 5.0"
2424

0 commit comments

Comments
 (0)