Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Instagram to API endpoint #2655

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
ffi (1.15.5)
ffi (1.17.0)
ffi (1.17.0-x86_64-linux-gnu)
katjam marked this conversation as resolved.
Show resolved Hide resolved
font-awesome-rails (4.7.0.8)
railties (>= 3.2, < 8.0)
foreman (0.87.2)
Expand Down
7 changes: 5 additions & 2 deletions app/graphql/types/partner_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ class PartnerType < Types::BaseObject
description: 'The URL provided by the partner for users to find out more info'

field :twitter_url, String,
description: 'The URL to the partner\'s Twitter profile'
description: "Full URL for partner's Twitter / X profile"

field :facebook_url, String,
method: :facebook_link,
description: 'The URL of the partner\'s Facebook page'
description: "Full URL of partner's Facebook page"

field :instagram_url, String,
description: "Full URL of partner's instagram page"

field :areas_served, [NeighbourhoodType],
method: :service_area_neighbourhoods,
Expand Down
4 changes: 4 additions & 0 deletions app/models/partner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ def twitter_url
"https://twitter.com/#{twitter_handle}" if twitter_handle.present?
end

def instagram_url
"https://instagram.com/#{instagram_handle}" if instagram_handle.present?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't immediately see where the instagram_handle is coming from - but appears it was already part of the model. Was it previously not being rendered as a link?

end

def logo_url
image&.url
end
Expand Down
1 change: 1 addition & 0 deletions collections/All Partners.bru
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ body:graphql {
url
twitterUrl
facebookUrl
instagramUrl
}
}
}
Expand Down
1 change: 1 addition & 0 deletions collections/Partner by ID.bru
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ body:graphql {
url
twitterUrl
facebookUrl
instagramUrl
}
}

Expand Down
4 changes: 3 additions & 1 deletion test/integration/graphql/partners_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ def check_basic_fields(data, partner)
assert_field_equals data, 'description', value: partner.description
assert_field_equals data, 'accessibilitySummary', value: partner.accessibility_info
assert_field_equals data, 'url', value: partner.url
assert_field_equals data, 'twitterUrl', value: "https://twitter.com/#{partner.twitter_handle}"
assert_field_equals data, 'twitterUrl', value: partner.twitter_url
assert_field_equals data, 'facebookUrl', value: partner.facebook_link
assert_field_equals data, 'instagramUrl', value: partner.instagram_url

# see note below
# assert_field_equals data, 'logo', value: partner.image.url
Expand All @@ -155,6 +156,7 @@ def check_basic_fields(data, partner)
url
twitterUrl
facebookUrl
instagramUrl

address {
streetAddress
Expand Down
Loading