unleashed 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/unleashed/client.rb +15 -1
- data/lib/unleashed/error.rb +1 -1
- data/lib/unleashed/resources/currency_resource.rb +1 -1
- data/lib/unleashed/resources/customer_resource.rb +3 -4
- data/lib/unleashed/resources/invoice_resource.rb +0 -1
- data/lib/unleashed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 463d518bf60dce8a899f4e616d0b2ae0ec2ac76555fd575cd0dfa192eb412224
|
4
|
+
data.tar.gz: 29778dc4c4361ab5eb12e99a455cc27ffa04b9fdbe1bd09f663956a2155ec1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a6480f14abac43480273813a643e37e109625e817cbf84bfcb830cc196714d05ffe68773ecf0abf24450146b4d43f60cebcd55dfd7e4a828a31c7ea4c54d6c'
|
7
|
+
data.tar.gz: 2294e7540617305b2caa36b061a9644a5b1fc36b8d345fb8a612615f1107d116184b3ac6509b7d6224b27ddfde0d9248fe808abaa5ccaf6f93492a352a625573
|
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,16 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.1.15] - 2020-02-26
|
6
|
+
|
7
|
+
- Update and fix bugs for `client`, `currency`, `customer`, `invoice` resources.
|
8
|
+
- Show status code in error messge.
|
9
|
+
- Print request info to debug easier.
|
10
|
+
|
5
11
|
## [0.1.14] - 2020-02-23
|
6
12
|
|
7
13
|
- Update options, queries, comments of `currencies`, `customers`, `invoices`, `payment terms`.
|
8
|
-
- Replace `create` method by `create_or_update` method of `customers
|
14
|
+
- Replace `create` method by `create_or_update` method of `customers`.
|
9
15
|
|
10
16
|
## [0.1.13] - 2019-12-05
|
11
17
|
|
data/lib/unleashed/client.rb
CHANGED
@@ -60,6 +60,7 @@ module Unleashed
|
|
60
60
|
request.headers['Content-Type'] = 'application/json'
|
61
61
|
request.headers['api-auth-id'] = @api_id
|
62
62
|
request.headers['api-auth-signature'] = signature(request.params.to_query)
|
63
|
+
request
|
63
64
|
end
|
64
65
|
|
65
66
|
# Make a HTTP GET request
|
@@ -73,12 +74,18 @@ module Unleashed
|
|
73
74
|
request.params = parameters
|
74
75
|
|
75
76
|
# Set headers
|
76
|
-
init_default_headers(request)
|
77
|
+
request = init_default_headers(request)
|
77
78
|
|
78
79
|
# Assign more custom headers
|
79
80
|
headers.each do |key, value|
|
80
81
|
request.headers[key] = value
|
81
82
|
end
|
83
|
+
|
84
|
+
# Print log
|
85
|
+
time = Time.zone.now.strftime('%Y-%m-%d %H:%M:%S %z')
|
86
|
+
puts "[#{time}] Client -- : HEADERS #{request.headers}"
|
87
|
+
puts "[#{time}] Client -- : GET #{request.path}"
|
88
|
+
puts "[#{time}] Client -- : PARAMS #{request.params}"
|
82
89
|
end
|
83
90
|
|
84
91
|
on_complete(response) unless skip_status_check
|
@@ -103,6 +110,13 @@ module Unleashed
|
|
103
110
|
end
|
104
111
|
|
105
112
|
request.body = parameters.to_json
|
113
|
+
|
114
|
+
# Print log
|
115
|
+
time = Time.zone.now.strftime('%Y-%m-%d %H:%M:%S %z')
|
116
|
+
puts "[#{time}] Client -- : HEADERS #{request.headers}"
|
117
|
+
puts "[#{time}] Client -- : POST #{request.path}"
|
118
|
+
puts "[#{time}] Client -- : PARAMS #{request.params}"
|
119
|
+
puts "[#{time}] Client -- : BODY #{request.body}"
|
106
120
|
end
|
107
121
|
|
108
122
|
on_complete(response) unless skip_status_check
|
data/lib/unleashed/error.rb
CHANGED
@@ -41,7 +41,7 @@ module Unleashed
|
|
41
41
|
@response.body
|
42
42
|
else
|
43
43
|
json_response = JSON.parse(@response.body)
|
44
|
-
message =
|
44
|
+
message = "[StatusCode=#{@response.status}] - "
|
45
45
|
message << json_response['description'] if json_response.key?('description')
|
46
46
|
message << json_response['Description'] if json_response.key?('Description')
|
47
47
|
|
@@ -13,7 +13,7 @@ module Unleashed
|
|
13
13
|
# @return [Array<Unleashed::Currency>] List all currencies.
|
14
14
|
def all
|
15
15
|
endpoint = 'Currencies'
|
16
|
-
response = JSON.parse(@client.get(endpoint
|
16
|
+
response = JSON.parse(@client.get(endpoint).body)
|
17
17
|
currencies = response.key?('Items') ? response['Items'] : []
|
18
18
|
currencies.map { |attributes| Unleashed::Currency.new(@client, attributes) }
|
19
19
|
end
|
@@ -37,7 +37,6 @@ module Unleashed
|
|
37
37
|
# Handle Page option
|
38
38
|
if params[:Page].present?
|
39
39
|
endpoint << "/#{params[:Page]}"
|
40
|
-
params.delete :Page
|
41
40
|
end
|
42
41
|
|
43
42
|
response = JSON.parse(@client.get(endpoint, params).body)
|
@@ -48,11 +47,11 @@ module Unleashed
|
|
48
47
|
# Get a single customer
|
49
48
|
# /Customers/E6E8163F-6911-40e9-B740-90E5A0A3A996 - returns details of a particular customer.
|
50
49
|
#
|
51
|
-
# @param
|
50
|
+
# @param guid [String] customer ID.
|
52
51
|
#
|
53
52
|
# @return [Unleashed::Customer]
|
54
|
-
def find(
|
55
|
-
endpoint = "Customers/#{
|
53
|
+
def find(guid)
|
54
|
+
endpoint = "Customers/#{guid}"
|
56
55
|
response = JSON.parse(@client.get(endpoint).body)
|
57
56
|
Unleashed::Customer.new(@client, response)
|
58
57
|
end
|
data/lib/unleashed/version.rb
CHANGED