api_client 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG.md +4 -0
- data/README.md +7 -0
- data/lib/api_client/scope.rb +7 -1
- data/lib/api_client/version.rb +1 -1
- data/spec/api_client/scope_spec.rb +27 -0
- metadata +62 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
metadata.gz: 2e42b7b564b5052cfc4f16c402ed50c5799863466e80fff627b0c4941ac190aa5163698f53b1cc6213b2a5cf1d243806eb90b12408731b695434471e81f74b9e
|
4
|
+
data.tar.gz: b0753a40feb22f1db2511a8ad4c7266de5ebd9fdf1faf04a617b47e0cf742edec024efeffaae6a449f34fb6e72fda44b283969af2b2d04d7cc7d5218d7fb29eb
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 8e6ba65ec2ce249765942b32529d15d47c83f6be
|
7
|
+
data.tar.gz: 4ad33db01a65a8801882904b233069a5c09615ae
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -121,6 +121,13 @@ ApiClient allows you to apply scoping to your request using 3 methods:
|
|
121
121
|
|
122
122
|
It returns a ApiClient::Scope object attached to a class you started with.
|
123
123
|
|
124
|
+
* ApiClient::Base.raw_body(body = nil)
|
125
|
+
|
126
|
+
Allows setting non-hash body in the request. Useful for binary payloads.
|
127
|
+
Notice: it overrides all parameters set via params method!
|
128
|
+
|
129
|
+
It returns a ApiClient::Scope object attached to a class you started with.
|
130
|
+
|
124
131
|
All of these methods return a ApiClient::Scope object. When you call any request
|
125
132
|
methods on this object (get, post, put, delete), the request will apply the
|
126
133
|
options, params and headers.
|
data/lib/api_client/scope.rb
CHANGED
@@ -60,6 +60,12 @@ module ApiClient
|
|
60
60
|
self
|
61
61
|
end
|
62
62
|
|
63
|
+
def raw_body(options = nil)
|
64
|
+
return @raw_body if options.nil?
|
65
|
+
@raw_body = options
|
66
|
+
self
|
67
|
+
end
|
68
|
+
|
63
69
|
def clone_only_headers
|
64
70
|
self.class.new(self.scopeable).headers(self.headers)
|
65
71
|
end
|
@@ -79,7 +85,7 @@ module ApiClient
|
|
79
85
|
|
80
86
|
raw = raw? || options.delete(:raw)
|
81
87
|
params(options)
|
82
|
-
response = connection.send method, path, @params, @headers
|
88
|
+
response = connection.send method, path, (@raw_body || @params), @headers
|
83
89
|
raw ? response : @scopeable.parse(response)
|
84
90
|
end
|
85
91
|
|
data/lib/api_client/version.rb
CHANGED
@@ -45,6 +45,33 @@ describe ApiClient::Scope do
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
+
describe "#raw_body" do
|
49
|
+
|
50
|
+
it "reads/writes non-hash body" do
|
51
|
+
instance = ApiClient::Scope.new(ApiClient::Base)
|
52
|
+
instance.raw_body('raw body string').should == instance
|
53
|
+
instance.raw_body.should == 'raw body string'
|
54
|
+
end
|
55
|
+
|
56
|
+
it "overwrites previous raw_body" do
|
57
|
+
instance = ApiClient::Scope.new(ApiClient::Base)
|
58
|
+
instance.raw_body('previous').raw_body('current')
|
59
|
+
instance.raw_body.should == 'current'
|
60
|
+
end
|
61
|
+
|
62
|
+
it "does request with raw body only if set, skips other params" do
|
63
|
+
connection = double
|
64
|
+
instance = ApiClient::Scope.new(ApiClient::Base)
|
65
|
+
instance.stub(:connection).and_return(connection)
|
66
|
+
response = Faraday::Response.new(:body => '{"a": "1"}')
|
67
|
+
connection.should_receive(:get).with(@path, 'raw body string', {}).and_return(response)
|
68
|
+
|
69
|
+
result = instance.params({:skipped => 'params'}).raw_body('raw body string').request(:get, @path)
|
70
|
+
result.should == {"a"=> "1"}
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
48
75
|
describe "connection" do
|
49
76
|
|
50
77
|
it "retuns the connection based on the adapter" do
|
metadata
CHANGED
@@ -1,95 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Marcin Bunsch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
date: 2016-03-14 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
14
15
|
name: yajl-ruby
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
16
|
prerelease: false
|
22
|
-
|
23
|
-
requirements:
|
24
|
-
-
|
25
|
-
-
|
26
|
-
|
27
|
-
|
28
|
-
name: faraday
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.1
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- &id006
|
20
|
+
- ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
34
23
|
type: :runtime
|
24
|
+
version_requirements: *id001
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: faraday
|
35
27
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
38
30
|
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
40
32
|
version: 0.8.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: hashie
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0.5
|
48
33
|
type: :runtime
|
34
|
+
version_requirements: *id002
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hashie
|
49
37
|
prerelease: false
|
50
|
-
|
51
|
-
requirements:
|
38
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
52
40
|
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
41
|
+
- !ruby/object:Gem::Version
|
54
42
|
version: 2.0.5
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: multi_json
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.6.1
|
62
43
|
type: :runtime
|
44
|
+
version_requirements: *id003
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: multi_json
|
63
47
|
prerelease: false
|
64
|
-
|
65
|
-
requirements:
|
48
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
66
50
|
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
51
|
+
- !ruby/object:Gem::Version
|
68
52
|
version: 1.6.1
|
69
|
-
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id004
|
55
|
+
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 2.14.1
|
76
|
-
type: :development
|
77
57
|
prerelease: false
|
78
|
-
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
58
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "="
|
61
|
+
- !ruby/object:Gem::Version
|
82
62
|
version: 2.14.1
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id005
|
83
65
|
description: API client builder
|
84
|
-
email:
|
66
|
+
email:
|
85
67
|
- marcin@futuresimple.com
|
86
68
|
executables: []
|
69
|
+
|
87
70
|
extensions: []
|
71
|
+
|
88
72
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
|
91
|
-
-
|
92
|
-
-
|
73
|
+
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- .rspec
|
77
|
+
- .travis.yml
|
93
78
|
- CHANGELOG.md
|
94
79
|
- Gemfile
|
95
80
|
- LICENSE
|
@@ -148,28 +133,28 @@ files:
|
|
148
133
|
- spec/support/matchers.rb
|
149
134
|
homepage: https://github.com/futuresimple/api_client
|
150
135
|
licenses: []
|
136
|
+
|
151
137
|
metadata: {}
|
138
|
+
|
152
139
|
post_install_message:
|
153
140
|
rdoc_options: []
|
154
|
-
|
141
|
+
|
142
|
+
require_paths:
|
155
143
|
- lib
|
156
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
requirements:
|
163
|
-
- - ">="
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- *id006
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- *id006
|
166
150
|
requirements: []
|
151
|
+
|
167
152
|
rubyforge_project: api_client
|
168
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.4.5
|
169
154
|
signing_key:
|
170
155
|
specification_version: 3
|
171
156
|
summary: API client builder
|
172
|
-
test_files:
|
157
|
+
test_files:
|
173
158
|
- spec/api_client/base/connection_hook_spec.rb
|
174
159
|
- spec/api_client/base/delegation_spec.rb
|
175
160
|
- spec/api_client/base/inheritance_spec.rb
|