contentful 2.13.3 → 2.14.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
  SHA256:
3
- metadata.gz: 769988762e5d05e6732adafc3a34e25ddb05bb400f8095ac22e58214ffb1d87b
4
- data.tar.gz: 2a0d52533d6d0fb85b3565aef3eaf17300cce71aab610fb822e2bb6bd3a167d1
3
+ metadata.gz: a1930a37ca31d693b4cb4ff55f065b85cc3271696ae3dd96b063093a2f9c24be
4
+ data.tar.gz: 5299cd8d71d9200873fcbc527d41bedd717ed216a323b0a537d9148d1b0a664d
5
5
  SHA512:
6
- metadata.gz: 9b9c166d8697fe28733f0224f2af8e0fa7d00471a2c8ce385aa8d762427d5405a91ced44173f5bacf3226bf4eb6f94d68be99c11172bb6f7f3cfd52ab330cb60
7
- data.tar.gz: b7d577d79b2c7ee318a88aa63592fa1b0e15670b3fe159108a4919e501bd15c8e54ad9753463c560934288f4ee448bbf688be11c4ae5761f87b0b9cbd20d62d0
6
+ metadata.gz: 1b3f75e991ce3eecde93a3109acafb20f400e349df4f369463d2adfea36c863772cdc84d1353b7e24018342fbc4eb0cbf6ee9d884b445877817f4821ef26b3ef
7
+ data.tar.gz: 2bf465ba3e6a9e8129fe7648212d75454332866a478f2aebfb2effb8679a56338cf2890bcd0718a4815f20ca42292f496427aedda571f9b7ab4b5ac5470c0523
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.0
3
+ - 2.6.1
4
+ - 2.5.1
5
+ - 2.4.1
4
6
  - 2.3.1
5
- - 2.2.1
6
7
  notifications:
7
8
  slack:
8
9
  secure: Zr3mKCiTb0vaTD4MPtTG8BbyYyErFuoxioM25QyrqePKVkDFeZC1MtGmg5klQQrJiWTKZPa/zB8NAHYkoUxg9I+z15JK0hYfz9KRubEpCrXCaqTC9Vzq88kJ3LN8YsTyBF66izaBH2KLsOfaJRxwplFzZqgpg4GG2DUBPtrGtes=
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.14.0
6
+ ### Added
7
+ * Allow user defined methods to override properties created by the SDK, if you want to access overriden fields or sys properties use `#fields[]` or `#sys[]` as accessors. [#210](https://github.com/contentful/contentful.rb/pull/210)
8
+
5
9
  ## 2.13.3
6
10
  ### Fixed
7
11
  * Fixed unfiltered unresolvable entries and assets from re-marshalled entries. [#207](https://github.com/contentful/contentful.rb/pull/207)
@@ -59,9 +59,7 @@ module Contentful
59
59
 
60
60
  def define_sys_methods!
61
61
  @sys.each do |k, v|
62
- define_singleton_method k do
63
- v
64
- end
62
+ define_singleton_method(k) { v } unless self.class.method_defined?(k)
65
63
  end
66
64
  end
67
65
 
@@ -83,9 +83,7 @@ module Contentful
83
83
 
84
84
  def define_fields_methods!
85
85
  fields.each do |k, v|
86
- define_singleton_method k do
87
- v
88
- end
86
+ define_singleton_method(k) { v } unless self.class.method_defined?(k)
89
87
  end
90
88
  end
91
89
 
@@ -29,6 +29,7 @@ module Contentful
29
29
  # Default Entry Mapping
30
30
  # @see _ README for more information on Entry Mapping
31
31
  DEFAULT_ENTRY_MAPPING = {}.freeze
32
+ # Buildable Resources
32
33
  BUILDABLES = %w[Entry Asset ContentType Space DeletedEntry DeletedAsset Locale].freeze
33
34
 
34
35
  attr_reader :json, :default_locale, :endpoint, :depth, :localized, :resource_mapping, :entry_mapping, :resource
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.13.3'
4
+ VERSION = '2.14.0'
5
5
  end
@@ -3,6 +3,19 @@ require 'spec_helper'
3
3
  describe Contentful::Entry do
4
4
  let(:entry) { vcr('entry') { create_client.entry 'nyancat' } }
5
5
 
6
+ let(:subclass) do
7
+ Class.new(described_class) do
8
+ # An overridden sys method:
9
+ def created_at; 'yesterday'; end
10
+
11
+ # An overridden field method:
12
+ def best_friend; 'octocat'; end
13
+ end
14
+ end
15
+
16
+ let(:raw) { entry.raw }
17
+ let(:subclassed_entry) { subclass.new(raw, create_client.configuration) }
18
+
6
19
  describe 'SystemProperties' do
7
20
  it 'has a #sys getter returning a hash with symbol keys' do
8
21
  expect(entry.sys).to be_a Hash
@@ -36,6 +49,12 @@ describe Contentful::Entry do
36
49
  it 'has #revision' do
37
50
  expect(entry.revision).to eq 5
38
51
  end
52
+
53
+ context 'when subclassed' do
54
+ it 'does not redefine existing methods' do
55
+ expect(subclassed_entry.created_at).to eq 'yesterday'
56
+ end
57
+ end
39
58
  end
40
59
 
41
60
  describe 'Fields' do
@@ -48,6 +67,12 @@ describe Contentful::Entry do
48
67
  expect(entry.fields[:color]).to eq 'rainbow'
49
68
  expect(entry.fields[:best_friend]).to be_a Contentful::Entry
50
69
  end
70
+
71
+ context 'when subclassed' do
72
+ it 'does not redefine existing methods' do
73
+ expect(subclassed_entry.best_friend).to eq 'octocat'
74
+ end
75
+ end
51
76
  end
52
77
 
53
78
  describe 'multiple locales' do
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: 2.13.3
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-09-13 00:00:00.000000000 Z
13
+ date: 2019-10-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http