contentful-management 2.2.1 → 2.2.2

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: b75e50ebfc4202efbbd7d47c99781cafa716bc3287ebfb4ab52f6a8bf010254f
4
- data.tar.gz: 026f56b80f835f32709a190d73af227a1f2985aa763217266fc2a39065f16f1a
3
+ metadata.gz: 6cf0ce9eb8d18998ab777ab796c1fb0222cb8c8092fd55734e3c7c2031641d47
4
+ data.tar.gz: ff63153a45ca73048e2bd563a7641dc5dc7e31a4877e4873e418efeabf5e185c
5
5
  SHA512:
6
- metadata.gz: 02c0a808c2c80a6e41912f66154c408bdfd46e82d8df9495e116bed6f09395e88b9677a35d19034ee719c5afffc490b4ab22d72f8c8a329246b6f4f845287635
7
- data.tar.gz: 84ae44e1a8a0df806b1ae4e569249fdbc8e2844c45c00226db9cb246d110059c2ef7e0ce7c87347251a74834c73a038d090fc92b11a503dd2621f09a0cd55f33
6
+ metadata.gz: aa3b3a247c2ac6a168489665124f1875dfb48aed89799ae66f9074415b4cbbbf706c35cf5d4312f0507eb0afff739bfe5c92212c1123756a296bf185b152168c
7
+ data.tar.gz: 339fecccc7901697cdc4c89ed67110af4308777156544b800ac1bed1150a8b9615e48c30a788b3a6337f15d9e955ff8eca283eb12ab4f0270bcda9b87ed76e81
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 2.2.2
6
+ ### Fixed
7
+ * Fixed URL generation for `/organizations` endpoint.
8
+
9
+ ### Changed
10
+ **BREAKING CHANGES**:
11
+ * `nil` values on localized entries now no longer fallback to the default locale value when reading them. [#164](https://github.com/contentful/contentful-management.rb/issues/164)
12
+
5
13
  ## 2.2.1
6
14
  ### Fixed
7
15
  * Fixed side-effect that was causing entries created using `content_type.entries.new` to fail to save.
@@ -130,19 +130,6 @@ module Contentful
130
130
  self.locale = attributes[:locale] || client.default_locale
131
131
  end
132
132
 
133
- # Gets Hash of fields for the current locale
134
- #
135
- # @param [String] wanted_locale
136
- #
137
- # @return [Hash] localized fields
138
- def fields(wanted_locale = locale)
139
- requested_locale = wanted_locale || default_locale
140
- @fields[requested_locale] = {} unless @fields[requested_locale]
141
-
142
- default_fields = @fields[default_locale] || {}
143
- default_fields.merge(@fields[requested_locale])
144
- end
145
-
146
133
  # If an entry is a new object gets created in the Contentful, otherwise the existing entry gets updated.
147
134
  # @see _ README for details.
148
135
  #
@@ -13,7 +13,7 @@ module Contentful
13
13
 
14
14
  # @private
15
15
  def self.build_endpoint(_endpoint_options)
16
- '/organizations'
16
+ 'organizations'
17
17
  end
18
18
  end
19
19
  end
@@ -136,6 +136,10 @@ module Contentful
136
136
 
137
137
  private
138
138
 
139
+ def internal_resource_locale
140
+ sys.fetch(:locale, nil) || default_locale
141
+ end
142
+
139
143
  def extract_from_object(object, namespace, keys = nil)
140
144
  if object
141
145
  keys ||= object.keys
@@ -10,10 +10,9 @@ module Contentful
10
10
  # @param [String] wanted_locale
11
11
  #
12
12
  # @return [Hash] localized fields
13
- def fields(wanted_locale = default_locale)
14
- requested_locale = locale || wanted_locale
15
- @fields[requested_locale] = {} unless @fields[requested_locale]
16
- @fields[requested_locale]
13
+ def fields(wanted_locale = nil)
14
+ wanted_locale = internal_resource_locale if wanted_locale.nil?
15
+ @fields.fetch(wanted_locale.to_s, {})
17
16
  end
18
17
 
19
18
  # @private
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '2.2.1'.freeze
6
+ VERSION = '2.2.2'.freeze
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.contentful.com//organizations
5
+ uri: https://api.contentful.com/organizations
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -730,14 +730,14 @@ describe Contentful::Management::Entry do
730
730
  end
731
731
  end
732
732
 
733
- it 'retrieves value of default locale if it has not been localized' do
733
+ it 'does not retrieve value of default locale if it has not been localized' do
734
734
  vcr('entry/locales/fallback_to_default_locale') do
735
735
  space = client.spaces.find('0agypmo1waov')
736
736
  entry = client.entries(space.id, 'master').find('4epXENbO8wsaOukgqquYcI')
737
737
  entry.locale = 'de-DE'
738
738
 
739
- expect(entry.fields.count).to eq 2
740
- expect(entry.fields[:yolo]).to eq 'YOLO'
739
+ expect(entry.fields.count).to eq 0
740
+ expect(entry.fields).to eq({})
741
741
  end
742
742
  end
743
743
 
@@ -764,7 +764,7 @@ describe Contentful::Management::Entry do
764
764
  entry.yolo_with_locales = {'de-DE' => 'changed'}
765
765
  entry.locale = 'de-DE'
766
766
 
767
- expect(entry.fields).to match({:name => 'test2', :yolo => 'changed'})
767
+ expect(entry.fields).to match(:yolo => 'changed')
768
768
  end
769
769
  end
770
770
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-06-12 00:00:00.000000000 Z
13
+ date: 2018-08-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http