contentful 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 646bf441930ec6ed1182365e92ec26213a7c1326
4
- data.tar.gz: fc8535671280aed058b63ade0bb1539bfb61a6df
3
+ metadata.gz: b4b2933230edf4826b39a5a7d4d6b351556df06e
4
+ data.tar.gz: bc501b5ebf3ec6c371601e4042722d02fb34abe5
5
5
  SHA512:
6
- metadata.gz: 5f16eec5e3b322607af9f58d26e64baef7f1d1d2fdc32ebbd5404618c02692ce8bd517b0b28f0877a535614784abfc906af2d7c2a8e810744b0106cd5a8ea81f
7
- data.tar.gz: be5ccf489cb21a2e1e9f98eeb155cf30be2f655cdc850cef208498310f111dcf1eaaf56973db5c727fc1e6ef3a1f3316d563fa70ff996befb5e26a3f020747f7
6
+ metadata.gz: c1dde750063924ec1d9986608d5b66eb68862823ff50b175f2d1cd7e6b32f3c1df37dc00f1fb177a8f7e372ffd6aa00012016e97a625aa1fa05905ff47c03851
7
+ data.tar.gz: dae89c9fccdc81b19db54f9c8f2ed9daaddf5a222ce194d82ac3f801eef9bed26fe2a77da609c2f36979e7cc28c8b7f5801f062a8bbf70728aba1bd29289d3ff
@@ -23,3 +23,6 @@ Metrics/ClassLength:
23
23
 
24
24
  Style/MutableConstant:
25
25
  Enabled: false
26
+
27
+ Style/SignalException:
28
+ EnforcedStyle: 'semantic'
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## 0.10.0
5
+ ### Added
6
+ * Added `:fl` parameter to `Asset#image_url` to support `progressive` File Layering
7
+ * Added Marshalling methods to `Asset` [#88](https://github.com/contentful/contentful.rb/issues/88)
8
+
9
+ ## Changed
10
+ * Changed 503 error message to a less confusing one.
11
+
4
12
  ## 0.9.0
5
13
  ### Added
6
14
  * Added `Contentful::Resource::CustomResource` to automatically map fields to accessors [#79](https://github.com/contentful/contentful.rb/issues/79)
data/README.md CHANGED
@@ -24,7 +24,7 @@ client = Contentful::Client.new(
24
24
  )
25
25
  ```
26
26
 
27
- If you plan on using the [Preview API](https://www.contentful.com/developers/documentation/content-delivery-api/ruby/#preview-api-usage) you need to specify the `api_url`:
27
+ If you plan on using the [Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/) you need to specify the `api_url`:
28
28
 
29
29
  ```ruby
30
30
  client = Contentful::Client.new(
@@ -35,7 +35,7 @@ client = Contentful::Client.new(
35
35
  ```
36
36
 
37
37
  You can query for entries, assets, etc. very similar as described in the
38
- [Delivery API Documentation](https://www.contentful.com/developers/documentation/content-delivery-api/). Please note, that **all methods of the Ruby client library are snake_cased, instead of JavaScript's camelCase**:
38
+ [Delivery API Documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/). Please note, that **all methods of the Ruby client library are snake_cased, instead of JavaScript's camelCase**:
39
39
 
40
40
  ```ruby
41
41
  client.content_types
@@ -126,7 +126,7 @@ When requesting multiple locales, the object accessor shortcuts only work for th
126
126
 
127
127
  Contentful::Array has an `#each` method that delegates to its items. It also includes Ruby's Enumerable module, providing methods like `#min` or `#first`. See the Ruby core documentation for further details.
128
128
 
129
- Arrays also have a `#next_page` URL, which will rerun the request with a increased skip parameter, as described in [the documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#search-limit).
129
+ Arrays also have a `#next_page` URL, which will rerun the request with a increased skip parameter, as described in [the documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/skip).
130
130
 
131
131
 
132
132
  ### Links
@@ -313,7 +313,7 @@ end
313
313
 
314
314
  ## Synchronization
315
315
 
316
- The client also includes a wrapper for the synchronization endpoint. You can initialize it with the options described in the [Delivery API Documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#sync) or an URL you received from a previous sync:
316
+ The client also includes a wrapper for the synchronization endpoint. You can initialize it with the options described in the [Delivery API Documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/synchronization) or an URL you received from a previous sync:
317
317
 
318
318
  ```ruby
319
319
  client = Contentful::Client.new(
@@ -9,6 +9,18 @@ module Contentful
9
9
  include Contentful::Resource::SystemProperties
10
10
  include Contentful::Resource::AssetFields
11
11
 
12
+ # @private
13
+ def marshal_dump
14
+ raw
15
+ end
16
+
17
+ # @private
18
+ def marshal_load(raw_object)
19
+ @properties = extract_from_object(raw_object, :property, self.class.property_coercions.keys)
20
+ @sys = raw_object.key?('sys') ? extract_from_object(raw_object['sys'], :sys) : {}
21
+ initialize_fields_for_localized_resource(raw_object)
22
+ end
23
+
12
24
  # Generates a URL for the Contentful Image API
13
25
  #
14
26
  # @param [Hash] options
@@ -16,6 +28,9 @@ module Contentful
16
28
  # @option options [Integer] :height
17
29
  # @option options [String] :format
18
30
  # @option options [String] :quality
31
+ # @option options [String] :focus
32
+ # @option options [String] :fit
33
+ # @option options [String] :fl File Layering - 'progressive'
19
34
  # @see _ https://www.contentful.com/developers/documentation/content-delivery-api/#image-asset-resizing
20
35
  #
21
36
  # @return [String] Image API URL
@@ -26,7 +41,8 @@ module Contentful
26
41
  fm: options[:fm] || options[:format],
27
42
  q: options[:q] || options[:quality],
28
43
  f: options[:f] || options[:focus],
29
- fit: options[:fit]
44
+ fit: options[:fit],
45
+ fl: options[:fl]
30
46
  }.reject { |_k, v| v.nil? }
31
47
 
32
48
  if query.empty?
@@ -63,7 +63,7 @@ module Contentful
63
63
 
64
64
  def service_unavailable_error
65
65
  @status = :error
66
- @error_message = 'Service unavailable, contentful.com API seems to be down (503)'
66
+ @error_message = '503 - Service Unavailable'
67
67
  @object = Error[@raw.status].new(self)
68
68
  end
69
69
 
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '0.9.0'
4
+ VERSION = '0.10.0'
5
5
  end
@@ -54,9 +54,17 @@ describe Contentful::Asset do
54
54
  end
55
55
 
56
56
  it 'adds image options if given' do
57
- url = asset.image_url(width: 100, format: 'jpg', quality: 50, focus: 'top_right', fit: 'thumb')
57
+ url = asset.image_url(width: 100, format: 'jpg', quality: 50, focus: 'top_right', fit: 'thumb', fl: 'progressive')
58
58
  expect(url).to include asset.file.url
59
- expect(url).to include '?w=100&fm=jpg&q=50&f=top_right&fit=thumb'
59
+ expect(url).to include '?w=100&fm=jpg&q=50&f=top_right&fit=thumb&fl=progressive'
60
60
  end
61
61
  end
62
+
63
+ it 'can be marshalled' do
64
+ marshalled = Marshal.dump(asset)
65
+ unmarshalled = Marshal.load(marshalled)
66
+
67
+ expect(unmarshalled.title).to eq 'Nyan Cat'
68
+ expect(unmarshalled.file).to be_a Contentful::File
69
+ end
62
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-03 00:00:00.000000000 Z
12
+ date: 2016-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http