ruby-jet 0.1.0 → 0.2.0

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: e962bc47649ce4576b0c1bbafbbe8f93e14170a8
4
- data.tar.gz: 291f440df4fd0fda198a0a1737ee3f2838413fc4
3
+ metadata.gz: b34d5f4ebcc67f0e93ca04823c9914f37d22b8e5
4
+ data.tar.gz: e1793bf65d33615b5e2eb9ce2fae91951eeea8b5
5
5
  SHA512:
6
- metadata.gz: 2d24f34ed23fe4926b1fa0b1f8a938c817e873b158c04b39ad549ce38e86f4df9430d68fa4c7edcbc7261b993077fefdd5586c73032ec9ae3cbb87387822a676
7
- data.tar.gz: a09bf17cc7c06dfdf52ba4e5f2a9da165c2771dca5d6c9283d8a4cae9ea61e1e7af46d9c5d9b79e8493e3b991c9a46827269ceac0b0761af084813e0d262b0a8
6
+ metadata.gz: bba15da8408fde0fce918b578d11b4c224cb02b025ac6d411eccffcbc02c91b03acfe3e11804f03119f5b38560ee4b2b6243a37318a9138339eed5169699c552
7
+ data.tar.gz: da5f98ae9fc711f98d37ad185067344865123d24c1b9c711c6ce3ab29e469c522941a17d8809011243938f41d4219ae54477c0eedd7f3bdb2b89707c1b837d76
data/lib/jet/client.rb CHANGED
@@ -33,7 +33,12 @@ class Jet::Client
33
33
  def returns
34
34
  Returns.new(self)
35
35
  end
36
+
37
+ def products
38
+ Products.new(self)
39
+ end
36
40
  end
37
41
 
38
42
  require 'jet/client/orders'
39
43
  require 'jet/client/returns'
44
+ require 'jet/client/products'
@@ -0,0 +1,57 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+
4
+ class Jet::Client::Products
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def update_inventory(merchant_sku, body = {})
10
+ headers = @client.token
11
+ response = RestClient.put("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}/inventory", body.to_json, headers)
12
+ JSON.parse(response.body) if response.code == 200
13
+ end
14
+
15
+ def get_inventory(merchant_sku)
16
+ headers = @client.token
17
+ response = RestClient.get("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}/inventory", headers)
18
+ JSON.parse(response.body) if response.code == 200
19
+ end
20
+
21
+ def update_product(merchant_sku, body = {})
22
+ headers = @client.token
23
+ response = RestClient.put("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}", body.to_json, headers)
24
+ JSON.parse(response.body) if response.code == 200
25
+ end
26
+
27
+ def get_product(merchant_sku)
28
+ headers = @client.token
29
+ response = RestClient.get("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}", headers)
30
+ JSON.parse(response.body) if response.code == 200
31
+ end
32
+
33
+ def update_price(merchant_sku, body = {})
34
+ headers = @client.token
35
+ response = RestClient.put("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}/price", body.to_json, headers)
36
+ JSON.parse(response.body) if response.code == 200
37
+ end
38
+
39
+ def get_price(merchant_sku)
40
+ headers = @client.token
41
+ response = RestClient.get("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}/price", headers)
42
+ JSON.parse(response.body) if response.code == 200
43
+ end
44
+
45
+ def update_image(merchant_sku, body = {})
46
+ headers = @client.token
47
+ response = RestClient.put("#{Jet::Client::API_URL}/merchant-skus/#{merchant_sku}/image", body.to_json, headers)
48
+ JSON.parse(response.body) if response.code == 200
49
+ end
50
+
51
+ def get_products(params = {})
52
+ headers = @client.token
53
+ response = RestClient.get("#{Jet::Client::API_URL}/merchant-skus", headers.merge({ params: params }))
54
+ JSON.parse(response.body) if response.code == 200
55
+ end
56
+ end
57
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Wells
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -41,6 +41,7 @@ dependencies:
41
41
  description: Jet API service calls implemented in Ruby
42
42
  email:
43
43
  - flipstock@gmail.com
44
+ - jason@iserveproducts.com
44
45
  executables: []
45
46
  extensions: []
46
47
  extra_rdoc_files: []
@@ -50,6 +51,7 @@ files:
50
51
  - lib/jet.rb
51
52
  - lib/jet/client.rb
52
53
  - lib/jet/client/orders.rb
54
+ - lib/jet/client/products.rb
53
55
  - lib/jet/client/returns.rb
54
56
  homepage: https://github.com/jasonwells/ruby-jet
55
57
  licenses: