octoparts 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +3 -6
- data/LICENSE.txt +1 -1
- data/README.md +2 -5
- data/lib/octoparts/client.rb +1 -1
- data/lib/octoparts/representer/aggregate_request_representer.rb +1 -1
- data/lib/octoparts/version.rb +1 -1
- data/octoparts.gemspec +7 -4
- data/test/representer/test_aggregate_request_representer.rb +1 -1
- data/test/test_client.rb +44 -7
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf543c1883b814993628ea8d6bdb403f6662839a
|
4
|
+
data.tar.gz: cb94b2e8bfea66b815bc3f4b5c36919797df260f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95b57df111373982427a8c2f44067ef95764f8745a81029bbb4c63fa0499c37af4cbd8d575921b9c687c0ba3048372371fad13b51b785adbdd1ecfcd0914563
|
7
|
+
data.tar.gz: 7cbd4a7a26ff4dc5d8d240b9722f3f4974b6f8a89943f090fe7116e8185fa6b2c692db256f58c8e7c267d42e57fd2d4a53a748e6363f54fe2858002ba218f40b
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# Octoparts
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/octoparts)
|
4
|
-
[](https://coveralls.io/r/ma2gedev/octoparts-rb)
|
6
|
-
[](https://codeclimate.com/github/ma2gedev/octoparts-rb)
|
7
|
-
[](https://coderwall.com/ma2gedev)
|
4
|
+
[](https://travis-ci.org/m3dev/octoparts-rb)
|
8
5
|
|
9
6
|
Octoparts Client for Ruby
|
10
7
|
|
@@ -80,7 +77,7 @@ client.invalidate_cache_group('echo_group', param_value: 'fooValue')
|
|
80
77
|
|
81
78
|
## Contributing
|
82
79
|
|
83
|
-
1. Fork it ( https://github.com/
|
80
|
+
1. Fork it ( https://github.com/m3dev/octoparts/fork )
|
84
81
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
85
82
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
86
83
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/octoparts/client.rb
CHANGED
data/lib/octoparts/version.rb
CHANGED
data/octoparts.gemspec
CHANGED
@@ -6,21 +6,24 @@ require 'octoparts/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "octoparts"
|
8
8
|
spec.version = Octoparts::VERSION
|
9
|
-
spec.authors = ["Takayuki Matsubara"]
|
10
|
-
spec.email = ["takayuki.1229@gmail.com"]
|
9
|
+
spec.authors = ["Takayuki Matsubara", "M3, inc."]
|
10
|
+
spec.email = ["takayuki.1229@gmail.com", "platform-dev@m3.com"]
|
11
11
|
spec.summary = %q{ Ruby client for the Octoparts API }
|
12
12
|
spec.description = %q{ Ruby client library for the Octoparts API }
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/m3dev/octoparts-rb"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.files.reject! {|f| f == 'Gemfile.lock'}
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.
|
22
|
+
spec.required_ruby_version = '~> 2.2'
|
23
|
+
spec.add_dependency "representable", "~> 3.0"
|
22
24
|
spec.add_dependency "activesupport", "> 4.0.0"
|
23
25
|
spec.add_dependency "faraday"
|
26
|
+
spec.add_dependency "multi_json"
|
24
27
|
|
25
28
|
spec.add_development_dependency "bundler", "~> 1.7"
|
26
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -58,7 +58,7 @@ class TestAggregateRequestRepresenter < Test::Unit::TestCase
|
|
58
58
|
aggregate_request = Octoparts::Model::AggregateRequest.new
|
59
59
|
.extend(Octoparts::Representer::AggregateRequestRepresenter).from_hash(JSON.parse(@json))
|
60
60
|
assert do
|
61
|
-
JSON.parse(aggregate_request.to_json(camelize: true)) == convert_hash_keys(JSON.parse(@json))
|
61
|
+
JSON.parse(aggregate_request.to_json(user_options: {camelize: true})) == convert_hash_keys(JSON.parse(@json))
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
data/test/test_client.rb
CHANGED
@@ -153,29 +153,24 @@ class TestClient < Test::Unit::TestCase
|
|
153
153
|
|
154
154
|
sub_test_case "timeout" do
|
155
155
|
setup do
|
156
|
-
@endpoint = Octoparts.configuration.endpoint
|
157
|
-
Octoparts.configure do |c|
|
158
|
-
# avoiding connection failed error, sorry heroku...
|
159
|
-
# we should find other way
|
160
|
-
c.endpoint = 'http://octoparts.herokuapp.com'
|
161
|
-
end
|
162
156
|
@exception_class = defined?(Faraday::TimeoutError) ? Faraday::TimeoutError : Faraday::Error::TimeoutError
|
163
157
|
end
|
164
158
|
|
165
159
|
teardown do
|
166
160
|
Octoparts.configure do |c|
|
167
|
-
c.endpoint = @endpoint
|
168
161
|
c.timeout_sec = nil
|
169
162
|
end
|
170
163
|
end
|
171
164
|
|
172
165
|
test "timeout_sec option" do
|
166
|
+
stub_request(:get, 'localhost:9000').to_raise(Timeout::Error)
|
173
167
|
assert_raise @exception_class do
|
174
168
|
Octoparts::Client.new(timeout_sec: 0).get('/')
|
175
169
|
end
|
176
170
|
end
|
177
171
|
|
178
172
|
test "open_timeout_sec option" do
|
173
|
+
stub_request(:get, 'localhost:9000').to_raise(Timeout::Error)
|
179
174
|
Octoparts.configure do |c|
|
180
175
|
c.timeout_sec = 0
|
181
176
|
end
|
@@ -193,4 +188,46 @@ class TestClient < Test::Unit::TestCase
|
|
193
188
|
end
|
194
189
|
end
|
195
190
|
end
|
191
|
+
|
192
|
+
sub_test_case "#create_request_body" do
|
193
|
+
test "return camelized keys" do
|
194
|
+
request_hash = {
|
195
|
+
request_meta: {
|
196
|
+
id: 1,
|
197
|
+
service_id: 'hoge',
|
198
|
+
user_id: 2,
|
199
|
+
session_id: 3,
|
200
|
+
request_url: 'http://test.com',
|
201
|
+
user_agent: 'ruby',
|
202
|
+
timeout: 4
|
203
|
+
},
|
204
|
+
requests: [{
|
205
|
+
part_id: 'fuga',
|
206
|
+
id: 5,
|
207
|
+
params: [{
|
208
|
+
key: 'value_of_key',
|
209
|
+
value: 'value_of_value'
|
210
|
+
}]
|
211
|
+
}]
|
212
|
+
}
|
213
|
+
body_json = Octoparts::Client.new(timeout_sec: 0).send(:create_request_body, request_hash)
|
214
|
+
body = JSON.parse(body_json, symbolize_names: true)
|
215
|
+
assert { body[:requestMeta] != nil }
|
216
|
+
request_meta = body[:requestMeta]
|
217
|
+
assert { request_meta[:id] == 1 }
|
218
|
+
assert { request_meta[:serviceId] == 'hoge' }
|
219
|
+
assert { request_meta[:userId] == 2 }
|
220
|
+
assert { request_meta[:sessionId] == 3 }
|
221
|
+
assert { request_meta[:requestUrl] == 'http://test.com' }
|
222
|
+
assert { request_meta[:userAgent] == 'ruby' }
|
223
|
+
assert { request_meta[:timeout] == 4 }
|
224
|
+
assert { body[:requests].instance_of?(Array) }
|
225
|
+
request_item = body[:requests].first
|
226
|
+
assert { request_item[:partId] == 'fuga' }
|
227
|
+
assert { request_item[:id] == 5 }
|
228
|
+
assert { request_item[:params] != nil }
|
229
|
+
assert { request_item[:params].first[:key] == 'value_of_key' }
|
230
|
+
assert { request_item[:params].first[:value] == 'value_of_value' }
|
231
|
+
end
|
232
|
+
end
|
196
233
|
end
|
metadata
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octoparts
|
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
|
- Takayuki Matsubara
|
8
|
+
- M3, inc.
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: representable
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
+
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
+
version: '3.0'
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- - "
|
25
|
+
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
+
version: '3.0'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: activesupport
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +53,20 @@ dependencies:
|
|
52
53
|
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: multi_json
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
55
70
|
- !ruby/object:Gem::Dependency
|
56
71
|
name: bundler
|
57
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +168,7 @@ dependencies:
|
|
153
168
|
description: " Ruby client library for the Octoparts API "
|
154
169
|
email:
|
155
170
|
- takayuki.1229@gmail.com
|
171
|
+
- platform-dev@m3.com
|
156
172
|
executables: []
|
157
173
|
extensions: []
|
158
174
|
extra_rdoc_files: []
|
@@ -198,7 +214,7 @@ files:
|
|
198
214
|
- test/test_builder.rb
|
199
215
|
- test/test_client.rb
|
200
216
|
- test/test_octoparts.rb
|
201
|
-
homepage: https://github.com/
|
217
|
+
homepage: https://github.com/m3dev/octoparts-rb
|
202
218
|
licenses:
|
203
219
|
- MIT
|
204
220
|
metadata: {}
|
@@ -208,9 +224,9 @@ require_paths:
|
|
208
224
|
- lib
|
209
225
|
required_ruby_version: !ruby/object:Gem::Requirement
|
210
226
|
requirements:
|
211
|
-
- - "
|
227
|
+
- - "~>"
|
212
228
|
- !ruby/object:Gem::Version
|
213
|
-
version: '
|
229
|
+
version: '2.2'
|
214
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
231
|
requirements:
|
216
232
|
- - ">="
|
@@ -218,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
234
|
version: '0'
|
219
235
|
requirements: []
|
220
236
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.6.8
|
222
238
|
signing_key:
|
223
239
|
specification_version: 4
|
224
240
|
summary: Ruby client for the Octoparts API
|