jsonapi-materializer 1.0.0.rc6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require("spec_helper")
2
4
 
3
5
  RSpec.describe(JSONAPI::Materializer::Resource) do
4
- let(:resource) {ArticleMaterializer.new(:object => Article.find(1))}
6
+ let(:resource) { ArticleMaterializer.new(object: Article.find(1)) }
5
7
 
6
8
  before do
7
- Account.create!(:id => 9, :name => "Dan Gebhardt", :twitter => "dgeb")
8
- Account.create!(:id => 2, :name => "DHH", :twitter => "DHH")
9
- Article.create!(:id => 1, :title => "JSON API paints my bikeshed!", :account => Account.find(9))
10
- Comment.create!(:id => 5, :body => "First!", :article => Article.find(1), :account => Account.find(2))
11
- Comment.create!(:id => 12, :body => "I like XML better", :article => Article.find(1), :account => Account.find(9))
9
+ Account.create!(id: 9, name: "Dan Gebhardt", twitter: "dgeb")
10
+ Account.create!(id: 2, name: "DHH", twitter: "DHH")
11
+ Article.create!(id: 1, title: "JSON API paints my bikeshed!", account: Account.find(9))
12
+ Comment.create!(id: 5, body: "First!", article: Article.find(1), account: Account.find(2))
13
+ Comment.create!(id: 12, body: "I like XML better", article: Article.find(1), account: Account.find(9))
12
14
  end
13
15
 
14
16
  describe("#to_json") do
15
- subject {resource.as_json.deep_stringify_keys}
17
+ subject { resource.as_json.deep_stringify_keys }
16
18
 
17
19
  it("returns a JSON:API standards compliant payload") do
18
20
  expect(subject).to(
@@ -55,7 +57,7 @@ RSpec.describe(JSONAPI::Materializer::Resource) do
55
57
  }
56
58
  },
57
59
  "links" => {
58
- "self" => "http://example.com/articles/1"
60
+ "self" => "http://example.com/articles/1"
59
61
  }
60
62
  }
61
63
  )
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module JSONAPI
2
4
  module Materializer
3
- VERSION = "1.0.0.rc6".freeze
5
+ VERSION = "1.0.0"
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require("ostruct")
2
4
  require("addressable")
3
5
  require("active_model")
@@ -8,7 +10,7 @@ require("active_support/core_ext/string")
8
10
  require("active_support/core_ext/module")
9
11
 
10
12
  module JSONAPI
11
- MEDIA_TYPE = "application/vnd.api+json".freeze unless const_defined?("MEDIA_TYPE")
13
+ MEDIA_TYPE = "application/vnd.api+json" unless const_defined?(:MEDIA_TYPE)
12
14
 
13
15
  module Materializer
14
16
  require_relative("materializer/version")
@@ -17,9 +19,9 @@ module JSONAPI
17
19
  require_relative("materializer/controller")
18
20
 
19
21
  @configuration ||= Configuration.new(
20
- :default_invalid_accept_exception => JSONAPI::Materializer::Error::InvalidAcceptHeader,
21
- :default_missing_accept_exception => JSONAPI::Materializer::Error::MissingAcceptHeader,
22
- :default_identifier => :id
22
+ default_invalid_accept_exception: JSONAPI::Materializer::Error::InvalidAcceptHeader,
23
+ default_missing_accept_exception: JSONAPI::Materializer::Error::MissingAcceptHeader,
24
+ default_identifier: :id
23
25
  )
24
26
  require_relative("materializer/collection")
25
27
  require_relative("materializer/resource")
@@ -1,4 +1,3 @@
1
- require("spec_helper")
1
+ # frozen_string_literal: true
2
2
 
3
- RSpec.describe(JSONAPI::Materializer) do
4
- end
3
+ require("spec_helper")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module JSONAPI
2
4
  require_relative("jsonapi/materializer")
3
5
  end
metadata CHANGED
@@ -1,157 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-materializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-16 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activemodel
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 4.0.0
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: '4.2'
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: 5.0.0
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- version: '5.1'
29
- type: :development
30
- prerelease: false
31
- version_requirements: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 4.0.0
36
- - - ">="
37
- - !ruby/object:Gem::Version
38
- version: '4.2'
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: 5.0.0
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: '5.1'
45
- - !ruby/object:Gem::Dependency
46
- name: activerecord
47
- requirement: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- version: 4.0.0
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '4.2'
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 5.0.0
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '5.1'
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: 4.0.0
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: '4.2'
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 5.0.0
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '5.1'
77
- - !ruby/object:Gem::Dependency
78
- name: bundler
79
- requirement: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '1.16'
84
- type: :development
85
- prerelease: false
86
- version_requirements: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '1.16'
91
- - !ruby/object:Gem::Dependency
92
- name: pry
93
- requirement: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '0.11'
98
- type: :development
99
- prerelease: false
100
- version_requirements: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '0.11'
105
- - !ruby/object:Gem::Dependency
106
- name: pry-doc
107
- requirement: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '0.11'
112
- type: :development
113
- prerelease: false
114
- version_requirements: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '0.11'
119
- - !ruby/object:Gem::Dependency
120
- name: rake
121
- requirement: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '12.2'
126
- type: :development
127
- prerelease: false
128
- version_requirements: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '12.2'
133
- - !ruby/object:Gem::Dependency
134
- name: rspec
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '3.7'
140
- type: :development
141
- prerelease: false
142
- version_requirements: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - "~>"
145
- - !ruby/object:Gem::Version
146
- version: '3.7'
147
- - !ruby/object:Gem::Dependency
148
- name: rubocop
14
+ name: activesupport
149
15
  requirement: !ruby/object:Gem::Requirement
150
16
  requirements:
151
17
  - - ">="
152
18
  - !ruby/object:Gem::Version
153
19
  version: '0'
154
- type: :development
20
+ type: :runtime
155
21
  prerelease: false
156
22
  version_requirements: !ruby/object:Gem::Requirement
157
23
  requirements:
@@ -159,79 +25,33 @@ dependencies:
159
25
  - !ruby/object:Gem::Version
160
26
  version: '0'
161
27
  - !ruby/object:Gem::Dependency
162
- name: sqlite3
163
- requirement: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - "~>"
166
- - !ruby/object:Gem::Version
167
- version: '1.3'
168
- type: :development
169
- prerelease: false
170
- version_requirements: !ruby/object:Gem::Requirement
171
- requirements:
172
- - - "~>"
173
- - !ruby/object:Gem::Version
174
- version: '1.3'
175
- - !ruby/object:Gem::Dependency
176
- name: activesupport
28
+ name: addressable
177
29
  requirement: !ruby/object:Gem::Requirement
178
30
  requirements:
179
31
  - - ">="
180
32
  - !ruby/object:Gem::Version
181
- version: 4.0.0
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- version: '4.2'
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: 5.0.0
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- version: '5.1'
33
+ version: '0'
191
34
  type: :runtime
192
35
  prerelease: false
193
36
  version_requirements: !ruby/object:Gem::Requirement
194
37
  requirements:
195
38
  - - ">="
196
39
  - !ruby/object:Gem::Version
197
- version: 4.0.0
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: '4.2'
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: 5.0.0
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: '5.1'
207
- - !ruby/object:Gem::Dependency
208
- name: addressable
209
- requirement: !ruby/object:Gem::Requirement
210
- requirements:
211
- - - "~>"
212
- - !ruby/object:Gem::Version
213
- version: '2.5'
214
- type: :runtime
215
- prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- requirements:
218
- - - "~>"
219
- - !ruby/object:Gem::Version
220
- version: '2.5'
40
+ version: '0'
221
41
  - !ruby/object:Gem::Dependency
222
42
  name: kaminari
223
43
  requirement: !ruby/object:Gem::Requirement
224
44
  requirements:
225
- - - "~>"
45
+ - - ">="
226
46
  - !ruby/object:Gem::Version
227
- version: '1.1'
47
+ version: '0'
228
48
  type: :runtime
229
49
  prerelease: false
230
50
  version_requirements: !ruby/object:Gem::Requirement
231
51
  requirements:
232
- - - "~>"
52
+ - - ">="
233
53
  - !ruby/object:Gem::Version
234
- version: '1.1'
54
+ version: '0'
235
55
  description: A way to turn data models into outbound json:api responses
236
56
  email:
237
57
  - kurtis@rainbolt-greene.online
@@ -239,6 +59,7 @@ executables: []
239
59
  extensions: []
240
60
  extra_rdoc_files: []
241
61
  files:
62
+ - LICENSE
242
63
  - README.md
243
64
  - Rakefile
244
65
  - lib/jsonapi-materializer.rb
@@ -259,30 +80,29 @@ files:
259
80
  - lib/jsonapi/materializer/resource/relationship.rb
260
81
  - lib/jsonapi/materializer/resource_spec.rb
261
82
  - lib/jsonapi/materializer/version.rb
262
- - lib/jsonapi/materializer/version_spec.rb
263
83
  - lib/jsonapi/materializer_spec.rb
264
- homepage: http://krainboltgreene.github.io/jsonapi-materializer
84
+ homepage: http://krainboltgreene.github.io/jsonapi-materializer.rb
265
85
  licenses:
266
- - ISC
267
- metadata: {}
268
- post_install_message:
86
+ - HL3
87
+ metadata:
88
+ rubygems_mfa_required: 'true'
89
+ post_install_message:
269
90
  rdoc_options: []
270
91
  require_paths:
271
92
  - lib
272
93
  required_ruby_version: !ruby/object:Gem::Requirement
273
94
  requirements:
274
- - - ">="
95
+ - - "~>"
275
96
  - !ruby/object:Gem::Version
276
- version: '0'
97
+ version: '3.2'
277
98
  required_rubygems_version: !ruby/object:Gem::Requirement
278
99
  requirements:
279
- - - ">"
100
+ - - ">="
280
101
  - !ruby/object:Gem::Version
281
- version: 1.3.1
102
+ version: '0'
282
103
  requirements: []
283
- rubyforge_project:
284
- rubygems_version: 2.7.7
285
- signing_key:
104
+ rubygems_version: 3.4.10
105
+ signing_key:
286
106
  specification_version: 4
287
107
  summary: A way to turn data models into outbound json:api responses
288
108
  test_files: []
@@ -1,7 +0,0 @@
1
- require("spec_helper")
2
-
3
- RSpec.describe(JSONAPI::Materializer::VERSION) do
4
- it("should be a string") do
5
- expect(JSONAPI::Materializer::VERSION).to(be_kind_of(String))
6
- end
7
- end