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

Add support for querying a field's linkType #75

Merged
merged 3 commits into from
Nov 5, 2015
Merged
Changes from 1 commit
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
1 change: 1 addition & 0 deletions lib/contentful/field.rb
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ class Field
property :id, :string
property :name, :string
property :type, :string
property :linkType, :string
property :items, Field
property :required, :boolean
property :localized, :boolean
13 changes: 13 additions & 0 deletions spec/field_spec.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@

describe Contentful::Field do
let(:field) { vcr('field') { create_client.content_type('cat').fields.first } }
let(:linkField) { vcr('linkField') {
create_client.content_type('cat').fields.select { |f| f.id == 'image' }.first
} }

describe 'Properties' do
it 'has a #properties getter returning a hash with symbol keys' do
@@ -33,4 +36,14 @@
expect(field.required).to be_truthy
end
end

describe 'Link field properties' do
it 'has #type' do
expect(linkField.type).to eq 'Link'
end

it 'has #linkType' do
expect(linkField.link_type).to eq 'Asset'
end
end
end