buttercms-ruby 1.0.0 → 1.0.1

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: f72c57972718778708f150fa6a31a9576c1c299a
4
- data.tar.gz: 74afaa24b20838aee3b6fe474e68a63dbcd9b771
3
+ metadata.gz: 98a401f6d29a1881182829f46acb4fcf1893b092
4
+ data.tar.gz: e97c155be97d717e429edd21702075127257749d
5
5
  SHA512:
6
- metadata.gz: c651afb1629f09e01435d04b48be8d67c1eeb02c5da3d06c63bcb827d0763434b110f98b9abdc73c60445bfed7f5366177d7f17692bd235913d650766bbca411
7
- data.tar.gz: ef78a1f79753a75fd5e0500c045d9da04861c98057040cacb1f5ea4988bc9a2597e80d8b0ec71d2abf1822116026053e8216ffd0f34e5dceb0001257e0bf948b
6
+ metadata.gz: 2d9790b7c65894ea62af94ad7c67d1bab90b33ed7729ade165e755aa834ea8dbe38bb8f1e7a0b9332c17fd5e02d210e1dbfac77c892b571072c2b8d6f3951d48
7
+ data.tar.gz: 8c5114b79dbcdfd093bbc9fa2a254bbffec2f2885ec14db7c04a669620e721923c26b3b3c7b69ee362e1aca45b640f8c4d9986dec56e42ccd91f3712fdedcef0
data/README.md CHANGED
@@ -7,7 +7,7 @@ To setup your project, follow these steps:
7
7
  1. Install using `gem install buttercms-ruby` or by adding to your `Gemfile`:
8
8
 
9
9
  ```ruby
10
- gem 'buttercms-ruby', '~>1.0.0'
10
+ gem 'buttercms-ruby', '~>1.0.1'
11
11
  ```
12
12
 
13
13
  2. Set your API token.
@@ -31,7 +31,7 @@ puts post.title
31
31
  author = ButterCMS::Author.find("author-slug")
32
32
  puts author.first_name
33
33
 
34
- category = ButterCMS::Category.find("author-slug")
34
+ category = ButterCMS::Category.find("category-slug")
35
35
  puts category.name
36
36
 
37
37
  rss_feed = ButterCMS::Feed.find(:rss)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -3,16 +3,15 @@ module ButterCMS
3
3
  attr_reader :meta, :data
4
4
 
5
5
  def initialize(json)
6
- data = json["data"]
7
- meta = json["meta"]
8
-
9
6
  @json = json
10
- @data = HashToObject.convert(data)
11
- @meta = HashToObject.convert(meta) if meta
12
-
13
- data.each do |key, value|
14
- instance_variable_set("@#{key}", @data.send(key))
15
- self.class.send(:attr_reader, key)
7
+ @data = HashToObject.convert(json["data"])
8
+ @meta = HashToObject.convert(json["meta"]) if json["meta"]
9
+
10
+ if json["data"].is_a?(Hash)
11
+ json["data"].each do |key, value|
12
+ instance_variable_set("@#{key}", @data.send(key))
13
+ self.class.send(:attr_reader, key)
14
+ end
16
15
  end
17
16
  end
18
17
 
@@ -1,7 +1,7 @@
1
1
  module ButterCMS
2
2
  class HashToObject
3
3
  def self.convert(hash)
4
- JSON.parse(hash.to_json, object_class: OpenStruct)
4
+ JSON.parse(hash.to_json, object_class: OpenStruct, quirks_mode: true)
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module ButterCMS
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buttercms-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ButterCMS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client