retentiongrid 0.0.2 → 0.0.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
  SHA1:
3
- metadata.gz: 5d20df15a78c63d358f0b952f55c8263f70c196f
4
- data.tar.gz: cb70219f52897bdca4f4a820b2aca9ed62359921
3
+ metadata.gz: d14ccffa70898ca564247f1dc473f7d0700656df
4
+ data.tar.gz: 863ca026f21076dbfdc2160e2013a59368069111
5
5
  SHA512:
6
- metadata.gz: 58bdd1a1a3bb3429cd815e8a24b5f1db78c454c54881215335a6932107dd79091657c9bb1511edef0fec8485e2535c273c15032d110db6c7d2bea5c9e0cb9f56
7
- data.tar.gz: 4f39e1f466d9905c4961e9c06044118cfee6521417abf6714f94de94167a3210850b7292512bde88e9aeaf1b476de2a27f948f27a03a71be29cd047249e8951d
6
+ metadata.gz: a227260d2f69698102936877599a643e3353a3c2e8463ea1ffa66a4c33fad96592f7488089e44a7cb6828f1abe83c352b3df50267977edd794035e386671f2f1
7
+ data.tar.gz: ae9218373d08d1e344b8896b29e973d252e3540770b7d4368bb7d825c1bf56e88b4952bfc89fb50128a347d6a409a36d9da6d340ef0654f591560b84862922c4
@@ -11,8 +11,12 @@ module Retentiongrid
11
11
  class Api
12
12
  include HTTParty
13
13
 
14
+ # Test
15
+ # base_uri 'http://retentiongrid.apiary-mock.com'
16
+
17
+ # Production
14
18
  base_uri 'https://app.retentiongrid.com/api'
15
- headers 'Accept' => 'application/json'
19
+ headers 'Content-type' => 'application/json'
16
20
  logger ::Logger.new("log/httparty.log"), :debug, :curl
17
21
 
18
22
 
@@ -22,13 +26,13 @@ module Retentiongrid
22
26
  default_params token: api_key
23
27
  end
24
28
 
25
- def get_with_response_check(path, options={}, &block)
26
- check_response_codes(get_without_response_check(path, options={}, &block))
29
+ def get_with_response_check(*args)
30
+ check_response_codes(*args))
27
31
  end
28
32
  alias_method_chain :get, :response_check
29
33
 
30
- def post_with_response_check(path, options={}, &block)
31
- check_response_codes(post_without_response_check(path, options={}, &block))
34
+ def post_with_response_check(*args)
35
+ check_response_codes(post_without_response_check(*args))
32
36
  end
33
37
  alias_method_chain :post, :response_check
34
38
 
@@ -39,7 +43,7 @@ module Retentiongrid
39
43
  def self.check_response_codes(response)
40
44
  body = response.body
41
45
  case response.code.to_i
42
- when 200 then return response
46
+ when 200..299 then return response
43
47
  when 400 then raise BadRequest.new(body)
44
48
  when 401 then raise Unauthorized.new(body)
45
49
  when 403 then raise Forbidden.new(body)
@@ -1,3 +1,3 @@
1
1
  module Retentiongrid
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retentiongrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Bünte