apisync 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b45094cd8302949db5ed09514381ba31e9901ec4
4
- data.tar.gz: 99ba7178a22c9a1894a9ffac0b7ec9bbc5d72e70
3
+ metadata.gz: fc23769b3af6660acd3fd3ec681a42a228c870b5
4
+ data.tar.gz: fff67fcf588eba8b348293d113afec405d34dc51
5
5
  SHA512:
6
- metadata.gz: 9e54efe32dadb1fe4832132ffa6635c8f737042a74d218887af6d81ef5d6e46585fbc6e34a3e1e9d455f4c99e38d6af2651b193aee6bbb008c802575940e15d1
7
- data.tar.gz: e5da6cfb47427a575b9db484382e7f491471678193790e2716f3f13ca5c3478efc4c9193001958d9921b43344e8a7f4e50325ef0c6dfcc991ba2b4b953ad041b
6
+ metadata.gz: 7e173c52068549c1b42d78c3fdc846692c868fb19600551c50f5f77c64d06c69c403cb4331055f298575e363ca30cfe90f634764eac78b2b6eb877dba0a42177
7
+ data.tar.gz: 9b42649bd4417113dacd0197c0aaf038e327fefae363ba3a48000afe3d9fcf3711ad879c8c2319a8d848fddddb191aa68a14fa7cabd175c287e4cbb884c890e5
data/README.md CHANGED
@@ -48,6 +48,19 @@ Apisync.api_key = "my-key"
48
48
  client = Apisync.new
49
49
  ```
50
50
 
51
+ ### Responses
52
+
53
+ All HTTP calls return an
54
+ [HTTPart::Response](https://github.com/jnunemaker/httparty) instance:
55
+
56
+ ```ruby
57
+ response = client.inventory_items.save(attributes)
58
+ response.success? # => true
59
+ ```
60
+
61
+ In case too many requests are made simultaneously, the server will return
62
+ 429 and this lib will raise the `Apisync::TooManyRequests` exception.
63
+
51
64
  ## Development
52
65
 
53
66
  To run tests:
@@ -1,3 +1,3 @@
1
1
  class Apisync
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/apisync.rb CHANGED
@@ -10,20 +10,28 @@ require "apisync/http/query_string"
10
10
 
11
11
  class Apisync
12
12
  @@api_key = nil
13
+ @@host = nil
13
14
 
14
15
  def initialize(api_key: nil)
15
16
  @api_key = api_key || @@api_key
17
+ @host = @@host
16
18
 
17
19
  raise ArgumentError, "missing keyword: api_key" if @api_key.nil?
18
20
  end
19
21
 
20
22
  def method_missing(name, args = {}, &block)
21
23
  # overrides the instance api_key as `authorization`
22
- options = args.merge(api_key: @api_key)
24
+ options = {
25
+ host: @host
26
+ }.merge(args).merge(api_key: @api_key)
23
27
  Apisync::Resource.new(name, options)
24
28
  end
25
29
 
26
- def self.api_key=(key)
27
- @@api_key = key
30
+ def self.host=(value)
31
+ @@host = host
32
+ end
33
+
34
+ def self.api_key=(value)
35
+ @@api_key = value
28
36
  end
29
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apisync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre de Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty