-
Notifications
You must be signed in to change notification settings - Fork 142
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
GraphQL - Embeds #898
base: the-future
Are you sure you want to change the base?
GraphQL - Embeds #898
Changes from 5 commits
34e0d65
a04db9d
9424ba9
913b1c4
7d4a713
cc45c46
9fb779b
65ef417
ef6c4c9
5e9c522
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Types::Embed::AudioTagEmbed < Types::BaseObject | ||
implements Types::Interface::BaseEmbed | ||
|
||
description 'Audio Properties' | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Final newline missing. (https://rubystyle.guide#newline-eof) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Types::Embed::ImageTagEmbed < Types::BaseObject | ||
implements Types::Interface::BaseEmbed | ||
|
||
description 'Image Properties' | ||
|
||
field :width, String, | ||
null: false, | ||
description: 'The number of pixels wide.' | ||
|
||
field :height, String, | ||
null: false, | ||
description: 'The number of pixels high.' | ||
|
||
field :alt, String, | ||
null: false, | ||
description: 'A description of what is in the image (not a caption).' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Types::Embed::WebsiteEmbed < Types::BaseObject | ||
implements Types::Interface::BaseEmbed | ||
|
||
field :first_name, String, | ||
null: true, | ||
description: 'A name normally given to an individual by a parent or self-chosen.' | ||
|
||
field :last_name, String, | ||
null: true, | ||
description: <<~DESCRIPTION.squish | ||
A name inherited from a family or marriage | ||
and by which the individual is commonly known. | ||
DESCRIPTION | ||
|
||
field :username, String, | ||
null: true, | ||
description: 'A short unique string to identify them.' | ||
|
||
field :gender, Types::Enum::Gender, | ||
null: true, | ||
description: 'Their gender.' | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Final newline missing. (https://rubystyle.guide#newline-eof) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Types::Embed::VideoTagEmbed < Types::BaseObject | ||
implements Types::Interface::BaseEmbed | ||
|
||
description 'Video Properties' | ||
|
||
field :width, String, | ||
null: false, | ||
description: 'The number of pixels wide.' | ||
|
||
field :height, String, | ||
null: false, | ||
description: 'The number of pixels high.' | ||
|
||
field :alt, String, | ||
null: false, | ||
description: 'A description of what is in the video (not a caption).' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Types::Embed::WebsiteEmbed < Types::BaseObject | ||
implements Types::Interface::BaseEmbed | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Final newline missing. (https://rubystyle.guide#newline-eof) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Types::Enum::Gender < Types::Enum::Base | ||
value 'MALE', value: 'male' | ||
value 'FEMALE', value: 'female' | ||
value 'OTHER', value: 'other' | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Final newline missing. (https://rubystyle.guide#newline-eof) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
module Types::Interface::BaseEmbed | ||
include Types::Interface::Base | ||
description 'Required and Optional fields for an Embed based off the Open Graph protocol' | ||
|
||
orphan_types Types::Embed::WebsiteEmbed | ||
|
||
field :title, String, | ||
null: false, | ||
description: 'The title of your object as it should appear within the graph.' | ||
|
||
field :kind, String, | ||
null: false, | ||
description: <<~DESCRIPTION.squish | ||
The type of your object, | ||
e.g., "video.movie". | ||
Depending on the type you specify, other properties may also be required. | ||
DESCRIPTION | ||
|
||
field :site, String, | ||
null: false, | ||
description: '' | ||
|
||
field :url, String, | ||
null: false, | ||
description: 'The canonical URL of your object that will be used as its permanent ID in the graph' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [102/100] (https://rubystyle.guide#80-character-limits) |
||
|
||
field :image, Types::ImageTagEmbed, | ||
null: false, | ||
description: 'An image URL which should represent your object within the graph.' | ||
|
||
field :audio, Types::AudioTagEmbed, | ||
null: true, | ||
description: 'A URL to an audio file to accompany this object.' | ||
|
||
field :description, String, | ||
null: true, | ||
description: 'A one to two sentence description of your object.' | ||
|
||
field :determiner, String, | ||
null: true, | ||
description: <<~DESCRIPTION.squish | ||
The word that appears before this object's title in a sentence. | ||
An enum of (a, an, the, "", auto). If auto is chosen, | ||
the consumer of your data should chose between "a" or "an". Default is "" (blank). | ||
DESCRIPTION | ||
|
||
field :locale, String, | ||
null: true, | ||
default_value: 'en_us', | ||
description: <<~DESCRIPTION.squish | ||
The locale these tags are marked up in. | ||
Of the format language_territory. | ||
DESCRIPTION | ||
|
||
field :locale_alternative, [String], | ||
null: true, | ||
description: 'An array of other locales this page is available in.' | ||
|
||
field :site_name, String, | ||
null: true, | ||
description: <<~DESCRIPTION.squish | ||
If your object is part of a larger web site, | ||
the name which should be displayed for the overall site. | ||
DESCRIPTION | ||
|
||
field :video, Types::VideoTagEmbed, | ||
null: true, | ||
description: 'A URL to a video file that complements this object.' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Types::Interface::BaseTagEmbed | ||
include Types::Interface::Base | ||
|
||
description 'Similar fields between Image, Audio, Video Tags.' | ||
|
||
field :url, String, | ||
null: false, | ||
description: 'A url.' | ||
|
||
field :secure_url, String, | ||
null: true, | ||
description: 'An alternate url to use if the webpage requires HTTPS.' | ||
|
||
field :kind, String, | ||
null: true, | ||
description: 'A MIME type' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Types::Union::EmbedItem < Types::Union::Base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a good argument to using a union vs just referencing the base embed interface that all embeds inherit from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not actually sure. I've always preferred using a union vs referencing the base embed, I think it reads nicer. But both function the same way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reading this: https://artsy.github.io/blog/2019/01/14/graphql-union-vs-interface/ I think I prefer Unions. |
||
description 'All the different Embed types' | ||
|
||
possible_types Types::Embed::WebsiteEmbed | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the
Tag
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seemed kind of strange just being
AudioEmbed
and on the docs it used tag in the description. i.e:The og:video tag has the identical tags
which I kinda liked. I can rename though.