ruby-jet 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +138 -2
- data/lib/jet.rb +2 -1
- data/lib/jet/client.rb +62 -61
- data/lib/jet/client/files.rb +30 -27
- data/lib/jet/client/orders.rb +48 -39
- data/lib/jet/client/products.rb +40 -37
- data/lib/jet/client/refunds.rb +24 -22
- data/lib/jet/client/returns.rb +26 -25
- data/lib/jet/client/taxonomy.rb +18 -15
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db850f74e0007fcc41c09b46400d3f26d207523
|
4
|
+
data.tar.gz: 2a956bf74af51e4d5ccc75e28cc0888b0381577c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b163f3737566ed9da2c04bc4df4ca8cb7a4a28af77f015cc97fe83c80e9aa09f111e0bfc396649a332d4cf2f733fd006c281ff8f7af70cb217c237b89a4d463
|
7
|
+
data.tar.gz: 7bfae3a5ebe4e3c086da02f187bfa587776777cdd7d62d7746c8d876e748e5994f84ae99dff387c25802a74ddb646e3bbade83d134a539e4eb2dcf7e783ac8e4
|
data/README.md
CHANGED
@@ -3,8 +3,144 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/jasonwells/ruby-jet.svg)](https://travis-ci.org/jasonwells/ruby-jet)
|
4
4
|
[![CircleCI](https://circleci.com/gh/jasonwells/ruby-jet.svg?style=shield)](https://circleci.com/gh/jasonwells/ruby-jet)
|
5
5
|
[![Dependency Status](https://gemnasium.com/jasonwells/ruby-jet.svg)](https://gemnasium.com/jasonwells/ruby-jet)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/jasonwells/ruby-jet/badges/gpa.svg)](https://codeclimate.com/github/jasonwells/ruby-jet)
|
7
|
-
[![Test Coverage](https://codeclimate.com/github/jasonwells/ruby-jet/badges/coverage.svg)](https://codeclimate.com/github/jasonwells/ruby-jet/coverage)
|
8
6
|
[![Gem Version](https://badge.fury.io/rb/ruby-jet.svg)](https://badge.fury.io/rb/ruby-jet)
|
9
7
|
|
10
8
|
[Jet API](https://developer.jet.com/) service calls implemented in Ruby.
|
9
|
+
|
10
|
+
## Basic Usage
|
11
|
+
|
12
|
+
require 'Jet'
|
13
|
+
|
14
|
+
jet_client = Jet.client(merchant_id: 'your_merch_id', api_user: 'your_api_user', secret: 'your_secret')
|
15
|
+
|
16
|
+
## Products
|
17
|
+
[Jet Products API](https://developer.jet.com/docs/merchant-sku)
|
18
|
+
|
19
|
+
Product Attributes
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
attrs = {
|
23
|
+
product_title: 'My Product',
|
24
|
+
ASIN: '12345ABCDE',
|
25
|
+
brand: "My Product's Brand",
|
26
|
+
manufacturer: "My Product's Manufacturer",
|
27
|
+
main_image_url: 'https://c2.q-assets.com/images/products/p/asj/asj-077_1z.jpg',
|
28
|
+
bullets: [ 'This is bullet line 1',
|
29
|
+
'This is bullet line 2',
|
30
|
+
],
|
31
|
+
product_description: 'This is a terrific product that everyone should own.',
|
32
|
+
multipack_quantity: 1
|
33
|
+
}
|
34
|
+
```
|
35
|
+
|
36
|
+
Call products.update_product to add a new product or update an existing one.
|
37
|
+
If the SKU is new, a new product will be created.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
response = jet_client.products.update_product('MyNewSku123', attrs)
|
41
|
+
```
|
42
|
+
|
43
|
+
Retrieve an existing product
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
product = jet_client.products.get_product('MyNewSku123')
|
47
|
+
```
|
48
|
+
|
49
|
+
Set the price on a product
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
response = jet_client.products.update_price('MyNewSku123', price: 30.95)
|
53
|
+
```
|
54
|
+
|
55
|
+
Update the inventory
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
response = jet_client.products.update_inventory(
|
59
|
+
'MyNewSku123',
|
60
|
+
fulfillment_nodes: [
|
61
|
+
{ fulfillment_node_id: 'node1234', quantity: 100 },
|
62
|
+
{ fulfillment_node_id: 'node5678', quantity: 20 }
|
63
|
+
]
|
64
|
+
)
|
65
|
+
```
|
66
|
+
|
67
|
+
## Retrieve Orders
|
68
|
+
[Jet Orders API](https://developer.jet.com/docs/order-status)
|
69
|
+
|
70
|
+
get_orders defaults to 'ready' status
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
response = jet_client.orders.get_orders
|
74
|
+
ready_orders = response['order_urls']
|
75
|
+
```
|
76
|
+
|
77
|
+
Retrieve acknowledged orders
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
response = jet_client.orders.get_orders(:acknowledged)
|
81
|
+
acknowledged_orders = response['order_urls']
|
82
|
+
```
|
83
|
+
|
84
|
+
Other status options are:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
:created
|
88
|
+
:ready
|
89
|
+
:acknowledged
|
90
|
+
:inprogress
|
91
|
+
:complete
|
92
|
+
```
|
93
|
+
|
94
|
+
Retrieve a specific order
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
order_url = ready_orders.first
|
98
|
+
order = jet_client.orders.get_order(order_url)
|
99
|
+
```
|
100
|
+
|
101
|
+
## Acknowledge an Order
|
102
|
+
[Jet Acknowledge Order API](https://developer.jet.com/docs/acknowledge-order)
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
jet_order_id = order['merchant_order_id']
|
106
|
+
response = jet_client.orders.acknowledge_order(
|
107
|
+
jet_order_id,
|
108
|
+
acknowledgement_status: 'accepted',
|
109
|
+
alt_order_id: '232145', # optional
|
110
|
+
order_items: [
|
111
|
+
{ order_item_acknowledgement_status: 'fulfillable',
|
112
|
+
order_item_id: 'b81f073b18f548b892f6d4497af16297',
|
113
|
+
alt_order_item_id: '554443322' # optional
|
114
|
+
}
|
115
|
+
]
|
116
|
+
)
|
117
|
+
```
|
118
|
+
|
119
|
+
Mark Order as shipped
|
120
|
+
[Jet Ship Order API](https://developer.jet.com/docs/ship-order)
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
response = jet_client.orders.ship_order(
|
124
|
+
jet_order_id,
|
125
|
+
alt_order_id: '232145', # optional
|
126
|
+
shipments: [
|
127
|
+
{
|
128
|
+
alt_shipment_id: '11223344', #optional
|
129
|
+
shipment_tracking_number: '1Z12342452342',
|
130
|
+
response_shipment_date: 0.days.from_now,
|
131
|
+
response_shipment_method: 'ups_ground',
|
132
|
+
expected_delivery_date: 4.days.from_now,
|
133
|
+
ship_from_zip_code: '12061',
|
134
|
+
carrier_pick_up_date: 1.days.from_now,
|
135
|
+
carrier: 'UPS',
|
136
|
+
shipment_items: [
|
137
|
+
{ shipment_item_id: '76-s2507-i1810',
|
138
|
+
alt_shipment_item_id: '129900120', # optional
|
139
|
+
merchant_sku: 'MyNewSku123',
|
140
|
+
response_shipment_sku_quantity: 1
|
141
|
+
}
|
142
|
+
]
|
143
|
+
}
|
144
|
+
]
|
145
|
+
)
|
146
|
+
```
|
data/lib/jet.rb
CHANGED
data/lib/jet/client.rb
CHANGED
@@ -1,80 +1,80 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'oj'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Oj.dump(data, mode: :compat)
|
15
|
-
end
|
4
|
+
module Jet
|
5
|
+
# Jet API Client
|
6
|
+
class Client
|
7
|
+
API_URL = 'https://merchant-api.jet.com/api'.freeze
|
8
|
+
|
9
|
+
def initialize(config = {})
|
10
|
+
@api_user = config[:api_user]
|
11
|
+
@secret = config[:secret]
|
12
|
+
@merchant_id = config[:merchant_id]
|
13
|
+
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def encode_json(data)
|
16
|
+
Oj.dump(data, mode: :compat)
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
body = {
|
24
|
-
user: @api_user,
|
25
|
-
pass: @secret
|
26
|
-
}
|
27
|
-
response = RestClient.post("#{API_URL}/token", encode_json(body))
|
28
|
-
parsed_response = decode_json(response.body)
|
29
|
-
@id_token = parsed_response['id_token']
|
30
|
-
@token_type = parsed_response['token_type']
|
31
|
-
@expires_on = Time.parse(parsed_response['expires_on'])
|
19
|
+
def decode_json(json)
|
20
|
+
Oj.load(json)
|
32
21
|
end
|
33
22
|
|
34
|
-
|
35
|
-
|
23
|
+
def token
|
24
|
+
unless @id_token && @token_type && @expires_on > Time.now
|
25
|
+
body = { user: @api_user, pass: @secret }
|
26
|
+
response = RestClient.post("#{API_URL}/token", encode_json(body))
|
27
|
+
parsed_response = decode_json(response.body)
|
28
|
+
@id_token = parsed_response['id_token']
|
29
|
+
@token_type = parsed_response['token_type']
|
30
|
+
@expires_on = Time.parse(parsed_response['expires_on'])
|
31
|
+
end
|
32
|
+
|
33
|
+
{ Authorization: "#{@token_type} #{@id_token}" }
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
def rest_get_with_token(path, query_params = {})
|
37
|
+
headers = token
|
38
|
+
headers[:params] = query_params unless query_params.empty?
|
39
|
+
response = RestClient.get("#{API_URL}#{path}", headers)
|
40
|
+
decode_json(response.body) if response.code == 200
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
def rest_put_with_token(path, body = {})
|
44
|
+
headers = token
|
45
|
+
response = RestClient.put("#{API_URL}#{path}", encode_json(body), headers)
|
46
|
+
decode_json(response.body) if response.code == 200
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
def rest_post_with_token(path, body = {})
|
50
|
+
headers = token
|
51
|
+
response = RestClient.post("#{API_URL}#{path}", encode_json(body), headers)
|
52
|
+
decode_json(response.body) if response.code == 201
|
53
|
+
end
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
def orders
|
56
|
+
Orders.new(self)
|
57
|
+
end
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
def returns
|
60
|
+
Returns.new(self)
|
61
|
+
end
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
def products
|
64
|
+
Products.new(self)
|
65
|
+
end
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
def taxonomy
|
68
|
+
Taxonomy.new(self)
|
69
|
+
end
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
def files
|
72
|
+
Files.new(self)
|
73
|
+
end
|
75
74
|
|
76
|
-
|
77
|
-
|
75
|
+
def refunds
|
76
|
+
Refunds.new(self)
|
77
|
+
end
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -84,3 +84,4 @@ require 'jet/client/products'
|
|
84
84
|
require 'jet/client/taxonomy'
|
85
85
|
require 'jet/client/files'
|
86
86
|
require 'jet/client/refunds'
|
87
|
+
require 'jet/client/returns'
|
data/lib/jet/client/files.rb
CHANGED
@@ -1,36 +1,39 @@
|
|
1
|
-
require 'rest-client'
|
2
|
-
require 'oj'
|
3
1
|
require 'zlib'
|
4
2
|
require 'stringio'
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module Jet
|
5
|
+
class Client
|
6
|
+
# Files client
|
7
|
+
class Files
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def upload_token
|
13
|
+
@client.rest_get_with_token('/files/uploadToken')
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def file_upload(url, body)
|
17
|
+
headers = { 'x-ms-blob-type' => 'blockblob' }
|
18
|
+
io = StringIO.new
|
19
|
+
gz = Zlib::GzipWriter.new(io)
|
20
|
+
gz.write(body)
|
21
|
+
gz.close
|
22
|
+
gzipped_body = io.string
|
23
|
+
response = RestClient.put(url, gzipped_body, headers)
|
24
|
+
@client.decode_json(response.body) if response.code == 200
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def uploaded_files(url, file_type, file_name)
|
28
|
+
headers = @client.token
|
29
|
+
body = { url: url, file_type: file_type, file_name: file_name }
|
30
|
+
response = RestClient.post("#{Jet::Client::API_URL}/files/uploaded", @client.encode_json(body), headers)
|
31
|
+
@client.decode_json(response.body) if response.code == 200
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
def jet_file_id(file_id)
|
35
|
+
@client.rest_get_with_token("/files/#{file_id}")
|
36
|
+
end
|
37
|
+
end
|
35
38
|
end
|
36
39
|
end
|
data/lib/jet/client/orders.rb
CHANGED
@@ -1,41 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
1
|
+
module Jet
|
2
|
+
class Client
|
3
|
+
# Orders client
|
4
|
+
class Orders
|
5
|
+
STATUSES = {
|
6
|
+
created: 'created',
|
7
|
+
ready: 'ready',
|
8
|
+
acknowledged: 'acknowledged',
|
9
|
+
inprogress: 'inprogress',
|
10
|
+
complete: 'complete'
|
11
|
+
}
|
12
|
+
|
13
|
+
def initialize(client)
|
14
|
+
@client = client
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_orders(status = :ready, params = {})
|
18
|
+
query_status = STATUSES[status]
|
19
|
+
@client.rest_get_with_token("/orders/#{query_status}", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_order(order_url)
|
23
|
+
@client.rest_get_with_token(order_url)
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_order_by_id(order_id)
|
27
|
+
@client.rest_get_with_token("/orders/withoutShipmentDetail/#{order_id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def acknowledge_order(order_id, body = {})
|
31
|
+
@client.rest_put_with_token("/orders/#{order_id}/acknowledge", body)
|
32
|
+
end
|
33
|
+
|
34
|
+
def ship_order(order_id, body = {})
|
35
|
+
@client.rest_put_with_token("/orders/#{order_id}/shipped", body)
|
36
|
+
end
|
37
|
+
|
38
|
+
def tag_order(order_id, tag)
|
39
|
+
body = { tag: tag } if tag
|
40
|
+
@client.rest_put_with_token("/orders/#{order_id}/tag", body)
|
41
|
+
end
|
42
|
+
|
43
|
+
def check_for_tagged_orders(status, tag, with_tag = true)
|
44
|
+
query_status = STATUSES[status]
|
45
|
+
query_with_tag = with_tag ? true : false
|
46
|
+
@client.rest_get_with_token("/orders/#{query_status}/#{tag}/#{query_with_tag}")
|
47
|
+
end
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
data/lib/jet/client/products.rb
CHANGED
@@ -1,39 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
1
|
+
module Jet
|
2
|
+
class Client
|
3
|
+
# Products client
|
4
|
+
class Products
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def update_inventory(merchant_sku, body = {})
|
10
|
+
@client.rest_put_with_token("/merchant-skus/#{merchant_sku}/inventory", body)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_inventory(merchant_sku)
|
14
|
+
@client.rest_get_with_token("/merchant-skus/#{merchant_sku}/inventory")
|
15
|
+
end
|
16
|
+
|
17
|
+
def update_product(merchant_sku, body = {})
|
18
|
+
@client.rest_put_with_token("/merchant-skus/#{merchant_sku}", body)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_product(merchant_sku)
|
22
|
+
@client.rest_get_with_token("/merchant-skus/#{merchant_sku}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_price(merchant_sku, body = {})
|
26
|
+
@client.rest_put_with_token("/merchant-skus/#{merchant_sku}/price", body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_price(merchant_sku)
|
30
|
+
@client.rest_get_with_token("/merchant-skus/#{merchant_sku}/price")
|
31
|
+
end
|
32
|
+
|
33
|
+
def update_image(merchant_sku, body = {})
|
34
|
+
@client.rest_put_with_token("/merchant-skus/#{merchant_sku}/image", body)
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_products(params = {})
|
38
|
+
@client.rest_get_with_token('/merchant-skus', params)
|
39
|
+
end
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
data/lib/jet/client/refunds.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
|
-
|
1
|
+
module Jet
|
2
|
+
class Client
|
3
|
+
# Refunds client
|
4
|
+
class Refunds
|
5
|
+
STATUSES = {
|
6
|
+
created: 'created',
|
7
|
+
processing: 'processing',
|
8
|
+
accepted: 'accepted',
|
9
|
+
rejected: 'rejected'
|
10
|
+
}.freeze
|
2
11
|
|
3
|
-
|
12
|
+
def initialize(client)
|
13
|
+
@client = client
|
14
|
+
end
|
4
15
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
accepted: 'accepted',
|
9
|
-
rejected: 'rejected',
|
10
|
-
}
|
16
|
+
def create_merchant_initiated_refund(order_id, alt_refund_id, body = {})
|
17
|
+
@client.rest_post_with_token("/refunds/#{order_id}/#{alt_refund_id}", body)
|
18
|
+
end
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def create_merchant_initiated_refund(order_id, alt_refund_id, body = {})
|
17
|
-
@client.rest_post_with_token("/refunds/#{order_id}/#{alt_refund_id}", body)
|
18
|
-
end
|
19
|
-
|
20
|
-
def check_refund_state(refund_authorization_id)
|
21
|
-
@client.rest_get_with_token("/refunds/state/#{refund_authorization_id}")
|
22
|
-
end
|
20
|
+
def check_refund_state(refund_authorization_id)
|
21
|
+
@client.rest_get_with_token("/refunds/state/#{refund_authorization_id}")
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def check_for_created_refunds(status)
|
25
|
+
query_status = STATUSES[status]
|
26
|
+
@client.rest_get_with_token("/refunds/#{query_status}")
|
27
|
+
end
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/jet/client/returns.rb
CHANGED
@@ -1,32 +1,33 @@
|
|
1
|
-
|
1
|
+
module Jet
|
2
|
+
class Client
|
3
|
+
# Returns client
|
4
|
+
class Returns
|
5
|
+
STATUSES = {
|
6
|
+
created: 'created',
|
7
|
+
inprogress: 'inprogress',
|
8
|
+
completed_by_merchant: 'completed%20by%20merchant'
|
9
|
+
}.freeze
|
2
10
|
|
3
|
-
|
11
|
+
def initialize(client)
|
12
|
+
@client = client
|
13
|
+
end
|
4
14
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
completed_by_merchant: 'completed%20by%20merchant',
|
10
|
-
}
|
15
|
+
def get_returns(status = :created)
|
16
|
+
query_status = STATUSES[status]
|
17
|
+
@client.rest_get_with_token("/returns/#{query_status}")
|
18
|
+
end
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def get_returns(status = :created)
|
17
|
-
query_status = STATUSES[status]
|
18
|
-
@client.rest_get_with_token("/returns/#{query_status}")
|
19
|
-
end
|
20
|
+
def get_return(return_url)
|
21
|
+
@client.rest_get_with_token(return_url)
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def get_return_by_id(return_id)
|
26
|
-
@client.rest_get_with_token("/returns/state/#{return_id}")
|
27
|
-
end
|
24
|
+
def get_return_by_id(return_id)
|
25
|
+
@client.rest_get_with_token("/returns/state/#{return_id}")
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
def complete_return(return_id, body = {})
|
29
|
+
@client.rest_put_with_token("/returns/#{return_id}/complete", body)
|
30
|
+
end
|
31
|
+
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/jet/client/taxonomy.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
|
-
|
1
|
+
module Jet
|
2
|
+
class Client
|
3
|
+
# Taxonomy client
|
4
|
+
class Taxonomy
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
2
8
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def get_links(limit, offset, version = "v1")
|
9
|
-
params = { limit: limit, offset: offset }
|
10
|
-
@client.rest_get_with_token("/taxonomy/links/#{version}", params)
|
11
|
-
end
|
9
|
+
def get_links(limit, offset, version = 'v1')
|
10
|
+
params = { limit: limit, offset: offset }
|
11
|
+
@client.rest_get_with_token("/taxonomy/links/#{version}", params)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def get_node(node_url)
|
15
|
+
@client.rest_get_with_token(node_url)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
def get_node_attributes(node_url)
|
19
|
+
@client.rest_get_with_token("#{node_url}/attributes")
|
20
|
+
end
|
21
|
+
end
|
19
22
|
end
|
20
23
|
end
|
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.9.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:
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.0'
|
41
41
|
description: Jet API service calls implemented in Ruby
|
42
42
|
email:
|
43
43
|
- flipstock@gmail.com
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.5.1
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Jet API for Ruby
|