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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 317c9ff049a5f765301e3565e3d0950cdd4b10bd
4
- data.tar.gz: 08f78bb01fc87dd29220192f43900e0947805409
3
+ metadata.gz: bf543c1883b814993628ea8d6bdb403f6662839a
4
+ data.tar.gz: cb94b2e8bfea66b815bc3f4b5c36919797df260f
5
5
  SHA512:
6
- metadata.gz: 1e6dad732918d9f8c14ce0cbf4a0f0ab333257da067ee42f73667b111483939867311da3925a7ae052e8feb0c6b88cb73eea03cbe62560ba567afe01edb72107
7
- data.tar.gz: 5a80bc14ed1264a540b63f329ab0e8a88c6ca0ffae534534dbedb7f8074f370a9d2442802bf6087a98dc91510ec90c4e19a7ac8380f1b42c2c0cd75d0c9573df
6
+ metadata.gz: b95b57df111373982427a8c2f44067ef95764f8745a81029bbb4c63fa0499c37af4cbd8d575921b9c687c0ba3048372371fad13b51b785adbdd1ecfcd0914563
7
+ data.tar.gz: 7cbd4a7a26ff4dc5d8d240b9722f3f4974b6f8a89943f090fe7116e8185fa6b2c692db256f58c8e7c267d42e57fd2d4a53a748e6363f54fe2858002ba218f40b
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -1,10 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0-p598
4
- - 2.1.5
5
- - 2.2.0
6
- gemfile:
7
- - Gemfile
8
- - gemfiles/faraday-0_8_8.gemfile
3
+ - 2.2.6
4
+ - 2.3.3
5
+ - 2.4.0
9
6
  sudo: false
10
7
  cache: bundler
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2015 Takayuki Matsubara
1
+ Copyright (c) 2014-2017 Takayuki Matsubara, M3, Inc.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # Octoparts
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/octoparts.svg)](http://badge.fury.io/rb/octoparts)
4
- [![Build Status](https://travis-ci.org/ma2gedev/octoparts-rb.svg)](https://travis-ci.org/ma2gedev/octoparts-rb)
5
- [![Coverage Status](https://img.shields.io/coveralls/ma2gedev/octoparts-rb.svg)](https://coveralls.io/r/ma2gedev/octoparts-rb)
6
- [![Code Climate](https://codeclimate.com/github/ma2gedev/octoparts-rb/badges/gpa.svg)](https://codeclimate.com/github/ma2gedev/octoparts-rb)
7
- [![endorse](https://api.coderwall.com/ma2gedev/endorsecount.png)](https://coderwall.com/ma2gedev)
4
+ [![Build Status](https://travis-ci.org/m3dev/octoparts-rb.svg?branch=master)](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/ma2gedev/octoparts/fork )
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`)
@@ -94,7 +94,7 @@ module Octoparts
94
94
  else
95
95
  raise Octoparts::ArgumentError
96
96
  end
97
- aggregate_request.to_json(camelize: true)
97
+ aggregate_request.to_json(user_options: {camelize: true})
98
98
  end
99
99
  end
100
100
  end
@@ -9,7 +9,7 @@ module Octoparts
9
9
  end
10
10
 
11
11
  def call(_represented, args)
12
- args[:camelize] ? @camelcase : @camelcase.underscore
12
+ args.fetch(:user_options, {})[:camelize] ? @camelcase : @camelcase.underscore
13
13
  end
14
14
  end
15
15
 
@@ -1,3 +1,3 @@
1
1
  module Octoparts
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -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/ma2gedev/octoparts-rb"
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.add_dependency "representable"
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
@@ -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.8
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: 2015-01-31 00:00:00.000000000 Z
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/ma2gedev/octoparts-rb
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: '0'
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.2.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