rickai 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 292ab7b66564ccc75c4b98adaf90773d7f23acb8df15a05a181f3d56e9aae628
4
- data.tar.gz: 0e9d2df8aee2b8d34a50cc1d85c9fdc6b7f56d9b856c2c981288e92a5e00062a
3
+ metadata.gz: a7ef9dc7861a9e3534c118e0a07ffbb7a2387e77e0c7b175c528aebeb11f3577
4
+ data.tar.gz: 225674fbe8b0776e0fc8ef83e8a2dae07b0f27889282952cdd07be9085bb3f1d
5
5
  SHA512:
6
- metadata.gz: 7c9bb18de470aff08f40c6fd55915d3c884aef070f0683d1d40dda84e4b793387c7eb246ebc35afcce69fd245c1fdcf3790dc654a7a35731ed7266ab5d555cb7
7
- data.tar.gz: 13d62cad122062136eca83ae76e137a81db26943b5c35af43cc78cb4184483337a7fd94fd65217a5b0e2101dc47b11106cb8e07e8440ba561490ac9a3867a5a0
6
+ metadata.gz: 7f00050fb8538e12ba9c9246db9d352fa4e3dfdd78af36b4ec45f20188ea87d2a191f61e629d5e9bd35efb48c23c2298f9bd9f696dcb4e6e90ef290252ccb128
7
+ data.tar.gz: 4a7586d2ee2380766be6cc6b1f16c1b163c9ef9b3d77e06552874f457749a80e502f449438416ac1d26018fba430748067f56c84509380fadf5efc77bf5395fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rickai (0.1.2)
4
+ rickai (0.1.3)
5
5
  multi_json (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -44,7 +44,7 @@ client.check(your_attributes)
44
44
  ## Contributing
45
45
 
46
46
  1. Fork it
47
- 2. Clone your fork (git clone git@github.com:MY_USERNAME/customerio-ruby.git && cd customerio-ruby)
47
+ 2. Clone your fork (git clone git@github.com:MY_USERNAME/rickai.git && cd rickai)
48
48
  3. Create your feature branch (git checkout -b my-new-feature)
49
49
  4. Commit your changes (git commit -am 'Added some feature')
50
50
  5. Push to the branch (git push origin my-new-feature)
data/lib/rickai/client.rb CHANGED
@@ -2,7 +2,7 @@ require 'net/http'
2
2
  require 'multi_json'
3
3
 
4
4
  module Rickai
5
- DEFAULT_BASE_URI = 'https://exchange.rick.ai'
5
+ DEFAULT_BASE_URI = 'https://exchange.rick.ai'.freeze
6
6
  DEFAULT_TIMEOUT = 10
7
7
 
8
8
  class Client
@@ -44,7 +44,7 @@ module Rickai
44
44
  if response.code.to_i >= 200 && response.code.to_i < 300
45
45
  response
46
46
  else
47
- raise InvalidResponse.new("Rick.ai API returned an invalid response: #{response.code} - #{response.message}")
47
+ raise InvalidResponse, "Rick.ai API returned an invalid response: #{response.code} - #{response.message}"
48
48
  end
49
49
  end
50
50
 
@@ -62,8 +62,14 @@ module Rickai
62
62
  req.add_field('Content-Type', 'application/json')
63
63
 
64
64
  unless body.nil?
65
- attributes = Hash[body.map { |(k, v)| [k.to_sym, v] }]
66
- req.body = MultiJson.dump(attributes) unless body.nil?
65
+ attributes =
66
+ if body.is_a?(Hash)
67
+ Hash[body.map { |(k, v)| [k.to_sym, v] }]
68
+ else
69
+ body.map { |item| Hash[item.map { |(k, v)| [k.to_sym, v] }] }
70
+ end
71
+
72
+ req.body = MultiJson.dump(attributes)
67
73
  end
68
74
 
69
75
  session.start do |http|
@@ -1,3 +1,3 @@
1
1
  module Rickai
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rickai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Zagorskii
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json