contentful 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ed4d3309966895ce684008c996e75049713e264
4
- data.tar.gz: 40123f61c8a46803a3c4ad2e880c4d5aeb7dcffc
3
+ metadata.gz: 6a904e1decfbc78bc44ca0dff8882e712b1342c3
4
+ data.tar.gz: 9e4e1fbe1a6f851cd1294cf6e937f5dd42df01f5
5
5
  SHA512:
6
- metadata.gz: 176f36cc905b504589f0a382435a441b1138fe7d91dc96c867fd512b54470bbf8da95d5e2a9b9c5d5f08f3a26b3d27571c2dec5ca10be38afef61cbf2aedd215
7
- data.tar.gz: 89203b3ace82cc92b9e6b3f6d689b100e433c82a0b50ebc7b2713e05c0197c331b3dd35ff250be58c444f25d408fd53f5a44dd9167d18783dbff61ea88a2279a
6
+ metadata.gz: 914f9f1a62d29730cedb7863191f240e873f6b9d28532dbda5412662be8899f832855ec62f9b0b02435afb36c85b3c9d5bac616b45998fbd9085739256af51f0
7
+ data.tar.gz: 73819d1c7c6bc21ca72aa2e183f2b013899349dc0877f7fa6313f62f1e242381d7d401a892683c0ee37d251e9259e36bc3b1f3efc033dbe4868d0c9d87ab9555
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## 0.7.0
5
+ ### Added
6
+ * Add support for querying a field's `linkType` [#75](https://github.com/contentful/contentful.rb/pull/75)
7
+ * Handles multiple locales when requesting with `locale: "*"` [contentful_middleman/#39](https://github.com/contentful-labs/contentful_middleman/issues/39)
8
+
9
+ ### Fixed
10
+ * Fix Custom Resource creation parameters [#69](https://github.com/contentful/contentful.rb/issues/69)
11
+ * `Sync API` now works with `:raw_mode` enabled [#68](https://github.com/contentful/contentful.rb/issues/68)
12
+ * Bugfix for `Field.items` [#76](https://github.com/contentful/contentful.rb/pull/76)
13
+
4
14
  ## 0.6.0
5
15
  ### Fixed
6
16
  * Parse nested locales in `AssetFields` [#66](https://github.com/contentful/contentful.rb/pull/66)
@@ -28,8 +28,8 @@ module Contentful
28
28
 
29
29
  Class.new DynamicEntry do
30
30
  content_type.fields.each do |f|
31
- define_method Support.snakify(f.id).to_sym do
32
- fields[f.id.to_sym]
31
+ define_method Support.snakify(f.id).to_sym do |wanted_locale = default_locale|
32
+ fields(wanted_locale)[f.id.to_sym]
33
33
  end
34
34
  end
35
35
 
@@ -9,6 +9,7 @@ module Contentful
9
9
  property :id, :string
10
10
  property :name, :string
11
11
  property :type, :string
12
+ property :linkType, :string
12
13
  property :items, Field
13
14
  property :required, :boolean
14
15
  property :localized, :boolean
@@ -21,7 +21,7 @@ module Contentful
21
21
 
22
22
  attr_reader :properties, :request, :client, :default_locale
23
23
 
24
- def initialize(object, request = nil, client = nil, nested_locale_fields = false, default_locale = Contentful::Client::DEFAULT_CONFIGURATION[:default_locale])
24
+ def initialize(object = nil, request = nil, client = nil, nested_locale_fields = false, default_locale = Contentful::Client::DEFAULT_CONFIGURATION[:default_locale])
25
25
  self.class.update_coercions!
26
26
  @nested_locale_fields = nested_locale_fields
27
27
  @default_locale = default_locale
@@ -104,11 +104,38 @@ module Contentful
104
104
  nil
105
105
  elsif value.is_a? ::Array
106
106
  value.map { |v| coerce_or_create_class(v, what) }
107
+ elsif should_coerce_hash?(value)
108
+ ::Hash[value.map { |k, v|
109
+ to_coerce = v.is_a?(Hash) ? v : v.to_s
110
+ coercion = v.is_a?(Numeric) ? v : coerce_or_create_class(to_coerce, what)
111
+ [k.to_sym, coercion]
112
+ }]
107
113
  else
108
114
  coerce_or_create_class(value, what)
109
115
  end
110
116
  end
111
117
 
118
+ def should_coerce_hash?(value)
119
+ value.is_a?(::Hash) &&
120
+ !self.is_a?(Asset) &&
121
+ !self.is_a?(Field) &&
122
+ !is_location?(value) &&
123
+ !is_link?(value) &&
124
+ !is_image?(value)
125
+ end
126
+
127
+ def is_location?(value)
128
+ value.has_key?("lat") || value.has_key?("lon")
129
+ end
130
+
131
+ def is_link?(value)
132
+ value.has_key?("sys") && value["sys"]["type"] == "Link"
133
+ end
134
+
135
+ def is_image?(value)
136
+ value.has_key?("image")
137
+ end
138
+
112
139
  def coerce_or_create_class(value, what)
113
140
  case what
114
141
  when Symbol
@@ -7,12 +7,12 @@ module Contentful
7
7
  module Fields
8
8
  # Returns all fields of the asset
9
9
  def fields(wanted_locale = default_locale)
10
- @fields[locale || wanted_locale]
10
+ @fields.has_key?(wanted_locale) ? @fields[wanted_locale] : @fields[locale]
11
11
  end
12
12
 
13
- def initialize(object, *)
13
+ def initialize(object = nil, *)
14
14
  super
15
- extract_fields_from_object! object
15
+ extract_fields_from_object! object if object
16
16
  end
17
17
 
18
18
  def inspect(info = nil)
@@ -15,9 +15,9 @@ module Contentful
15
15
  }
16
16
  attr_reader :sys
17
17
 
18
- def initialize(object, *)
18
+ def initialize(object = nil, *)
19
19
  super
20
- @sys = extract_from_object object['sys'], :sys
20
+ @sys = object ? extract_from_object(object['sys'], :sys) : {}
21
21
  end
22
22
 
23
23
  def inspect(info = nil)
@@ -1,5 +1,6 @@
1
1
  require_relative 'error'
2
2
  require 'multi_json'
3
+ require 'zlib'
3
4
 
4
5
  module Contentful
5
6
  # An object representing an answer by the contentful service. It is later used
@@ -51,6 +51,10 @@ module Contentful
51
51
  page = Request.new(@client, '/sync', options_or_url).get
52
52
  end
53
53
 
54
+ if @client.configuration[:raw_mode]
55
+ return page
56
+ end
57
+
54
58
  link_page_to_sync! page
55
59
  update_sync_state_from! page
56
60
 
@@ -1,3 +1,3 @@
1
1
  module Contentful
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
data/spec/entry_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Contentful::ContentType do
3
+ describe Contentful::Entry do
4
4
  let(:entry) { vcr('entry') { create_client.entry 'nyancat' } }
5
5
 
6
6
  describe 'SystemProperties' do
@@ -50,4 +50,14 @@ describe Contentful::ContentType do
50
50
  end
51
51
  end
52
52
 
53
+ describe 'multiple locales' do
54
+ it 'can handle multiple locales' do
55
+ vcr('entry_locales') {
56
+ cat = create_client.entries(locale: "*").items.first
57
+ expect(cat.fields[:name][:'en-US']).to eq "Nyan Cat"
58
+ expect(cat.fields[:name][:'es']).to eq "Gato Nyan"
59
+ }
60
+ end
61
+ end
62
+
53
63
  end
data/spec/field_spec.rb CHANGED
@@ -2,6 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe Contentful::Field do
4
4
  let(:field) { vcr('field') { create_client.content_type('cat').fields.first } }
5
+ let(:linkField) { vcr('linkField') {
6
+ create_client.content_type('cat').fields.select { |f| f.id == 'image' }.first
7
+ } }
8
+ let(:arrayField) { vcr('arrayField') {
9
+ Contentful::Client.new(
10
+ space: 'wl1z0pal05vy',
11
+ access_token: '9b76e1bbc29eb513611a66b9fc5fb7acd8d95e83b0f7d6bacfe7ec926c819806'
12
+ ).content_type('2PqfXUJwE8qSYKuM0U6w8M').fields.select { |f| f.id == 'categories' }.first
13
+ } }
5
14
 
6
15
  describe 'Properties' do
7
16
  it 'has a #properties getter returning a hash with symbol keys' do
@@ -33,4 +42,25 @@ describe Contentful::Field do
33
42
  expect(field.required).to be_truthy
34
43
  end
35
44
  end
45
+
46
+ describe 'Link field properties' do
47
+ it 'has #type' do
48
+ expect(linkField.type).to eq 'Link'
49
+ end
50
+
51
+ it 'has #linkType' do
52
+ expect(linkField.link_type).to eq 'Asset'
53
+ end
54
+ end
55
+
56
+ describe 'Array field properties' do
57
+ it 'has #type' do
58
+ expect(arrayField.type).to eq 'Array'
59
+ end
60
+
61
+ it 'has #items' do
62
+ expect(arrayField.items.type).to eq 'Link'
63
+ expect(arrayField.items.link_type).to eq 'Entry'
64
+ end
65
+ end
36
66
  end
@@ -0,0 +1,87 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/wl1z0pal05vy/content_types/2PqfXUJwE8qSYKuM0U6w8M
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/0.6.0
12
+ Authorization:
13
+ - Bearer 9b76e1bbc29eb513611a66b9fc5fb7acd8d95e83b0f7d6bacfe7ec926c819806
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - cdn.contentful.com
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Access-Control-Allow-Headers:
28
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation
29
+ Access-Control-Allow-Methods:
30
+ - GET,HEAD,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ Access-Control-Expose-Headers:
34
+ - Etag
35
+ Access-Control-Max-Age:
36
+ - '86400'
37
+ Cache-Control:
38
+ - max-age=0
39
+ Content-Encoding:
40
+ - gzip
41
+ Content-Type:
42
+ - application/vnd.contentful.delivery.v1+json
43
+ Server:
44
+ - nginx
45
+ X-Contentful-Request-Id:
46
+ - 90a-2073223720
47
+ Content-Length:
48
+ - '639'
49
+ Accept-Ranges:
50
+ - bytes
51
+ Date:
52
+ - Thu, 05 Nov 2015 15:43:28 GMT
53
+ Via:
54
+ - 1.1 varnish
55
+ Age:
56
+ - '0'
57
+ Connection:
58
+ - close
59
+ X-Served-By:
60
+ - cache-lcy1124-LCY
61
+ X-Cache:
62
+ - MISS
63
+ X-Cache-Hits:
64
+ - '0'
65
+ Vary:
66
+ - Accept-Encoding
67
+ body:
68
+ encoding: ASCII-8BIT
69
+ string: !binary |-
70
+ H4sIAAAAAAAAA5VV32/iMAx+56+I+jy2FgZjfeO4ncTtNnEq6Hab9hBawyJC
71
+ W5IU1k373y9pmvUHVXe8VI3t2M5nf/Z7ByFrRYAG3HLRkzwh9J59pTzEW5BS
72
+ a8aiIPEFys5nRksCpYu17r6iEmmcXZzDqyguMNglhIG6JlgCmZ8P7e4opEeT
73
+ dT0Ur8hMDC/dLiNqtXr7DtxnJBYkCutO8/wbLSrPaA3gkTe4mMtXX0wiGrF6
74
+ EC7VyplfVZ7yhOkWr4/AJ1Wh8TdmDKelHARsVXUNyLKyxvIXCTefhlJO5Vk9
75
+ QxVvzDkIjausU+vz53jN628WFdnpqZXr+lX8CRawjhiBoyz8Bs3pubTBdBMK
76
+ VoAtMdxjSgKseq2glCZUUYCMXgrsSRQKCEWOueafNs5Mhg+HeI49Qqa98ab3
77
+ 52BHZLjDpija8DknpDrpMqk/I20v3IwR/6ir4qrQwHWfbJfA2on2jeEwqHfC
78
+ sips7L1K52lIWzvud4JDQUS5y7NxtDuSm3BTCfT6q/y920U9e75JCpFx9j9D
79
+ Z7zHhOIlBYRLQ1BPzQMsOREl5BsdSwSe1XysD+IsH4unBaktHmNZyILjFW3W
80
+ So2w1yjvZV7MhJfKPFvqvNkxpvZgnzYOhE/n5XbWbnIXvdlu9bD4ebgZ7by/
81
+ t8mdvRgeRnd5KIvBnnA1nF3kOPk9n4HkbjAWqqw927nsOr2uY8+dS9e5cgf2
82
+ +dWw/2gcJLFkXMl40LWdbl8a992+4/ZH56Pr60eVerZvrKC0D9SaeiEc+ZqJ
83
+ SOGEAliREDgSL4C4XFa+SBigaIUwyhcGkqzNeW8FhMcUpz/UGlXZlndi56Pz
84
+ D96xWbNkBwAA
85
+ http_version:
86
+ recorded_at: Thu, 05 Nov 2015 15:43:27 GMT
87
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,122 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/entries?locale=*
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/0.1.1
12
+ Authorization:
13
+ - Bearer b4c0n73n7fu1
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Host:
17
+ - cdn.contentful.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Wed, 16 Apr 2014 09:00:23 GMT
25
+ Server:
26
+ - nginx/1.1.19
27
+ Access-Control-Allow-Headers:
28
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization
29
+ Access-Control-Allow-Methods:
30
+ - GET,HEAD,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Max-Age:
34
+ - '86400'
35
+ Cache-Control:
36
+ - max-age=0
37
+ Content-Type:
38
+ - application/vnd.contentful.delivery.v1+json
39
+ Etag:
40
+ - "\"a9e11c59bf73598894bf05d4db7700cb\""
41
+ X-Contentful-Request-Id:
42
+ - 71a-635712892
43
+ Content-Length:
44
+ - '882'
45
+ Accept-Ranges:
46
+ - bytes
47
+ Via:
48
+ - 1.1 varnish
49
+ Age:
50
+ - '1'
51
+ X-Served-By:
52
+ - cache-am72-AMS
53
+ X-Cache:
54
+ - HIT
55
+ X-Cache-Hits:
56
+ - '1'
57
+ Vary:
58
+ - Accept-Encoding
59
+ body:
60
+ encoding: UTF-8
61
+ string: |
62
+ {
63
+ "sys": {
64
+ "type": "Array"
65
+ },
66
+ "total": 10,
67
+ "skip": 0,
68
+ "limit": 100,
69
+ "items": [
70
+ {
71
+ "fields": {
72
+ "name": {"en-US": "Nyan Cat", "es": "Gato Nyan"},
73
+ "likes": [
74
+ "rainbows",
75
+ "fish"
76
+ ],
77
+ "color": "rainbow",
78
+ "bestFriend": {
79
+ "sys": {
80
+ "type": "Link",
81
+ "linkType": "Entry",
82
+ "id": "happycat"
83
+ }
84
+ },
85
+ "birthday": "2011-04-04T22:00:00+00:00",
86
+ "lives": 1337,
87
+ "image": {
88
+ "sys": {
89
+ "type": "Link",
90
+ "linkType": "Asset",
91
+ "id": "nyancat"
92
+ }
93
+ }
94
+ },
95
+ "sys": {
96
+ "space": {
97
+ "sys": {
98
+ "type": "Link",
99
+ "linkType": "Space",
100
+ "id": "cfexampleapi"
101
+ }
102
+ },
103
+ "type": "Entry",
104
+ "contentType": {
105
+ "sys": {
106
+ "type": "Link",
107
+ "linkType": "ContentType",
108
+ "id": "cat"
109
+ }
110
+ },
111
+ "id": "nyancat",
112
+ "revision": 5,
113
+ "createdAt": "2013-06-27T22:46:19.513Z",
114
+ "updatedAt": "2013-09-04T09:19:39.027Z",
115
+ "locale": "en-US"
116
+ }
117
+ }
118
+ ]
119
+ }
120
+ http_version:
121
+ recorded_at: Wed, 16 Apr 2014 09:00:23 GMT
122
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,83 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/content_types/cat
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/0.6.0
12
+ Authorization:
13
+ - Bearer b4c0n73n7fu1
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - cdn.contentful.com
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Access-Control-Allow-Headers:
28
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation
29
+ Access-Control-Allow-Methods:
30
+ - GET,HEAD,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ Access-Control-Expose-Headers:
34
+ - Etag
35
+ Access-Control-Max-Age:
36
+ - '86400'
37
+ Cache-Control:
38
+ - max-age=0
39
+ Content-Encoding:
40
+ - gzip
41
+ Content-Type:
42
+ - application/vnd.contentful.delivery.v1+json
43
+ Server:
44
+ - nginx
45
+ X-Contentful-Request-Id:
46
+ - 405-1374790120
47
+ Content-Length:
48
+ - '473'
49
+ Accept-Ranges:
50
+ - bytes
51
+ Date:
52
+ - Thu, 05 Nov 2015 14:54:08 GMT
53
+ Via:
54
+ - 1.1 varnish
55
+ Age:
56
+ - '0'
57
+ Connection:
58
+ - close
59
+ X-Served-By:
60
+ - cache-ams4127-AMS
61
+ X-Cache:
62
+ - MISS
63
+ X-Cache-Hits:
64
+ - '0'
65
+ Vary:
66
+ - Accept-Encoding
67
+ body:
68
+ encoding: ASCII-8BIT
69
+ string: !binary |-
70
+ H4sIAAAAAAAAA61UO2/CMBjc+RWR54JIoECzAS0SEu1CJqoOJvlCLZxHbUNJ
71
+ Ef+9zsMhIRZFbZdIuc86n8/nO7YMA/kEqMeRbbzKP8M4Zl+JE09iKMQBoDuF
72
+ ZX8SfamhIokz1IGDOK9l8LEjDFIWwXZQctDIxZR8lYOM+5SPLzanZAu8ufui
73
+ Dqvtx4zhRLu/jynXC6hPiIAgdULJkC4o8mUSrCOKCiNOV0S7EY1YU/S0Dl/w
74
+ lu5UXPtB9RUJa+BixgiEXlPHRM6My6FSsyDh9k8OUkngFHF4CgVLcsf017sm
75
+ TLx71TtT+Zo0JkrhIxaVPP6LW5T4+pRJ2KDgVzKtVMxDARuo3PLtQsqb9gjH
76
+ a3rbM9jrBUr4/wVeyRUJ8EbTBvM6/Asv9PmrhmnMOYgiTFLhW2pjXk6yeKY4
77
+ vyMkPY0pTmZppdXaC3nAXUZiQaIwHTxD9NnJko54cn7yiMfYTbusLKLqNKtF
78
+ rVSJV8UuMxZ102WXuj4ccBBTwDHRNklJPo1kwEKRvaScpqhjtzip5GSwJzw/
79
+ jlWscRnI5+GNRXpEq2v22t1B2xo6lmX3B7ZpdUb31koR7mLvcvFDu2s5Zs82
80
+ +3Z/2BkNeqtU5ql1an0DwOA8wioGAAA=
81
+ http_version:
82
+ recorded_at: Thu, 05 Nov 2015 14:54:08 GMT
83
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,106 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/cfexampleapi/sync?initial=true
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulGem/0.1.3
12
+ Authorization:
13
+ - Bearer b4c0n73n7fu1
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Host:
17
+ - cdn.contentful.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Fri, 25 Apr 2014 13:31:17 GMT
25
+ Server:
26
+ - nginx/1.1.19
27
+ Access-Control-Allow-Headers:
28
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization
29
+ Access-Control-Allow-Methods:
30
+ - GET,HEAD,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Max-Age:
34
+ - '86400'
35
+ Cache-Control:
36
+ - max-age=0
37
+ Content-Type:
38
+ - application/vnd.contentful.delivery.v1+json
39
+ Etag:
40
+ - '"382e4781b902b58d2edf3f10067167c7"'
41
+ X-Contentful-Request-Id:
42
+ - f1c-737770542
43
+ Content-Length:
44
+ - '300'
45
+ Accept-Ranges:
46
+ - bytes
47
+ Via:
48
+ - 1.1 varnish
49
+ Age:
50
+ - '0'
51
+ X-Served-By:
52
+ - cache-fra1229-FRA
53
+ X-Cache:
54
+ - MISS
55
+ X-Cache-Hits:
56
+ - '0'
57
+ Vary:
58
+ - Accept-Encoding
59
+ body:
60
+ encoding: UTF-8
61
+ string: |
62
+ {
63
+ "sys": {
64
+ "type": "Array"
65
+ },
66
+ "items": [
67
+ {
68
+ "sys": {
69
+ "space": {
70
+ "sys": {
71
+ "type": "Link",
72
+ "linkType": "Space",
73
+ "id": "cfexampleapi"
74
+ }
75
+ },
76
+ "type": "Entry",
77
+ "contentType": {
78
+ "sys": {
79
+ "type": "Link",
80
+ "linkType": "ContentType",
81
+ "id": "1t9IbcfdCk6m04uISSsaIK"
82
+ }
83
+ },
84
+ "id": "5ETMRzkl9KM4omyMwKAOki",
85
+ "revision": 2,
86
+ "createdAt": "2014-02-21T13:42:57.752Z",
87
+ "updatedAt": "2014-04-16T12:44:02.691Z"
88
+ },
89
+ "fields": {
90
+ "name": {
91
+ "en-US": "London"
92
+ },
93
+ "center": {
94
+ "en-US": {
95
+ "lat": 51.508515,
96
+ "lon": -0.12548719999995228
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ],
102
+ "nextSyncUrl": "https://cdn.contentful.com/spaces/cfexampleapi/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg"
103
+ }
104
+ http_version:
105
+ recorded_at: Fri, 25 Apr 2014 13:31:18 GMT
106
+ recorded_with: VCR 2.9.0
@@ -16,11 +16,38 @@ describe Contentful::Resource do
16
16
 
17
17
  it 'can deal with invalid objects' do
18
18
  expect do
19
- Contentful::ContentType.new({})
19
+ Contentful::ContentType.new
20
20
  end.not_to raise_error
21
21
  end
22
22
  end
23
23
 
24
+ describe 'custom resource' do
25
+ class TestCat
26
+ include Contentful::Resource
27
+
28
+ property :name
29
+ property :likes
30
+ property :color
31
+ property :bestFriend
32
+ property :birthday
33
+ property :lives
34
+ property :image
35
+ end
36
+
37
+ it 'can create a custom resource' do
38
+ cat = TestCat.new("name" => "foobar")
39
+ expect(cat).to respond_to(:name)
40
+ expect(cat.name).to eq "foobar"
41
+ end
42
+
43
+ it 'can create a custom resource from API' do
44
+ vcr('entry') {
45
+ cat = TestCat.new create_client(raw_mode: true).entry('nyancat').object["fields"]
46
+ expect(cat.name).to eq "Nyan Cat"
47
+ }
48
+ end
49
+ end
50
+
24
51
  describe '#request' do
25
52
  it 'will return a request object, if it has been initialized with one' do
26
53
  request = Contentful::Request.new(nil, 'content_types')
data/spec/sync_spec.rb CHANGED
@@ -97,4 +97,62 @@ describe Contentful::Sync do
97
97
  }
98
98
  end
99
99
  end
100
+
101
+ describe 'raw_mode' do
102
+ before do
103
+ @sync = create_client(raw_mode: true).sync(initial: true)
104
+ end
105
+
106
+ it 'should not fail' do
107
+ vcr('sync_page_short') {
108
+ expect { @sync.first_page }.not_to raise_error
109
+ }
110
+ end
111
+
112
+ it 'should return a raw Response' do
113
+ vcr('sync_page_short') {
114
+ expect(@sync.first_page).to be_a Contentful::Response
115
+ }
116
+ end
117
+
118
+ it 'should return JSON' do
119
+ expected = {
120
+ "sys" => {"type" => "Array"},
121
+ "items" => [
122
+ {
123
+ "sys" => {
124
+ "space" => {
125
+ "sys" => {
126
+ "type" => "Link",
127
+ "linkType" => "Space",
128
+ "id" => "cfexampleapi"}
129
+ },
130
+ "type" => "Entry",
131
+ "contentType" => {
132
+ "sys" => {
133
+ "type" => "Link",
134
+ "linkType" => "ContentType",
135
+ "id" => "1t9IbcfdCk6m04uISSsaIK"
136
+ }
137
+ },
138
+ "id" => "5ETMRzkl9KM4omyMwKAOki",
139
+ "revision" => 2,
140
+ "createdAt" => "2014-02-21T13:42:57.752Z",
141
+ "updatedAt" => "2014-04-16T12:44:02.691Z"
142
+ },
143
+ "fields" => {
144
+ "name" => {"en-US"=>"London"},
145
+ "center" => {
146
+ "en-US" => {"lat"=>51.508515, "lon"=>-0.12548719999995228}
147
+ }
148
+ }
149
+ }
150
+ ],
151
+ "nextSyncUrl" => "https://cdn.contentful.com/spaces/cfexampleapi/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg"
152
+ }
153
+ vcr('sync_page_short') {
154
+ expect(@sync.first_page.object).to eql expected
155
+ }
156
+ end
157
+ end
100
158
  end
metadata CHANGED
@@ -1,129 +1,130 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
8
8
  - Contentful GmbH (Andreas Tiefenthaler)
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-21 00:00:00.000000000 Z
12
+ date: 2015-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: http
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0.8'
20
- name: http
21
- prerelease: false
22
21
  type: :runtime
22
+ prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0.8'
28
28
  - !ruby/object:Gem::Dependency
29
+ name: multi_json
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
34
  version: '1'
34
- name: multi_json
35
- prerelease: false
36
35
  type: :runtime
36
+ prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1'
42
42
  - !ruby/object:Gem::Dependency
43
+ name: bundler
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - "~>"
46
47
  - !ruby/object:Gem::Version
47
48
  version: '1.5'
48
- name: bundler
49
- prerelease: false
50
49
  type: :development
50
+ prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.5'
56
56
  - !ruby/object:Gem::Dependency
57
+ name: rake
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - "~>"
60
61
  - !ruby/object:Gem::Version
61
62
  version: '10'
62
- name: rake
63
- prerelease: false
64
63
  type: :development
64
+ prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '10'
70
70
  - !ruby/object:Gem::Dependency
71
+ name: rubygems-tasks
71
72
  requirement: !ruby/object:Gem::Requirement
72
73
  requirements:
73
74
  - - "~>"
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0.2'
76
- name: rubygems-tasks
77
- prerelease: false
78
77
  type: :development
78
+ prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0.2'
84
84
  - !ruby/object:Gem::Dependency
85
+ name: rspec
85
86
  requirement: !ruby/object:Gem::Requirement
86
87
  requirements:
87
88
  - - "~>"
88
89
  - !ruby/object:Gem::Version
89
90
  version: '2'
90
- name: rspec
91
- prerelease: false
92
91
  type: :development
92
+ prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '2'
98
98
  - !ruby/object:Gem::Dependency
99
+ name: rr
99
100
  requirement: !ruby/object:Gem::Requirement
100
101
  requirements:
101
102
  - - ">="
102
103
  - !ruby/object:Gem::Version
103
104
  version: '0'
104
- name: rr
105
- prerelease: false
106
105
  type: :development
106
+ prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
+ name: vcr
113
114
  requirement: !ruby/object:Gem::Requirement
114
115
  requirements:
115
116
  - - ">="
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
- name: vcr
119
- prerelease: false
120
119
  type: :development
120
+ prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
+ name: webmock
127
128
  requirement: !ruby/object:Gem::Requirement
128
129
  requirements:
129
130
  - - "~>"
@@ -132,9 +133,8 @@ dependencies:
132
133
  - - ">="
133
134
  - !ruby/object:Gem::Version
134
135
  version: 1.17.3
135
- name: webmock
136
- prerelease: false
137
136
  type: :development
137
+ prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - "~>"
@@ -159,10 +159,7 @@ files:
159
159
  - README.md
160
160
  - RELEASE.md
161
161
  - Rakefile
162
- - TAGS
163
162
  - contentful.gemspec
164
- - coverage/.last_run.json
165
- - coverage/.resultset.json
166
163
  - examples/custom_classes.rb
167
164
  - examples/dynamic_entries.rb
168
165
  - examples/example_queries.rb
@@ -220,6 +217,7 @@ files:
220
217
  - spec/fixtures/json_responses/self_link.json
221
218
  - spec/fixtures/json_responses/unparsable.json
222
219
  - spec/fixtures/vcr_cassettes/array.yml
220
+ - spec/fixtures/vcr_cassettes/arrayField.yml
223
221
  - spec/fixtures/vcr_cassettes/array_page_1.yml
224
222
  - spec/fixtures/vcr_cassettes/array_page_2.yml
225
223
  - spec/fixtures/vcr_cassettes/asset.yml
@@ -228,8 +226,10 @@ files:
228
226
  - spec/fixtures/vcr_cassettes/entries.yml
229
227
  - spec/fixtures/vcr_cassettes/entry.yml
230
228
  - spec/fixtures/vcr_cassettes/entry_cache.yml
229
+ - spec/fixtures/vcr_cassettes/entry_locales.yml
231
230
  - spec/fixtures/vcr_cassettes/field.yml
232
231
  - spec/fixtures/vcr_cassettes/human.yml
232
+ - spec/fixtures/vcr_cassettes/linkField.yml
233
233
  - spec/fixtures/vcr_cassettes/locale.yml
234
234
  - spec/fixtures/vcr_cassettes/location.yml
235
235
  - spec/fixtures/vcr_cassettes/not_found.yml
@@ -242,6 +242,7 @@ files:
242
242
  - spec/fixtures/vcr_cassettes/sync_deletion.yml
243
243
  - spec/fixtures/vcr_cassettes/sync_page.yml
244
244
  - spec/fixtures/vcr_cassettes/sync_page_2.yml
245
+ - spec/fixtures/vcr_cassettes/sync_page_short.yml
245
246
  - spec/fixtures/vcr_cassettes/unauthorized.yml
246
247
  - spec/fixtures/vcr_cassettes/unavailable.yml
247
248
  - spec/link_spec.rb
@@ -262,7 +263,7 @@ homepage: https://github.com/contentful/contentful.rb
262
263
  licenses:
263
264
  - MIT
264
265
  metadata: {}
265
- post_install_message:
266
+ post_install_message:
266
267
  rdoc_options: []
267
268
  require_paths:
268
269
  - lib
@@ -277,9 +278,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
278
  - !ruby/object:Gem::Version
278
279
  version: '0'
279
280
  requirements: []
280
- rubyforge_project:
281
- rubygems_version: 2.4.8
282
- signing_key:
281
+ rubyforge_project:
282
+ rubygems_version: 2.2.2
283
+ signing_key:
283
284
  specification_version: 4
284
285
  summary: contentful
285
286
  test_files:
@@ -306,6 +307,7 @@ test_files:
306
307
  - spec/fixtures/json_responses/self_link.json
307
308
  - spec/fixtures/json_responses/unparsable.json
308
309
  - spec/fixtures/vcr_cassettes/array.yml
310
+ - spec/fixtures/vcr_cassettes/arrayField.yml
309
311
  - spec/fixtures/vcr_cassettes/array_page_1.yml
310
312
  - spec/fixtures/vcr_cassettes/array_page_2.yml
311
313
  - spec/fixtures/vcr_cassettes/asset.yml
@@ -314,8 +316,10 @@ test_files:
314
316
  - spec/fixtures/vcr_cassettes/entries.yml
315
317
  - spec/fixtures/vcr_cassettes/entry.yml
316
318
  - spec/fixtures/vcr_cassettes/entry_cache.yml
319
+ - spec/fixtures/vcr_cassettes/entry_locales.yml
317
320
  - spec/fixtures/vcr_cassettes/field.yml
318
321
  - spec/fixtures/vcr_cassettes/human.yml
322
+ - spec/fixtures/vcr_cassettes/linkField.yml
319
323
  - spec/fixtures/vcr_cassettes/locale.yml
320
324
  - spec/fixtures/vcr_cassettes/location.yml
321
325
  - spec/fixtures/vcr_cassettes/not_found.yml
@@ -328,6 +332,7 @@ test_files:
328
332
  - spec/fixtures/vcr_cassettes/sync_deletion.yml
329
333
  - spec/fixtures/vcr_cassettes/sync_page.yml
330
334
  - spec/fixtures/vcr_cassettes/sync_page_2.yml
335
+ - spec/fixtures/vcr_cassettes/sync_page_short.yml
331
336
  - spec/fixtures/vcr_cassettes/unauthorized.yml
332
337
  - spec/fixtures/vcr_cassettes/unavailable.yml
333
338
  - spec/link_spec.rb
data/TAGS DELETED
@@ -1,315 +0,0 @@
1
-
2
- examples/custom_classes.rb,120
3
- class MyResourceMyResource12,406
4
- class MyBetterArray < Contentful::ArrayMyBetterArray36,920
5
- def lastlast38,1003
6
-
7
- examples/dynamic_entries.rb,0
8
-
9
- examples/example_queries.rb,0
10
-
11
- examples/raise_errors.rb,0
12
-
13
- examples/raw_mode.rb,0
14
-
15
- examples/resource_mapping.rb,84
16
- class MyBetterArray < Contentful::ArrayMyBetterArray12,377
17
- def lastlast14,460
18
-
19
- lib/contentful/array.rb,95
20
- module ContentfulContentful4,68
21
- class ArrayArray8,341
22
- def next_pagenext_page21,647
23
-
24
- lib/contentful/asset.rb,109
25
- module ContentfulContentful4,70
26
- class AssetAsset7,203
27
- def image_url(options = {})image_url19,627
28
-
29
- lib/contentful/client.rb,1108
30
- module ContentfulContentful8,132
31
- class ClientClient12,295
32
- def self.get_http(url, query, headers = {})get_http30,762
33
- def initialize(given_configuration = {})initialize34,863
34
- def default_configurationdefault_configuration47,1232
35
- def space(query = {})space54,1413
36
- def content_type(id, query = {})content_type61,1618
37
- def content_types(query = {})content_types68,1869
38
- def entry(id, query = {})entry75,2083
39
- def entries(query = {})entries82,2309
40
- def asset(id, query = {})asset89,2511
41
- def assets(query = {})assets96,2735
42
- def base_urlbase_url101,2877
43
- def request_headersrequest_headers106,3066
44
- def request_query(query)request_query115,3536
45
- def get(request, build_resource = true)get126,3874
46
- def update_dynamic_entry_cache!update_dynamic_entry_cache!152,4661
47
- def register_dynamic_entry(key, klass)register_dynamic_entry165,4991
48
- def sync(options = { initial: true })sync172,5231
49
- def normalize_configuration!normalize_configuration!179,5326
50
- def validate_configuration!validate_configuration!184,5576
51
-
52
- lib/contentful/content_type.rb,72
53
- module ContentfulContentful4,54
54
- class ContentTypeContentType7,201
55
-
56
- lib/contentful/deleted_asset.rb,74
57
- module ContentfulContentful3,29
58
- class DeletedAssetDeletedAsset6,185
59
-
60
- lib/contentful/deleted_entry.rb,74
61
- module ContentfulContentful3,29
62
- class DeletedEntryDeletedEntry6,185
63
-
64
- lib/contentful/dynamic_entry.rb,130
65
- module ContentfulContentful5,92
66
- class DynamicEntry < EntryDynamicEntry6,110
67
- def self.create(content_type)create18,397
68
-
69
- lib/contentful/entry.rb,60
70
- module ContentfulContentful4,64
71
- class EntryEntry7,198
72
-
73
- lib/contentful/error.rb,614
74
- module ContentfulContentful1,0
75
- class Error < StandardErrorError4,142
76
- def initialize(response)initialize7,199
77
- def self.[](error_status_code)[]14,396
78
- class NotFound < Error; endNotFound35,733
79
- class BadRequest < Error; endBadRequest38,772
80
- class AccessDenied < Error; endAccessDenied41,813
81
- class Unauthorized < Error; endUnauthorized44,856
82
- class ServerError < Error; endServerError47,899
83
- class ServiceUnavailable < Error; endServiceUnavailable50,941
84
- class UnparsableJson < Error; endUnparsableJson53,1024
85
- class UnparsableResource < Error; endUnparsableResource56,1128
86
-
87
- lib/contentful/field.rb,60
88
- module ContentfulContentful3,29
89
- class FieldField6,195
90
-
91
- lib/contentful/file.rb,57
92
- module ContentfulContentful3,29
93
- class FileFile5,73
94
-
95
- lib/contentful/link.rb,101
96
- module ContentfulContentful3,29
97
- class LinkLink6,160
98
- def resolve(query = {})resolve12,359
99
-
100
- lib/contentful/locale.rb,62
101
- module ContentfulContentful3,29
102
- class LocaleLocale6,207
103
-
104
- lib/contentful/location.rb,66
105
- module ContentfulContentful3,29
106
- class LocationLocation6,200
107
-
108
- lib/contentful/request.rb,301
109
- module ContentfulContentful1,0
110
- class RequestRequest5,234
111
- def initialize(client, endpoint, query = {}, id = nil)initialize8,295
112
- def urlurl27,740
113
- def getget32,870
114
- def absolute?absolute?37,964
115
- def copycopy42,1064
116
- def normalize_query(query)normalize_query49,1139
117
-
118
- lib/contentful/resource/array_like.rb,235
119
- module ContentfulContentful1,0
120
- module ResourceResource2,18
121
- module ArrayLikeArrayLike5,138
122
- def array?array?9,231
123
- def each_item(&block)each_item14,304
124
- def empty?empty?20,431
125
- def sizesize25,512
126
-
127
- lib/contentful/resource/asset_fields.rb,378
128
- module ContentfulContentful3,28
129
- module ResourceResource4,46
130
- module AssetFieldsAssetFields8,212
131
- def fieldsfields15,345
132
- def initialize(object, *)initialize19,397
133
- def inspect(info = nil)inspect25,547
134
- module ClassMethodsClassMethods33,713
135
- def fields_coercionsfields_coercions34,739
136
- def self.included(base)included39,818
137
-
138
- lib/contentful/resource/fields.rb,482
139
- module ContentfulContentful1,0
140
- module ResourceResource2,18
141
- module FieldsFields7,215
142
- def fields(wanted_locale = default_locale)fields9,273
143
- def initialize(object, *)initialize13,374
144
- def inspect(info = nil)inspect18,474
145
- def extract_fields_from_object!(object)extract_fields_from_object!29,656
146
- module ClassMethodsClassMethods46,1227
147
- def fields_coercionsfields_coercions48,1309
148
- def self.included(base)included53,1374
149
-
150
- lib/contentful/resource/system_properties.rb,350
151
- module ContentfulContentful1,0
152
- module ResourceResource2,18
153
- module SystemPropertiesSystemProperties4,100
154
- def initialize(object, *)initialize18,406
155
- def inspect(info = nil)inspect23,518
156
- module ClassMethodsClassMethods31,675
157
- def sys_coercionssys_coercions32,701
158
- def self.included(base)included37,774
159
-
160
- lib/contentful/resource.rb,1041
161
- module ContentfulContentful4,62
162
- module ResourceResource13,463
163
- def initialize(object, request = nil, client = nil, nested_locale_fields = false, default_locale = Contentful::Client::DEFAULT_CONFIGURATION[:default_locale] )initialize24,743
164
- def inspect(info = nil)inspect35,1225
165
- def array?array?41,1458
166
- def nested_locale_fields?nested_locale_fields?46,1585
167
- def syssys51,1727
168
- def fieldsfields56,1838
169
- def reloadreload62,1982
170
- def extract_from_object(object, namespace, keys = nil)extract_from_object72,2091
171
- def coerce_value_or_array(value, what = nil)coerce_value_or_array85,2510
172
- def coerce_or_create_class(value, what)coerce_or_create_class95,2755
173
- module ClassMethodsClassMethods107,3068
174
- def nested_locale_fields?nested_locale_fields?109,3184
175
- def property_coercionsproperty_coercions113,3241
176
- def property(name, property_class = nil)property128,3915
177
- def update_coercions!update_coercions!136,4186
178
- def self.included(base)included155,4775
179
-
180
- lib/contentful/resource_builder.rb,2028
181
- module ContentfulContentful13,309
182
- class ResourceBuilderResourceBuilder16,470
183
- def initialize(client, response, resource_mapping = {}, entry_mapping = {}, default_locale = Contentful::Client::DEFAULT_CONFIGURATION[:default_locale])initialize32,904
184
- def runrun45,1502
185
- def create_all_resources!create_all_resources!69,2206
186
- def create_resource(object)create_resource82,2600
187
- def find_entry_class(object)find_entry_class95,3044
188
- def try_dynamic_entry(object)try_dynamic_entry100,3233
189
- def get_dynamic_entry(object)get_dynamic_entry105,3372
190
- def content_type_id_for_entry(object)content_type_id_for_entry112,3600
191
- def array_or_sync_page(object)array_or_sync_page120,3871
192
- def detect_resource_class(object)detect_resource_class135,4329
193
- def default_resource_mappingdefault_resource_mapping151,4728
194
- def default_entry_mappingdefault_entry_mapping156,4837
195
- def detect_child_objects(object)detect_child_objects163,4922
196
- def detect_child_arrays(object)detect_child_arrays171,5091
197
- def add_to_known_resources(res)add_to_known_resources184,5353
198
- def replace_children(res, object)replace_children188,5488
199
- def replace_child_array(child_array)replace_child_array200,5969
200
- def create_included_resources!(included_objects)create_included_resources!204,6097
201
- def replace_links_with_known_resources(res, seen_resource_ids = [])replace_links_with_known_resources217,6436
202
- def replace_links_in_properties(property_container, seen_resource_ids)replace_links_in_properties231,6892
203
- def replace_links_in_array(property_container, seen_resource_ids)replace_links_in_array241,7296
204
- def replace_link_or_check_recursively(property_value, property_container, property_name, seen_resource_ids)replace_link_or_check_recursively247,7574
205
- def maybe_replace_link(link, parent, key)maybe_replace_link255,8011
206
- def replace_links_in_included_resources_with_known_resourcesreplace_links_in_included_resources_with_known_resources262,8243
207
-
208
- lib/contentful/response.rb,362
209
- module ContentfulContentful6,62
210
- class ResponseResponse24,852
211
- def initialize(raw, request = nil)initialize27,935
212
- def service_unavailable_response?service_unavailable_response?45,1377
213
- def no_content_response?no_content_response?49,1449
214
- def parse_json!parse_json!53,1531
215
- def parse_contentful_error!parse_contentful_error!63,1745
216
-
217
- lib/contentful/space.rb,60
218
- module ContentfulContentful4,55
219
- class SpaceSpace7,188
220
-
221
- lib/contentful/support.rb,103
222
- module ContentfulContentful1,0
223
- module SupportSupport3,65
224
- def snakify(object)snakify6,165
225
-
226
- lib/contentful/sync.rb,450
227
- module ContentfulContentful6,132
228
- class SyncSync7,150
229
- def initialize(client, options_or_url)initialize10,195
230
- def each_page(&block)each_page18,468
231
- def first_pagefirst_page29,680
232
- def completed?completed?34,813
233
- def each_item(&block)each_item39,925
234
- def get(options_or_url)get47,1067
235
- def link_page_to_sync!(page)link_page_to_sync!63,1375
236
- def update_sync_state_from!(page)update_sync_state_from!67,1463
237
-
238
- lib/contentful/sync_page.rb,237
239
- module ContentfulContentful4,68
240
- class SyncPageSyncPage5,86
241
- def self.nested_locale_fields?nested_locale_fields16,328
242
- def next_pagenext_page20,383
243
- def next_page?next_page?24,454
244
- def last_page?last_page?28,505
245
-
246
- lib/contentful/version.rb,33
247
- module ContentfulContentful1,0
248
-
249
- lib/contentful.rb,0
250
-
251
- spec/array_spec.rb,0
252
-
253
- spec/asset_spec.rb,0
254
-
255
- spec/auto_includes_spec.rb,0
256
-
257
- spec/client_class_spec.rb,0
258
-
259
- spec/client_configuration_spec.rb,171
260
- class MyBetterAsset < Contentful::AssetMyBetterAsset180,5381
261
- def https_image_urlhttps_image_url181,5427
262
- class Cat < Contentful::EntryCat200,5922
263
-
264
- spec/coercions_spec.rb,0
265
-
266
- spec/content_type_spec.rb,0
267
-
268
- spec/deleted_asset_spec.rb,0
269
-
270
- spec/deleted_entry_spec.rb,0
271
-
272
- spec/dynamic_entry_spec.rb,0
273
-
274
- spec/entry_spec.rb,0
275
-
276
- spec/error_class_spec.rb,0
277
-
278
- spec/error_requests_spec.rb,0
279
-
280
- spec/field_spec.rb,0
281
-
282
- spec/file_spec.rb,0
283
-
284
- spec/link_spec.rb,0
285
-
286
- spec/locale_spec.rb,0
287
-
288
- spec/location_spec.rb,0
289
-
290
- spec/request_spec.rb,0
291
-
292
- spec/resource_building_spec.rb,0
293
-
294
- spec/resource_spec.rb,0
295
-
296
- spec/response_spec.rb,0
297
-
298
- spec/space_spec.rb,0
299
-
300
- spec/spec_helper.rb,0
301
-
302
- spec/support/client.rb,50
303
- def create_client(options = {})create_client1,0
304
-
305
- spec/support/json_responses.rb,117
306
- def raw_fixture(which, as_json = false)raw_fixture3,22
307
- def json_fixture(which, as_json = false)json_fixture7,148
308
-
309
- spec/support/vcr.rb,80
310
- def vcr(name, &block)vcr10,201
311
- def expect_vcr(name, &block)expect_vcr14,261
312
-
313
- spec/sync_page_spec.rb,0
314
-
315
- spec/sync_spec.rb,0