contentful 0.3.1 → 0.3.2
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.
- data/CHANGELOG.md +3 -0
- data/examples/custom_classes.rb +1 -1
- data/examples/resource_mapping.rb +2 -2
- data/lib/contentful/locale.rb +1 -0
- data/lib/contentful/version.rb +1 -1
- data/spec/locale_spec.rb +4 -0
- metadata +5 -6
- data/problem.rb +0 -39
data/CHANGELOG.md
CHANGED
data/examples/custom_classes.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Contentful::Resource module.
|
3
3
|
#
|
4
4
|
# You can then define properties of the class. This will create a getter method
|
5
|
-
# with this name You can optionally pass a type identifier (Symbol or Class).
|
5
|
+
# with this name. You can optionally pass a type identifier (Symbol or Class).
|
6
6
|
#
|
7
7
|
# Classes will be instantiated for the properties,
|
8
8
|
# Symbols will be looked up in Contentful::Resource::COERCIONS
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Using the :resource_mapping configuration, you can register your own classes to be used
|
2
2
|
# for the results from contentful.
|
3
3
|
#
|
4
|
-
# The key of the
|
4
|
+
# The key of the resource_mapping hash defines the resource type (object["sys"]["type"]) and the value is:
|
5
5
|
# - the Class to use
|
6
6
|
# - a Proc, that returns the Class to use
|
7
7
|
# - a Symbol for a method of the ResourceBuilder object
|
@@ -30,4 +30,4 @@ client = Contentful::Client.new(
|
|
30
30
|
|
31
31
|
assets = client.assets
|
32
32
|
p assets.class # => MyBetterArray
|
33
|
-
p assets.last # => #<Contentful::Asset ...
|
33
|
+
p assets.last # => #<Contentful::Asset ...
|
data/lib/contentful/locale.rb
CHANGED
data/lib/contentful/version.rb
CHANGED
data/spec/locale_spec.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http
|
@@ -211,7 +211,6 @@ files:
|
|
211
211
|
- lib/contentful/version.rb
|
212
212
|
- lib/contentful.rb
|
213
213
|
- LICENSE.txt
|
214
|
-
- problem.rb
|
215
214
|
- Rakefile
|
216
215
|
- README.md
|
217
216
|
- spec/array_spec.rb
|
@@ -289,7 +288,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
288
|
version: '0'
|
290
289
|
segments:
|
291
290
|
- 0
|
292
|
-
hash: -
|
291
|
+
hash: -3768775141988377798
|
293
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
293
|
none: false
|
295
294
|
requirements:
|
@@ -298,10 +297,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
297
|
version: '0'
|
299
298
|
segments:
|
300
299
|
- 0
|
301
|
-
hash: -
|
300
|
+
hash: -3768775141988377798
|
302
301
|
requirements: []
|
303
302
|
rubyforge_project:
|
304
|
-
rubygems_version: 1.8.23
|
303
|
+
rubygems_version: 1.8.23
|
305
304
|
signing_key:
|
306
305
|
specification_version: 3
|
307
306
|
summary: contentful
|
data/problem.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
module PlayboyContentful
|
3
|
-
class ContentType < Contentful::ContentType
|
4
|
-
|
5
|
-
def type_for_field_with_name(name)
|
6
|
-
fields.each do |field|
|
7
|
-
return field.type if field.id == name
|
8
|
-
end
|
9
|
-
return nil
|
10
|
-
end
|
11
|
-
|
12
|
-
# Depending on if the field supports full text search, the call needs may
|
13
|
-
# or may not need to append [eq] to the "fields.<field_name>" filter
|
14
|
-
def equality_string_for_field_with_name(name)
|
15
|
-
field_type = type_for_field_with_name(name)
|
16
|
-
raise "Could not build equality string for #{name} because field was not found." if field_type == nil
|
17
|
-
return "fields.#{name}" if field_type == "Symbol"
|
18
|
-
return "fields.#{name}[match]" if field_type == "Text"
|
19
|
-
"fields.#{name}[eq]"
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
CONTENTFUL_ACCESS_TOKEN="9b3b92d9929dc96744809e3b290bd1c6e6d9f10f7e4e7217ed50524fc0d9728d"
|
26
|
-
CONTENTFUL_SPACE="t8g5epyvf6nt"
|
27
|
-
|
28
|
-
client = Contentful::Client.new(
|
29
|
-
access_token: CONTENTFUL_ACCESS_TOKEN,
|
30
|
-
space: CONTENTFUL_SPACE,
|
31
|
-
dynamic_entries: :auto,
|
32
|
-
resource_mapping: {
|
33
|
-
'ContentType' => PlayboyContentful::ContentType
|
34
|
-
}
|
35
|
-
)
|
36
|
-
|
37
|
-
client.entry('2ks0eTNWoMw0026sUgsMWW')
|
38
|
-
|
39
|
-
client.entries({"content_type"=>"3VZz9HnPy02usuACK08WUw", :limit=>1000})
|