json_api_ruby 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db1df895288feca5b137412ef221f3412c505d22
4
- data.tar.gz: b03003fbd272458938040658c346f46ffe46cef8
3
+ metadata.gz: c7e42c5c231fd682a8e270459c73e8945aaa1ef5
4
+ data.tar.gz: ae1cc8febb51dc733594f18eee03a7ecdc54a5a1
5
5
  SHA512:
6
- metadata.gz: 2fbb35ae835ca899ccdf4e5da426b9678d359b8fae67b1f33ae80636c232adb2496f4abe41001e79aeb3a26cf3d587cba4a6ffd457ce3a90df4b2e0d1262fb33
7
- data.tar.gz: 43d0066a894fa951042e3eb0af367ac38b19c1ab7e24f10d889fe12fe1bb3bb09ef43c208712f68943e1514db7919c0e4281109e0ae5d71703136745b4945079
6
+ metadata.gz: 793922aace62753425c04700a53ff96f7fdea8109b968b848d9c80bf914808d482ff3c7c527d25a30a5653fa6dff8f95f58d154b039c92bfe34eae5905f919c8
7
+ data.tar.gz: 8ea19426b9800ba42ae558dc4624f2e7954d259d2830ed403d7b073f8fbd6b623d1d26bf9513447d5f15d79a0969b16b148f9da23eefcb1e637b1b7a9fb02595
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ 0.2.2
2
+ Fix issues with `id_field` returning a string and not supporting method overriding
3
+
1
4
  0.2.1
2
5
  Fix issues with `_id_field` on subclasses of class whose superclass is Resource
3
6
 
data/Gemfile.lock CHANGED
@@ -1,18 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_api (0.0.1.beta)
5
- activesupport
4
+ json_api_ruby (0.2.1)
5
+ activesupport (~> 3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (4.2.5)
11
- i18n (~> 0.7)
12
- json (~> 1.7, >= 1.7.7)
13
- minitest (~> 5.1)
14
- thread_safe (~> 0.3, >= 0.3.4)
15
- tzinfo (~> 1.1)
10
+ activesupport (3.2.22.1)
11
+ i18n (~> 0.6, >= 0.6.4)
12
+ multi_json (~> 1.0)
16
13
  byebug (8.2.1)
17
14
  coderay (1.1.0)
18
15
  diff-lcs (1.2.5)
@@ -33,13 +30,12 @@ GEM
33
30
  guard-compat (~> 1.1)
34
31
  rspec (>= 2.99.0, < 4.0)
35
32
  i18n (0.7.0)
36
- json (1.8.3)
37
33
  listen (3.0.5)
38
34
  rb-fsevent (>= 0.9.3)
39
35
  rb-inotify (>= 0.9)
40
36
  lumberjack (1.0.10)
41
37
  method_source (0.8.2)
42
- minitest (5.8.3)
38
+ multi_json (1.11.2)
43
39
  nenv (0.2.0)
44
40
  notiffany (0.0.8)
45
41
  nenv (~> 0.1)
@@ -73,20 +69,17 @@ GEM
73
69
  shellany (0.0.1)
74
70
  slop (3.6.0)
75
71
  thor (0.19.1)
76
- thread_safe (0.3.5)
77
- tzinfo (1.2.2)
78
- thread_safe (~> 0.1)
79
72
 
80
73
  PLATFORMS
81
74
  ruby
82
75
 
83
76
  DEPENDENCIES
84
77
  bundler (~> 1.3)
85
- guard-rspec
86
- json_api!
87
- pry-byebug
78
+ guard-rspec (~> 4)
79
+ json_api_ruby!
80
+ pry-byebug (~> 3)
88
81
  rspec (~> 3)
89
- rspec-its
82
+ rspec-its (~> 1)
90
83
 
91
84
  BUNDLED WITH
92
- 1.10.6
85
+ 1.11.2
@@ -8,7 +8,7 @@ module JsonApi
8
8
  extend Resources::DSL
9
9
 
10
10
  def self.inherited(subclass)
11
- subclass.send(:id_field, :id)
11
+ subclass.id_field(@_id_field || :id)
12
12
  end
13
13
 
14
14
  # Can be set using `id_field` in the created resource class like so:
@@ -25,7 +25,7 @@ module JsonApi
25
25
  end
26
26
 
27
27
  def identifier_hash
28
- { 'id' => _model.send(id_field), 'type' => self.type }
28
+ { 'id' => self.id, 'type' => self.type }
29
29
  end
30
30
 
31
31
  def links_hash
@@ -78,17 +78,6 @@ module JsonApi
78
78
 
79
79
  private
80
80
 
81
- # Traverses superclasses for the first `_id_field` not set to `:id` and
82
- # return its value. Stops when the superclass is Resource.
83
- def id_field(klass = self.class)
84
- return klass._id_field unless klass._id_field == :id
85
- if klass.superclass == Resource
86
- klass._id_field
87
- else
88
- id_field(klass.superclass)
89
- end
90
- end
91
-
92
81
  # Adds elements of the `concat_list` to the `target_list` if they are
93
82
  # not already present.
94
83
  def concat_list(target_list, concat_list)
@@ -1,3 +1,3 @@
1
1
  module JsonApi
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -144,7 +144,7 @@ RSpec.describe JsonApi::Resource do
144
144
  end
145
145
 
146
146
  it 'returns the same relationships as its super-classes' do
147
- expect(deep_subclass_serialization['relationships']).to eq(super_class_serialization['relationships'])
147
+ expect(deep_subclass_serialization['relationships'].keys).to eq(super_class_serialization['relationships'].keys)
148
148
  end
149
149
 
150
150
  context 'with overridden attributes' do
@@ -41,7 +41,7 @@ RSpec::Matchers.define :be_valid_json_api do
41
41
  actual = Hash(actual).stringify_keys
42
42
  has_id_and_type = actual['id'].present? && actual['type'].present?
43
43
 
44
- is_a_hash && has_id_and_type
44
+ is_a_hash && has_id_and_type && actual['id'].is_a?(String)
45
45
  end
46
46
  end
47
47
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tracey Eubanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-10 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: activesupport
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.5.1
151
+ rubygems_version: 2.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Extremely lightweight implementation of JSON API
@@ -160,4 +160,3 @@ test_files:
160
160
  - spec/spec_helper.rb
161
161
  - spec/support/json_api_matchers.rb
162
162
  - spec/support/resource_objects.rb
163
- has_rdoc: