her 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +19 -1279
  3. data/.rubocop_todo.yml +232 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +16 -4
  6. data/README.md +25 -1
  7. data/gemfiles/Gemfile.faraday-1.0 +6 -0
  8. data/her.gemspec +4 -3
  9. data/lib/her/api.rb +8 -7
  10. data/lib/her/collection.rb +2 -1
  11. data/lib/her/errors.rb +3 -1
  12. data/lib/her/json_api/model.rb +8 -12
  13. data/lib/her/middleware.rb +1 -1
  14. data/lib/her/middleware/accept_json.rb +1 -0
  15. data/lib/her/middleware/first_level_parse_json.rb +6 -5
  16. data/lib/her/middleware/json_api_parser.rb +6 -5
  17. data/lib/her/middleware/parse_json.rb +2 -1
  18. data/lib/her/middleware/second_level_parse_json.rb +6 -5
  19. data/lib/her/model/associations.rb +7 -7
  20. data/lib/her/model/associations/association.rb +7 -9
  21. data/lib/her/model/associations/association_proxy.rb +2 -3
  22. data/lib/her/model/associations/belongs_to_association.rb +2 -3
  23. data/lib/her/model/attributes.rb +14 -6
  24. data/lib/her/model/base.rb +2 -2
  25. data/lib/her/model/http.rb +7 -2
  26. data/lib/her/model/introspection.rb +5 -3
  27. data/lib/her/model/nested_attributes.rb +1 -1
  28. data/lib/her/model/orm.rb +27 -9
  29. data/lib/her/model/parse.rb +10 -12
  30. data/lib/her/model/paths.rb +3 -4
  31. data/lib/her/model/relation.rb +5 -4
  32. data/lib/her/version.rb +1 -1
  33. data/spec/api_spec.rb +3 -0
  34. data/spec/middleware/accept_json_spec.rb +1 -0
  35. data/spec/middleware/first_level_parse_json_spec.rb +2 -1
  36. data/spec/middleware/json_api_parser_spec.rb +1 -0
  37. data/spec/middleware/second_level_parse_json_spec.rb +1 -0
  38. data/spec/model/associations/association_proxy_spec.rb +1 -0
  39. data/spec/model/associations_spec.rb +98 -14
  40. data/spec/model/attributes_spec.rb +9 -3
  41. data/spec/model/callbacks_spec.rb +14 -15
  42. data/spec/model/dirty_spec.rb +1 -0
  43. data/spec/model/http_spec.rb +29 -18
  44. data/spec/model/introspection_spec.rb +3 -2
  45. data/spec/model/nested_attributes_spec.rb +1 -0
  46. data/spec/model/orm_spec.rb +39 -16
  47. data/spec/model/parse_spec.rb +24 -0
  48. data/spec/model/paths_spec.rb +1 -0
  49. data/spec/model/relation_spec.rb +3 -2
  50. data/spec/model/validations_spec.rb +1 -0
  51. data/spec/model_spec.rb +1 -0
  52. data/spec/support/extensions/array.rb +1 -0
  53. data/spec/support/extensions/hash.rb +1 -0
  54. metadata +15 -19
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
4
 
4
5
  describe Her::Model::Paths do
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
4
 
4
5
  describe Her::Model::Relation do
@@ -194,7 +195,7 @@ describe Her::Model::Relation do
194
195
  builder.use Her::Middleware::FirstLevelParseJSON
195
196
  builder.use Faraday::Request::UrlEncoded
196
197
  builder.adapter :test do |stub|
197
- stub.post("/users") { |env| ok! id: 3, active: (params(env)[:active] == "true" ? true : false) }
198
+ stub.post("/users") { |env| ok! id: 3, active: (params(env)[:active] == "true") }
198
199
  end
199
200
  end
200
201
 
@@ -212,7 +213,7 @@ describe Her::Model::Relation do
212
213
  builder.use Her::Middleware::FirstLevelParseJSON
213
214
  builder.use Faraday::Request::UrlEncoded
214
215
  builder.adapter :test do |stub|
215
- stub.get("/users?active=true") { |env| ok! [{ id: 3, active: (params(env)[:active] == "true" ? true : false) }] }
216
+ stub.get("/users?active=true") { |env| ok! [{ id: 3, active: (params(env)[:active] == "true") }] }
216
217
  end
217
218
  end
218
219
 
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
4
 
4
5
  describe "Her::Model and ActiveModel::Validations" do
data/spec/model_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require "spec_helper"
3
4
 
4
5
  describe Her::Model do
@@ -1,4 +1,5 @@
1
1
  class Array
2
+
2
3
  def to_json
3
4
  MultiJson.dump(self)
4
5
  end
@@ -1,4 +1,5 @@
1
1
  class Hash
2
+
2
3
  def to_json
3
4
  MultiJson.dump(self)
4
5
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: her
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Prévost
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2021-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
19
+ version: '1.8'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '10.0'
26
+ version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.5'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.5'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: json
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.8'
47
+ version: '3.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.8'
54
+ version: '3.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -73,9 +73,6 @@ dependencies:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.8'
76
- - - "<"
77
- - !ruby/object:Gem::Version
78
- version: '1.0'
79
76
  type: :runtime
80
77
  prerelease: false
81
78
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,9 +80,6 @@ dependencies:
83
80
  - - ">="
84
81
  - !ruby/object:Gem::Version
85
82
  version: '0.8'
86
- - - "<"
87
- - !ruby/object:Gem::Version
88
- version: '1.0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: multi_json
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +104,8 @@ files:
110
104
  - ".gitignore"
111
105
  - ".rspec"
112
106
  - ".rubocop.yml"
107
+ - ".rubocop_todo.yml"
108
+ - ".ruby-version"
113
109
  - ".travis.yml"
114
110
  - ".yardopts"
115
111
  - CONTRIBUTING.md
@@ -122,6 +118,7 @@ files:
122
118
  - gemfiles/Gemfile.activemodel-5.0
123
119
  - gemfiles/Gemfile.activemodel-5.1
124
120
  - gemfiles/Gemfile.activemodel-5.2
121
+ - gemfiles/Gemfile.faraday-1.0
125
122
  - her.gemspec
126
123
  - lib/her.rb
127
124
  - lib/her/api.rb
@@ -198,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
195
  - !ruby/object:Gem::Version
199
196
  version: '0'
200
197
  requirements: []
201
- rubyforge_project:
202
- rubygems_version: 2.4.5.1
198
+ rubygems_version: 3.1.2
203
199
  signing_key:
204
200
  specification_version: 4
205
201
  summary: A simple Representational State Transfer-based Hypertext Transfer Protocol-powered