ruby-jet 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jet/client.rb +5 -0
- data/lib/jet/client/products.rb +57 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b34d5f4ebcc67f0e93ca04823c9914f37d22b8e5
|
4
|
+
data.tar.gz: e1793bf65d33615b5e2eb9ce2fae91951eeea8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba15da8408fde0fce918b578d11b4c224cb02b025ac6d411eccffcbc02c91b03acfe3e11804f03119f5b38560ee4b2b6243a37318a9138339eed5169699c552
|
7
|
+
data.tar.gz: da5f98ae9fc711f98d37ad185067344865123d24c1b9c711c6ce3ab29e469c522941a17d8809011243938f41d4219ae54477c0eedd7f3bdb2b89707c1b837d76
|
data/lib/jet/client.rb
CHANGED
@@ -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.
|
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-
|
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:
|