apipie-bindings 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes.md +11 -0
- data/lib/apipie_bindings/api.rb +10 -5
- data/lib/apipie_bindings/version.rb +1 -1
- data/test/unit/api_test.rb +13 -3
- metadata +116 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e2b6c74e6f5eabc3b2c279de947f3d8249fd978
|
4
|
+
data.tar.gz: bac12a5d7f2d0c2bf25ca97fc1430c5767dd3aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6cc3e9a3bbacc815c2d775bc72face007584478f80e245102edd325617699e48963632471be919d5a81d44d3b422bfcbc002f92a4129134c82711121ed64e5
|
7
|
+
data.tar.gz: 4149592d5f3f8424080881f0cd124caf2d3bbe506c6e13daf986eca4f362e2746f148e575400ed8c2b268917b454f0590b2eca0c9aa26a7494587d67a6c4ce44
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Release notes
|
2
|
+
=============
|
3
|
+
|
4
|
+
### 0.0.9 (2014-08-29)
|
5
|
+
* Fixes RHBZ#1134954 - Log API errors that are re-risen with debug verbosity
|
6
|
+
* Add apidoc_cache_base_dir option to move all caches to another dir
|
7
|
+
* Moved development dependences to gemspec
|
8
|
+
* Fixed cache name test
|
9
|
+
* Added configuration for Travis CI
|
10
|
+
* Fixed response headers in dry_run
|
11
|
+
* Logging response headers
|
data/lib/apipie_bindings/api.rb
CHANGED
@@ -24,7 +24,9 @@ module ApipieBindings
|
|
24
24
|
# @option config [Hash] :headers additional headers to send with the requests
|
25
25
|
# @option config [String] :api_version ('1') version of the API
|
26
26
|
# @option config [String] :language prefered locale for the API description
|
27
|
-
# @option config [String] :
|
27
|
+
# @option config [String] :apidoc_cache_base_dir ('~/.cache/apipie_bindings') base
|
28
|
+
# directory for building apidoc_cache_dir
|
29
|
+
# @option config [String] :apidoc_cache_dir (apidoc_cache_base_dir+'/<URI>') where
|
28
30
|
# to cache the JSON description of the API
|
29
31
|
# @option config [String] :apidoc_cache_name ('default.json') name of te cache file.
|
30
32
|
# If there is cache in the :apidoc_cache_dir, it is used.
|
@@ -53,7 +55,8 @@ module ApipieBindings
|
|
53
55
|
@uri = config[:uri]
|
54
56
|
@api_version = config[:api_version] || 1
|
55
57
|
@language = config[:language]
|
56
|
-
|
58
|
+
apidoc_cache_base_dir = config[:apidoc_cache_base_dir] || File.join(File.expand_path('~/.cache'), 'apipie_bindings')
|
59
|
+
@apidoc_cache_dir = config[:apidoc_cache_dir] || File.join(apidoc_cache_base_dir, @uri.tr(':/', '_'))
|
57
60
|
@apidoc_cache_name = config[:apidoc_cache_name] || set_default_name
|
58
61
|
@dry_run = config[:dry_run] || false
|
59
62
|
@aggressive_cache_checking = config[:aggressive_cache_checking] || false
|
@@ -189,20 +192,22 @@ module ApipieBindings
|
|
189
192
|
if dry_run?
|
190
193
|
empty_response = ApipieBindings::Example.new('', '', '', 200, '')
|
191
194
|
ex = options[:fake_response ] || empty_response
|
192
|
-
|
195
|
+
net_http_resp = Net::HTTPResponse.new(1.0, ex.status, "")
|
196
|
+
response = RestClient::Response.create(ex.response, net_http_resp, args)
|
193
197
|
else
|
194
198
|
begin
|
195
199
|
response = @client[path].send(*args)
|
196
200
|
update_cache(response.headers[:apipie_checksum])
|
197
201
|
rescue => e
|
198
|
-
log.
|
202
|
+
log.debug e.message + "\n" +
|
199
203
|
(e.respond_to?(:response) ? process_data(e.response).ai : e.ai)
|
200
204
|
raise
|
201
205
|
end
|
202
206
|
end
|
203
207
|
|
204
208
|
result = options[:response] == :raw ? response : process_data(response)
|
205
|
-
log.debug "Response %s" % (options[:reduce_response_log] ? "Received OK" : result.ai)
|
209
|
+
log.debug "Response: %s" % (options[:reduce_response_log] ? "Received OK" : result.ai)
|
210
|
+
log.debug "Response headers: #{response.headers.ai}" if response.respond_to?(:headers)
|
206
211
|
result
|
207
212
|
end
|
208
213
|
|
data/test/unit/api_test.rb
CHANGED
@@ -66,7 +66,9 @@ describe ApipieBindings::API do
|
|
66
66
|
:dry_run => true})
|
67
67
|
s = StringIO.new; s << 'foo'
|
68
68
|
headers = {:content_type => 'multipart/form-data', :multipart => true}
|
69
|
-
RestClient::Response.expects(:create).with(
|
69
|
+
RestClient::Response.expects(:create).with() {
|
70
|
+
|body, head, args| args == [:post, {:file => s}, headers]
|
71
|
+
}
|
70
72
|
result = api.http_call(:post, '/api/path', {:file => s}, headers, {:response => :raw})
|
71
73
|
end
|
72
74
|
|
@@ -127,9 +129,10 @@ describe ApipieBindings::API do
|
|
127
129
|
end
|
128
130
|
|
129
131
|
it "should load cache and its name from cache dir" do
|
132
|
+
Dir["#{@dir}/*"].each { |f| File.delete(f) }
|
130
133
|
FileUtils.cp('test/unit/data/architecture.json', File.join(@dir, 'api_cache.json'))
|
131
|
-
|
132
|
-
|
134
|
+
api = ApipieBindings::API.new({:apidoc_cache_dir => @dir})
|
135
|
+
api.apidoc_cache_name.must_equal 'api_cache'
|
133
136
|
end
|
134
137
|
end
|
135
138
|
|
@@ -137,6 +140,13 @@ describe ApipieBindings::API do
|
|
137
140
|
it "should complain when no uri or cache dir is set" do
|
138
141
|
proc {ApipieBindings::API.new({})}.must_raise ApipieBindings::ConfigurationError
|
139
142
|
end
|
143
|
+
|
144
|
+
it "should obey :apidoc_cache_base_dir to generate apidoc_cache_dir" do
|
145
|
+
Dir.mktmpdir do |dir|
|
146
|
+
api = ApipieBindings::API.new({:uri => 'http://example.com', :apidoc_cache_base_dir => dir})
|
147
|
+
api.apidoc_cache_file.must_equal File.join(dir, 'http___example.com', 'default.json')
|
148
|
+
end
|
149
|
+
end
|
140
150
|
end
|
141
151
|
|
142
152
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bačovský
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -30,14 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.6.
|
33
|
+
version: 1.6.5
|
34
|
+
- - <
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '1.7'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - '>='
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.6.
|
43
|
+
version: 1.6.5
|
44
|
+
- - <
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.7'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: oauth
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +86,110 @@ dependencies:
|
|
80
86
|
- - ~>
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '1.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rake
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 10.1.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 10.1.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: thor
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: minitest
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 4.7.4
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - '='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 4.7.4
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: minitest-spec-context
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: simplecov
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - <
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 0.9.0
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - <
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 0.9.0
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: mocha
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: ci_reporter
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 1.6.3
|
180
|
+
- - <
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 2.0.0
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 1.6.3
|
190
|
+
- - <
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 2.0.0
|
83
193
|
description: |
|
84
194
|
Bindings for API calls that are documented with Apipie. Bindings are generated on the fly.
|
85
195
|
email: mbacovsk@redhat.com
|
@@ -87,9 +197,11 @@ executables: []
|
|
87
197
|
extensions: []
|
88
198
|
extra_rdoc_files:
|
89
199
|
- README.md
|
200
|
+
- doc/release_notes.md
|
90
201
|
files:
|
91
202
|
- LICENSE
|
92
203
|
- README.md
|
204
|
+
- doc/release_notes.md
|
93
205
|
- lib/apipie-bindings.rb
|
94
206
|
- lib/apipie_bindings.rb
|
95
207
|
- lib/apipie_bindings/action.rb
|