her 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +19 -1279
- data/.rubocop_todo.yml +232 -0
- data/README.md +16 -0
- data/her.gemspec +3 -2
- data/lib/her/api.rb +8 -7
- data/lib/her/collection.rb +2 -1
- data/lib/her/errors.rb +3 -1
- data/lib/her/json_api/model.rb +8 -12
- data/lib/her/middleware.rb +1 -1
- data/lib/her/middleware/accept_json.rb +1 -0
- data/lib/her/middleware/first_level_parse_json.rb +6 -5
- data/lib/her/middleware/json_api_parser.rb +6 -5
- data/lib/her/middleware/parse_json.rb +2 -1
- data/lib/her/middleware/second_level_parse_json.rb +6 -5
- data/lib/her/model/associations.rb +6 -6
- data/lib/her/model/associations/association.rb +7 -9
- data/lib/her/model/associations/association_proxy.rb +2 -3
- data/lib/her/model/associations/belongs_to_association.rb +1 -1
- data/lib/her/model/attributes.rb +6 -6
- data/lib/her/model/base.rb +2 -2
- data/lib/her/model/http.rb +1 -1
- data/lib/her/model/introspection.rb +5 -3
- data/lib/her/model/nested_attributes.rb +1 -1
- data/lib/her/model/orm.rb +9 -8
- data/lib/her/model/parse.rb +9 -12
- data/lib/her/model/paths.rb +3 -4
- data/lib/her/model/relation.rb +5 -4
- data/lib/her/version.rb +1 -1
- data/spec/api_spec.rb +3 -0
- data/spec/middleware/accept_json_spec.rb +1 -0
- data/spec/middleware/first_level_parse_json_spec.rb +2 -1
- data/spec/middleware/json_api_parser_spec.rb +1 -0
- data/spec/middleware/second_level_parse_json_spec.rb +1 -0
- data/spec/model/associations/association_proxy_spec.rb +1 -0
- data/spec/model/associations_spec.rb +4 -3
- data/spec/model/attributes_spec.rb +5 -3
- data/spec/model/callbacks_spec.rb +14 -15
- data/spec/model/dirty_spec.rb +1 -0
- data/spec/model/http_spec.rb +1 -0
- data/spec/model/introspection_spec.rb +3 -2
- data/spec/model/nested_attributes_spec.rb +1 -0
- data/spec/model/orm_spec.rb +22 -16
- data/spec/model/parse_spec.rb +3 -0
- data/spec/model/paths_spec.rb +1 -0
- data/spec/model/relation_spec.rb +3 -2
- data/spec/model/validations_spec.rb +1 -0
- data/spec/model_spec.rb +1 -0
- data/spec/support/extensions/array.rb +1 -0
- data/spec/support/extensions/hash.rb +1 -0
- metadata +12 -11
data/spec/model/parse_spec.rb
CHANGED
@@ -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::Parse do
|
@@ -251,6 +252,7 @@ describe Her::Model::Parse do
|
|
251
252
|
|
252
253
|
it "parse the data with the symbol" do
|
253
254
|
@new_user = Foo::User.create(fullname: "Lindsay Fünke")
|
255
|
+
expect(@new_user.id).to eq(1)
|
254
256
|
expect(@new_user.fullname).to eq("Lindsay Fünke")
|
255
257
|
end
|
256
258
|
end
|
@@ -264,6 +266,7 @@ describe Her::Model::Parse do
|
|
264
266
|
|
265
267
|
spawn_model("Foo::Model") { parse_root_in_json true, format: :active_model_serializers }
|
266
268
|
class User < Foo::Model
|
269
|
+
|
267
270
|
collection_path "/users"
|
268
271
|
end
|
269
272
|
|
data/spec/model/paths_spec.rb
CHANGED
data/spec/model/relation_spec.rb
CHANGED
@@ -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"
|
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"
|
216
|
+
stub.get("/users?active=true") { |env| ok! [{ id: 3, active: (params(env)[:active] == "true") }] }
|
216
217
|
end
|
217
218
|
end
|
218
219
|
|
data/spec/model_spec.rb
CHANGED
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.
|
4
|
+
version: 1.0.2
|
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-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
26
|
+
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
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: '
|
54
|
+
version: '3.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".gitignore"
|
111
111
|
- ".rspec"
|
112
112
|
- ".rubocop.yml"
|
113
|
+
- ".rubocop_todo.yml"
|
113
114
|
- ".travis.yml"
|
114
115
|
- ".yardopts"
|
115
116
|
- CONTRIBUTING.md
|