kounta_rest 0.0.7 → 0.0.8
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.
- data/lib/kounta.rb +1 -0
- data/lib/kounta/inventory.rb +8 -0
- data/lib/kounta/rest/client.rb +10 -3
- data/lib/kounta/site.rb +1 -0
- data/lib/kounta/version.rb +2 -2
- data/spec/fixtures/inventory.json +10 -0
- data/spec/kounta/kounta_spec.rb +1 -1
- data/spec/support/endpoints.rb +1 -0
- metadata +5 -2
data/lib/kounta.rb
CHANGED
data/lib/kounta/rest/client.rb
CHANGED
@@ -28,8 +28,6 @@ module Kounta
|
|
28
28
|
begin
|
29
29
|
log("#{request_method}: #{Kounta::SITE_URI}#{path_from_hash(url_hash)}.#{FORMAT.to_s} (#{options})")
|
30
30
|
response = @conn.request(request_method, "#{path_from_hash(url_hash)}.#{FORMAT.to_s}", options)
|
31
|
-
log("response:")
|
32
|
-
log("#{response.parsed}")
|
33
31
|
rescue OAuth2::Error => ex
|
34
32
|
if ex.message.include? 'The access token provided has expired'
|
35
33
|
log('oauth2 token expired, refreshing it...')
|
@@ -37,7 +35,16 @@ module Kounta
|
|
37
35
|
retry
|
38
36
|
end
|
39
37
|
end
|
40
|
-
|
38
|
+
|
39
|
+
log("response:")
|
40
|
+
|
41
|
+
if response
|
42
|
+
log("#{response.parsed}")
|
43
|
+
response.parsed
|
44
|
+
else
|
45
|
+
log('No response recieved')
|
46
|
+
nil
|
47
|
+
end
|
41
48
|
end
|
42
49
|
|
43
50
|
def objects_from_response(klass, request_method, url_hash, options={})
|
data/lib/kounta/site.rb
CHANGED
@@ -32,6 +32,7 @@ module Kounta
|
|
32
32
|
has_many :categories, Kounta::Category, {:company_id => :company_id}, lambda { |klass| {companies: klass.company_id, sites: klass.id, categories: nil} }
|
33
33
|
has_many :addresses, Kounta::Address, {:company_id => :company_id}, lambda { |klass| {companies: klass.company_id, sites: klass.id, addresses: nil} }
|
34
34
|
has_many :orders, Kounta::Order, {:company_id => :company_id}, lambda { |klass| {companies: klass.company_id, sites: klass.id, orders: nil} }
|
35
|
+
has_many :inventory, Kounta::Inventory, {:company_id => :company_id}, lambda { |klass| {companies: klass.company_id, sites: klass.id, inventory: nil} }
|
35
36
|
|
36
37
|
def resource_path
|
37
38
|
{companies: company_id, sites: id}
|
data/lib/kounta/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Kounta
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.8"
|
3
|
+
end
|
data/spec/kounta/kounta_spec.rb
CHANGED
data/spec/support/endpoints.rb
CHANGED
@@ -56,6 +56,7 @@ module Helpers
|
|
56
56
|
stub_request(:get, group_endpoint('taxes')).to_return(:body => load_json_from_fixture('taxes.json'), :headers => endpoint_headers)
|
57
57
|
stub_request(:get, singular_endpoint('orders')).to_return(:body => load_json_from_fixture('order.json'), :headers => endpoint_headers)
|
58
58
|
stub_request(:get, group_endpoint('orders')).to_return(:body => load_json_from_fixture('orders.json'), :headers => endpoint_headers)
|
59
|
+
stub_request(:get, group_endpoint('inventory')).to_return(:body => load_json_from_fixture('inventory.json'), :headers => endpoint_headers)
|
59
60
|
|
60
61
|
# update
|
61
62
|
stub_request(:put, singular_endpoint('products')).to_return(:body => load_json_from_fixture('product.json'), :headers => endpoint_headers)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kounta_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/kounta/company.rb
|
193
193
|
- lib/kounta/customer.rb
|
194
194
|
- lib/kounta/errors.rb
|
195
|
+
- lib/kounta/inventory.rb
|
195
196
|
- lib/kounta/line.rb
|
196
197
|
- lib/kounta/order.rb
|
197
198
|
- lib/kounta/payment.rb
|
@@ -211,6 +212,7 @@ files:
|
|
211
212
|
- spec/fixtures/companies_me.json
|
212
213
|
- spec/fixtures/customer.json
|
213
214
|
- spec/fixtures/customers.json
|
215
|
+
- spec/fixtures/inventory.json
|
214
216
|
- spec/fixtures/line.json
|
215
217
|
- spec/fixtures/order.json
|
216
218
|
- spec/fixtures/orders.json
|
@@ -274,6 +276,7 @@ test_files:
|
|
274
276
|
- spec/fixtures/companies_me.json
|
275
277
|
- spec/fixtures/customer.json
|
276
278
|
- spec/fixtures/customers.json
|
279
|
+
- spec/fixtures/inventory.json
|
277
280
|
- spec/fixtures/line.json
|
278
281
|
- spec/fixtures/order.json
|
279
282
|
- spec/fixtures/orders.json
|