jsonapi-resources 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +274 -102
  3. data/jsonapi-resources.gemspec +1 -0
  4. data/lib/jsonapi-resources.rb +15 -0
  5. data/lib/jsonapi/active_record_operations_processor.rb +21 -10
  6. data/lib/jsonapi/acts_as_resource_controller.rb +175 -0
  7. data/lib/jsonapi/configuration.rb +11 -0
  8. data/lib/jsonapi/error_codes.rb +7 -4
  9. data/lib/jsonapi/exceptions.rb +23 -15
  10. data/lib/jsonapi/formatter.rb +5 -5
  11. data/lib/jsonapi/include_directives.rb +67 -0
  12. data/lib/jsonapi/operation.rb +185 -65
  13. data/lib/jsonapi/operation_result.rb +38 -5
  14. data/lib/jsonapi/operation_results.rb +33 -0
  15. data/lib/jsonapi/operations_processor.rb +49 -9
  16. data/lib/jsonapi/paginator.rb +31 -17
  17. data/lib/jsonapi/request.rb +347 -163
  18. data/lib/jsonapi/resource.rb +159 -56
  19. data/lib/jsonapi/resource_controller.rb +1 -234
  20. data/lib/jsonapi/resource_serializer.rb +55 -69
  21. data/lib/jsonapi/resources/version.rb +1 -1
  22. data/lib/jsonapi/response_document.rb +87 -0
  23. data/lib/jsonapi/routing_ext.rb +17 -11
  24. data/test/controllers/controller_test.rb +602 -326
  25. data/test/fixtures/active_record.rb +96 -6
  26. data/test/fixtures/line_items.yml +7 -1
  27. data/test/fixtures/numeros_telefone.yml +3 -0
  28. data/test/fixtures/purchase_orders.yml +6 -0
  29. data/test/integration/requests/request_test.rb +129 -60
  30. data/test/integration/routes/routes_test.rb +17 -17
  31. data/test/test_helper.rb +23 -5
  32. data/test/unit/jsonapi_request/jsonapi_request_test.rb +48 -0
  33. data/test/unit/operation/operations_processor_test.rb +242 -54
  34. data/test/unit/resource/resource_test.rb +108 -2
  35. data/test/unit/serializer/include_directives_test.rb +108 -0
  36. data/test/unit/serializer/response_document_test.rb +61 -0
  37. data/test/unit/serializer/serializer_test.rb +679 -520
  38. metadata +26 -2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-26 00:00:00.000000000 Z
12
+ date: 2015-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: pry
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: rails
100
114
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +141,7 @@ files:
127
141
  - jsonapi-resources.gemspec
128
142
  - lib/jsonapi-resources.rb
129
143
  - lib/jsonapi/active_record_operations_processor.rb
144
+ - lib/jsonapi/acts_as_resource_controller.rb
130
145
  - lib/jsonapi/association.rb
131
146
  - lib/jsonapi/callbacks.rb
132
147
  - lib/jsonapi/configuration.rb
@@ -134,9 +149,11 @@ files:
134
149
  - lib/jsonapi/error_codes.rb
135
150
  - lib/jsonapi/exceptions.rb
136
151
  - lib/jsonapi/formatter.rb
152
+ - lib/jsonapi/include_directives.rb
137
153
  - lib/jsonapi/mime_types.rb
138
154
  - lib/jsonapi/operation.rb
139
155
  - lib/jsonapi/operation_result.rb
156
+ - lib/jsonapi/operation_results.rb
140
157
  - lib/jsonapi/operations_processor.rb
141
158
  - lib/jsonapi/paginator.rb
142
159
  - lib/jsonapi/request.rb
@@ -144,6 +161,7 @@ files:
144
161
  - lib/jsonapi/resource_controller.rb
145
162
  - lib/jsonapi/resource_serializer.rb
146
163
  - lib/jsonapi/resources/version.rb
164
+ - lib/jsonapi/response_document.rb
147
165
  - lib/jsonapi/routing_ext.rb
148
166
  - test/config/database.yml
149
167
  - test/controllers/controller_test.rb
@@ -158,6 +176,7 @@ files:
158
176
  - test/fixtures/hair_cuts.yml
159
177
  - test/fixtures/iso_currencies.yml
160
178
  - test/fixtures/line_items.yml
179
+ - test/fixtures/numeros_telefone.yml
161
180
  - test/fixtures/order_flags.yml
162
181
  - test/fixtures/people.yml
163
182
  - test/fixtures/posts.yml
@@ -176,6 +195,8 @@ files:
176
195
  - test/unit/jsonapi_request/jsonapi_request_test.rb
177
196
  - test/unit/operation/operations_processor_test.rb
178
197
  - test/unit/resource/resource_test.rb
198
+ - test/unit/serializer/include_directives_test.rb
199
+ - test/unit/serializer/response_document_test.rb
179
200
  - test/unit/serializer/serializer_test.rb
180
201
  homepage: https://github.com/cerebris/jsonapi-resources
181
202
  licenses:
@@ -215,6 +236,7 @@ test_files:
215
236
  - test/fixtures/hair_cuts.yml
216
237
  - test/fixtures/iso_currencies.yml
217
238
  - test/fixtures/line_items.yml
239
+ - test/fixtures/numeros_telefone.yml
218
240
  - test/fixtures/order_flags.yml
219
241
  - test/fixtures/people.yml
220
242
  - test/fixtures/posts.yml
@@ -233,4 +255,6 @@ test_files:
233
255
  - test/unit/jsonapi_request/jsonapi_request_test.rb
234
256
  - test/unit/operation/operations_processor_test.rb
235
257
  - test/unit/resource/resource_test.rb
258
+ - test/unit/serializer/include_directives_test.rb
259
+ - test/unit/serializer/response_document_test.rb
236
260
  - test/unit/serializer/serializer_test.rb