rest-in-peace 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -29,6 +29,14 @@ module RESTinPeace
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
def put(method_name, url_template)
|
33
|
+
@target.rip_registry[:resource] << { method: :put, name: method_name, url: url_template }
|
34
|
+
@target.send(:define_method, method_name) do
|
35
|
+
call = RESTinPeace::ApiCall.new(api, url_template, self, to_h)
|
36
|
+
call.put
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
def delete(method_name, url_template, default_params = {})
|
33
41
|
@target.rip_registry[:resource] << { method: :delete, name: method_name, url: url_template }
|
34
42
|
@target.send(:define_method, method_name) do |params = {}|
|
@@ -22,7 +22,7 @@ describe RESTinPeace::ApiCall do
|
|
22
22
|
context 'with more parameters than needed' do
|
23
23
|
let(:params) { { id: 1, name: 'test' } }
|
24
24
|
it 'uses also the additional parameters' do
|
25
|
-
expect(api).to receive(:get).with('/rip/1',
|
25
|
+
expect(api).to receive(:get).with('/rip/1', name: 'test').and_return(response)
|
26
26
|
api_call.get
|
27
27
|
end
|
28
28
|
end
|
@@ -32,7 +32,7 @@ describe RESTinPeace::ApiCall do
|
|
32
32
|
let(:url_template) { '/rip' }
|
33
33
|
let(:params) { { name: 'test' } }
|
34
34
|
it 'calls the api with the parameters' do
|
35
|
-
expect(api).to receive(:post).with('/rip',
|
35
|
+
expect(api).to receive(:post).with('/rip', name: 'test').and_return(response)
|
36
36
|
api_call.post
|
37
37
|
end
|
38
38
|
end
|
@@ -40,11 +40,19 @@ describe RESTinPeace::ApiCall do
|
|
40
40
|
describe '#patch' do
|
41
41
|
let(:params) { { id: 1, name: 'test' } }
|
42
42
|
it 'calls the api with the parameters' do
|
43
|
-
expect(api).to receive(:patch).with('/rip/1',
|
43
|
+
expect(api).to receive(:patch).with('/rip/1', name: 'test').and_return(response)
|
44
44
|
api_call.patch
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
describe '#put' do
|
49
|
+
let(:params) { { id: 1, name: 'test' } }
|
50
|
+
it 'calls the api with the parameters' do
|
51
|
+
expect(api).to receive(:put).with('/rip/1', name: 'test').and_return(response)
|
52
|
+
api_call.put
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
48
56
|
describe '#delete' do
|
49
57
|
it 'calls the api with the parameters' do
|
50
58
|
expect(api).to receive(:delete).with('/rip/1', {}).and_return(response)
|
@@ -71,6 +71,14 @@ describe RESTinPeace::DefinitionProxy::ResourceMethodDefinitions do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
context '#put' do
|
75
|
+
it_behaves_like 'an instance method' do
|
76
|
+
let(:http_verb) { :put }
|
77
|
+
let(:method_name) { :update }
|
78
|
+
let(:url_template) { '/a/:id' }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
74
82
|
context '#delete' do
|
75
83
|
it_behaves_like 'an instance method' do
|
76
84
|
let(:http_verb) { :delete }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-in-peace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|