unfor_base_api 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/unfor_base_api.rb +10 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f67bffd57838f98e5a942c7419b6fd436fad6d92
4
- data.tar.gz: b6bf398d5f43caf23e2a4e3cec21e659e3acb94d
3
+ metadata.gz: 31e95a3550011bad45552f23bae6e3e2a1ecebb4
4
+ data.tar.gz: 9ae5c94097cacf519729ad91efc9ad93fb728c00
5
5
  SHA512:
6
- metadata.gz: 78a9516e4db672f8c47b9bdb064a41afd534c22e42801c4d83de396ebb35fddb564c58e4987a73143e28b33f13eb13947e4387f6fe5969418715284fbda89c9d
7
- data.tar.gz: 9ec6e80eea9114db758fcd5386c9cab0315c20c0d8b817592fe566d171ef7a4740df60c5ddf105d8335dfd88d56897b97860659380eaf5d64f3a8d7d24164cc5
6
+ metadata.gz: b0aa10abd265c413f387989b6bba19112963f0ceb0e211df2298d20eb76e5d9d76577382870d524b72fad241f36ff761ea3a3b3f7f15aa4d8d381db463843741
7
+ data.tar.gz: 9fc69ff3dae8fab46853cf4b421502a610eb1a496ea407cb9fef6323c5839f1c7deabd0036d15084e8022ac6032afdfa9f5e3ffed83e6430ad2e46f35a2e5ae8
data/CHANGELOG.md CHANGED
@@ -9,3 +9,7 @@
9
9
  ## v0.3
10
10
 
11
11
  * Added missing requires
12
+
13
+ ## v0.4
14
+
15
+ * Bugfixes
@@ -8,6 +8,10 @@ class UnforBaseApi
8
8
  def initialize(args={})
9
9
  @endpoint = args[:endpoint]
10
10
  @access_token = args[:access_token]
11
+
12
+ if @endpoint.blank?
13
+ raise 'endpoint is required!'
14
+ end
11
15
  end
12
16
 
13
17
  def last_response
@@ -23,7 +27,7 @@ class UnforBaseApi
23
27
  def get_request(action, params={}, headers={})
24
28
  begin
25
29
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
26
- response = RestClient.get("#{@endpoint_url}#{action}", {params: params}.merge(headers))
30
+ response = RestClient.get("#{@endpoint}#{action}", {params: params}.merge(headers))
27
31
  parse_response(get_response_kind(headers), response)
28
32
  rescue => e
29
33
  parse_response('object', e.response)
@@ -33,7 +37,7 @@ class UnforBaseApi
33
37
  def post_request(action, params={}, headers={})
34
38
  begin
35
39
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
36
- response = RestClient.post("#{@endpoint_url}#{action}", params, headers)
40
+ response = RestClient.post("#{@endpoint}#{action}", params, headers)
37
41
  parse_response(get_response_kind(headers), response)
38
42
  rescue => e
39
43
  parse_response('object', e.response)
@@ -43,7 +47,7 @@ class UnforBaseApi
43
47
  def put_request(action, params={}, headers={})
44
48
  begin
45
49
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
46
- response = RestClient.put("#{@endpoint_url}#{action}", params, headers)
50
+ response = RestClient.put("#{@endpoint}#{action}", params, headers)
47
51
  parse_response(get_response_kind(headers), response)
48
52
  rescue => e
49
53
  parse_response('object', e.response)
@@ -53,7 +57,7 @@ class UnforBaseApi
53
57
  def patch_request(action, params={}, headers={})
54
58
  begin
55
59
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
56
- response = RestClient.patch("#{@endpoint_url}#{action}", params, headers)
60
+ response = RestClient.patch("#{@endpoint}#{action}", params, headers)
57
61
  parse_response(get_response_kind(headers), response)
58
62
  rescue => e
59
63
  parse_response('object', e.response)
@@ -63,7 +67,7 @@ class UnforBaseApi
63
67
  def head_request(action, params={}, headers={})
64
68
  begin
65
69
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
66
- response = RestClient.head("#{@endpoint_url}#{action}", params)
70
+ response = RestClient.head("#{@endpoint}#{action}", params)
67
71
  parse_response(get_response_kind(headers), response)
68
72
  rescue => e
69
73
  parse_response('object', e.response)
@@ -73,7 +77,7 @@ class UnforBaseApi
73
77
  def delete_request(action, params={}, headers={})
74
78
  begin
75
79
  headers.merge!({ authorization: "Token token=\"#{@access_token}\"" })
76
- response = RestClient.delete("#{@endpoint_url}#{action}", params)
80
+ response = RestClient.delete("#{@endpoint}#{action}", params)
77
81
  parse_response(get_response_kind(headers), response)
78
82
  rescue => e
79
83
  parse_response('object', e.response)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unfor_base_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick