her 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/UPGRADE.md +1 -1
- data/her.gemspec +2 -2
- data/lib/her/model/associations/association_proxy.rb +1 -2
- data/lib/her/model/orm.rb +3 -2
- data/lib/her/version.rb +1 -1
- data/spec/model/orm_spec.rb +25 -0
- data/spec/model_spec.rb +13 -0
- metadata +37 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05819a61053829385f6b324cea06b9e8d7711ed8
|
4
|
+
data.tar.gz: 4e0ab4c195f58ae958d56a14d12269ec4e4501e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be38afb248738d2cddc242d08cd3ea33bcecc6488e432f72e65da2e6abf9eb25004d78a7ebde4670cd5862e3367b6aeab068754295d9760de6e55b9e60f8dbad
|
7
|
+
data.tar.gz: 6a9ff6754b4f1e9b9ec45a8108e3f18b03239b8b3e00a51ca60ed49e75517c26381d221dcd5cc12e4cfbabad2bb84918c0aa3c1ca0772fb9e1fd5565d9dac115
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Maintenance Update 29th Sept 2016
|
2
|
+
Hi folks, [@edtjones](https://github.com/edtjones) here. Rémi has handed me the keys to Her and [@foxpaul](https://github.com/foxpaul) and I will be trying to do the library justice with the help of the community. There's loads to do; we'll get in touch with everyone who's raised a PR as soon as possible and figure out a plan of action.
|
3
|
+
|
4
|
+
# Rails 5 support
|
5
|
+
If you need Rails 5 support, version 0.8.2 is for you!
|
6
|
+
|
1
7
|
<p align="center">
|
2
8
|
<a href="https://github.com/remiprev/her">
|
3
9
|
<img src="http://i.imgur.com/43KEchq.png" alt="Her" />
|
data/UPGRADE.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Here is a list of notable changes by release. Her follows the [Semantic Versioning](http://semver.org/) system.
|
4
4
|
|
5
|
-
## 0.8.0
|
5
|
+
## 0.8.1 (Note: 0.8.0 yanked)
|
6
6
|
|
7
7
|
- Initial support for JSONAPI [link](https://github.com/remiprev/her/pull/347)
|
8
8
|
- Fix for has_one association parsing [link](https://github.com/remiprev/her/pull/352)
|
data/her.gemspec
CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency "fivemat", "~> 1.2"
|
24
24
|
s.add_development_dependency "json", "~> 1.8"
|
25
25
|
|
26
|
-
s.add_runtime_dependency "activemodel", ">= 3.0.0", "<=
|
27
|
-
s.add_runtime_dependency "activesupport", ">= 3.0.0", "<=
|
26
|
+
s.add_runtime_dependency "activemodel", ">= 3.0.0", "<= 6.0.0"
|
27
|
+
s.add_runtime_dependency "activesupport", ">= 3.0.0", "<= 6.0.0"
|
28
28
|
s.add_runtime_dependency "faraday", ">= 0.8", "< 1.0"
|
29
29
|
s.add_runtime_dependency "multi_json", "~> 1.7"
|
30
30
|
end
|
@@ -33,8 +33,7 @@ module Her
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# create a proxy to the fetched object's method
|
36
|
-
|
37
|
-
metaclass.install_proxy_methods 'association.fetch', name
|
36
|
+
AssociationProxy.install_proxy_methods 'association.fetch', name
|
38
37
|
|
39
38
|
# resend message to fetched object
|
40
39
|
__send__(name, *args, &block)
|
data/lib/her/model/orm.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
module Her
|
2
3
|
module Model
|
3
4
|
# This module adds ORM-like capabilities to the model
|
@@ -72,10 +73,10 @@ module Her
|
|
72
73
|
# @user = User.find(1)
|
73
74
|
# @user.destroy
|
74
75
|
# # Called via DELETE "/users/1"
|
75
|
-
def destroy
|
76
|
+
def destroy(params = {})
|
76
77
|
method = self.class.method_for(:destroy)
|
77
78
|
run_callbacks :destroy do
|
78
|
-
self.class.request(:_method => method, :_path => request_path) do |parsed_data, response|
|
79
|
+
self.class.request(params.merge(:_method => method, :_path => request_path)) do |parsed_data, response|
|
79
80
|
assign_attributes(self.class.parse(parsed_data[:data])) if parsed_data[:data].any?
|
80
81
|
@metadata = parsed_data[:metadata]
|
81
82
|
@response_errors = parsed_data[:errors]
|
data/lib/her/version.rb
CHANGED
data/spec/model/orm_spec.rb
CHANGED
@@ -413,6 +413,31 @@ describe Her::Model::ORM do
|
|
413
413
|
@user.active.should be_falsey
|
414
414
|
@user.should be_destroyed
|
415
415
|
end
|
416
|
+
|
417
|
+
context "with params" do
|
418
|
+
before do
|
419
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
420
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
421
|
+
builder.use Faraday::Request::UrlEncoded
|
422
|
+
builder.adapter :test do |stub|
|
423
|
+
stub.delete("/users/1?delete_type=soft") { |env| [200, {}, { :id => 1, :fullname => "Lindsay Fünke", :active => false }.to_json] }
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
it "handle resource deletion through the .destroy class method" do
|
429
|
+
@user = Foo::User.destroy_existing(1, delete_type: 'soft')
|
430
|
+
@user.active.should be_false
|
431
|
+
@user.should be_destroyed
|
432
|
+
end
|
433
|
+
|
434
|
+
it "handle resource deletion through #destroy on an existing resource" do
|
435
|
+
@user = Foo::User.find(1)
|
436
|
+
@user.destroy(delete_type: 'soft')
|
437
|
+
@user.active.should be_false
|
438
|
+
@user.should be_destroyed
|
439
|
+
end
|
440
|
+
end
|
416
441
|
end
|
417
442
|
|
418
443
|
context 'customizing HTTP methods' do
|
data/spec/model_spec.rb
CHANGED
@@ -23,6 +23,19 @@ describe Her::Model do
|
|
23
23
|
it { should have_key(:comments) }
|
24
24
|
end
|
25
25
|
|
26
|
+
describe :serialization do
|
27
|
+
it 'should be serialized without an error' do
|
28
|
+
expect { Marshal.dump(subject.comments) }.not_to raise_error
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should correctly load serialized object' do
|
32
|
+
serialized_comments = Marshal.load(Marshal.dump(subject.comments))
|
33
|
+
subject.comments.size.should eq(serialized_comments.size)
|
34
|
+
subject.comments.first.id.should eq(serialized_comments.first.id)
|
35
|
+
subject.comments.first.body.should eq(serialized_comments.first.body)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
26
39
|
describe :[] do
|
27
40
|
it { should_not have_key(:unknown_method_for_a_user) }
|
28
41
|
specify { subject[:name].should == "Tobias Fünke" }
|
metadata
CHANGED
@@ -1,157 +1,157 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: her
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.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:
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10.0'
|
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
26
|
version: '10.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.13'
|
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
40
|
version: '2.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-its
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
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
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: fivemat
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.8'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activemodel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 3.0.0
|
90
|
-
- -
|
90
|
+
- - <=
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 6.0.0
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: 3.0.0
|
100
|
-
- -
|
100
|
+
- - <=
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 6.0.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activesupport
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 3.0.0
|
110
|
-
- -
|
110
|
+
- - <=
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 6.0.0
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - '>='
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 3.0.0
|
120
|
-
- -
|
120
|
+
- - <=
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: 6.0.0
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: faraday
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - '>='
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0.8'
|
130
|
-
- -
|
130
|
+
- - <
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '1.0'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - '>='
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0.8'
|
140
|
-
- -
|
140
|
+
- - <
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '1.0'
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: multi_json
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- -
|
147
|
+
- - ~>
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '1.7'
|
150
150
|
type: :runtime
|
151
151
|
prerelease: false
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- -
|
154
|
+
- - ~>
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: '1.7'
|
157
157
|
description: Her is an ORM that maps REST resources and collections to Ruby objects
|
@@ -161,10 +161,10 @@ executables: []
|
|
161
161
|
extensions: []
|
162
162
|
extra_rdoc_files: []
|
163
163
|
files:
|
164
|
-
-
|
165
|
-
-
|
166
|
-
-
|
167
|
-
-
|
164
|
+
- .gitignore
|
165
|
+
- .rspec
|
166
|
+
- .travis.yml
|
167
|
+
- .yardopts
|
168
168
|
- CONTRIBUTING.md
|
169
169
|
- Gemfile
|
170
170
|
- LICENSE
|
@@ -242,17 +242,17 @@ require_paths:
|
|
242
242
|
- lib
|
243
243
|
required_ruby_version: !ruby/object:Gem::Requirement
|
244
244
|
requirements:
|
245
|
-
- -
|
245
|
+
- - '>='
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
249
|
requirements:
|
250
|
-
- -
|
250
|
+
- - '>='
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '0'
|
253
253
|
requirements: []
|
254
254
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.2.
|
255
|
+
rubygems_version: 2.2.2
|
256
256
|
signing_key:
|
257
257
|
specification_version: 4
|
258
258
|
summary: A simple Representational State Transfer-based Hypertext Transfer Protocol-powered
|