ship_station 0.0.2 → 0.0.3
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 +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +103 -0
- data/lib/ship_station/api.rb +1 -1
- data/lib/ship_station/api/model.rb +1 -1
- data/lib/ship_station/base.rb +2 -2
- data/lib/ship_station/middleware.rb +6 -6
- data/lib/ship_station/version.rb +1 -1
- data/spec/ship_station/base_spec.rb +7 -7
- data/spec/ship_station/models/carrier_spec.rb +5 -5
- data/spec/ship_station/models/customer_spec.rb +11 -11
- data/spec/ship_station/models/fulfillment_spec.rb +6 -6
- data/spec/ship_station/models/order_spec.rb +11 -11
- data/spec/ship_station/models/product_spec.rb +11 -11
- data/spec/ship_station/models/shipment_spec.rb +11 -11
- data/spec/ship_station/models/store_spec.rb +11 -11
- data/spec/ship_station/models/warehouse_spec.rb +11 -11
- data/spec/spec_helper.rb +6 -1
- metadata +5 -33
- data/bin/console +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d541da1b8d5a90890bcaa731a0234eea3c76b15d
|
4
|
+
data.tar.gz: cea268522b3bd920af0eba90432829e1e8827cf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca7e489d5a5244c1ef29c7c592f7f9f461d2853ab235ba0927a12befd0910ffe11ea03e132e88b2fbf9030bdf43f3c6fb690a4e97934daea773595e54cd140a7
|
7
|
+
data.tar.gz: eb73d08ff8fdb0e2623c41bf5a258cc6198219083ce43715aeb252151b5e4118904e0e7943c395792b0df5719e13b12b9489f3c824896e4a72f9bf002c6f2439
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Ben Jacobs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
[](https://rubygems.org/gems/ship_station)
|
2
|
+
[](https://travis-ci.com/Benjaminpjacobs/ship_station)
|
3
|
+
[](https://codeclimate.com/github/Benjaminpjacobs/ship_station/maintainability)
|
4
|
+
[](https://codeclimate.com/github/Benjaminpjacobs/ship_station/test_coverage)
|
5
|
+
## Shipstation
|
6
|
+
|
7
|
+
Another Ruby wrapper for the ShipStation API.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add module to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'ship_station'
|
15
|
+
```
|
16
|
+
|
17
|
+
Then run bundle to install the Gem:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
bundle install
|
21
|
+
```
|
22
|
+
|
23
|
+
Set up your environment file with your Shipstation API key and secret:
|
24
|
+
|
25
|
+
```
|
26
|
+
SHIPSTATION_API_KEY: <YOUR SHIPSTATION KEY>
|
27
|
+
SHIPSTATION_API_SECRET: <YOUR SHIPSTATION SECRET>
|
28
|
+
```
|
29
|
+
|
30
|
+
If using the gem without an environment file, you can initialize these manually.
|
31
|
+
```ruby
|
32
|
+
ShipStation.username = <YOUR SHIPSTATION KEY>
|
33
|
+
ShipStation.password = <YOUR SHIPSTATION SECRET>
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
This gem provides a collection of operations for use within the Shipstation API.
|
40
|
+
|
41
|
+
### List
|
42
|
+
|
43
|
+
List all records for a resource.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Shipstation::Carrier.all
|
47
|
+
Shipstation::Customer.all
|
48
|
+
Shipstation::FulFillment.all
|
49
|
+
Shipstation::Order.all
|
50
|
+
Shipstation::Product.all
|
51
|
+
Shipstation::Shipment.all
|
52
|
+
Shipstation::Store.all
|
53
|
+
Shipstation::Warehouse.all
|
54
|
+
```
|
55
|
+
|
56
|
+
### Retrieve
|
57
|
+
|
58
|
+
Retrieve a single record of a resource.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Shipstation::Customer.find(customer_id)
|
62
|
+
Shipstation::Customer.find(customer_id)
|
63
|
+
Shipstation::Order.find(order_id)
|
64
|
+
Shipstation::Product.find(product_id)
|
65
|
+
Shipstation::Shipment.find(shipment_id)
|
66
|
+
Shipstation::Store.find(store_id)
|
67
|
+
Shipstation::Warehouse.find(warehouse_id)
|
68
|
+
```
|
69
|
+
|
70
|
+
### Pagination
|
71
|
+
After making a request, pagination can be retreived off the collection.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
orders = Shipstation::Order.all
|
75
|
+
orders.metadata[:page] #=> 1
|
76
|
+
orders.metadata[:pages] #=> 3
|
77
|
+
orders.metadata[:total] #=> 250
|
78
|
+
```
|
79
|
+
|
80
|
+
### Rate Limiting
|
81
|
+
|
82
|
+
After making a request, rate limit information(expressed as an integer of seconds) can be retreived off the module.
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
orders = Shipstation::Order.all
|
86
|
+
Shipstation.limit #=> 40
|
87
|
+
Shipstation.remaining #=> 39
|
88
|
+
Shipstation.reset_time #=> 52
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
## How to contribute
|
93
|
+
|
94
|
+
* Fork the project
|
95
|
+
* Create your feature or bug fix
|
96
|
+
* Add the requried tests for it.
|
97
|
+
* Commit (do not change version or history)
|
98
|
+
* Send a pull request against the *development* branch
|
99
|
+
|
100
|
+
## Copyright
|
101
|
+
Copyright (c) 2018 Ben Jacobs
|
102
|
+
Licenced under the MIT licence.
|
103
|
+
|
data/lib/ship_station/api.rb
CHANGED
data/lib/ship_station/base.rb
CHANGED
@@ -16,14 +16,14 @@ module ShipStation
|
|
16
16
|
|
17
17
|
def username
|
18
18
|
@username ||= ENV["SHIPSTATION_API_KEY"] or
|
19
|
-
raise(ConfigurationError, "Shipstation username not configured")
|
19
|
+
raise(ConfigurationError, "Shipstation username not configured")
|
20
20
|
end
|
21
21
|
|
22
22
|
def password
|
23
23
|
@password ||= ENV["SHIPSTATION_API_SECRET"] or
|
24
24
|
raise(ConfigurationError, "Shipstation password not configured")
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -3,9 +3,9 @@ module ShipStation
|
|
3
3
|
class ResponseParser < Her::Middleware::FirstLevelParseJSON
|
4
4
|
def parse(env)
|
5
5
|
json = parse_json(env)
|
6
|
-
|
6
|
+
|
7
7
|
return super unless json.is_a?(Hash)
|
8
|
-
|
8
|
+
|
9
9
|
errors = json.delete(:errors) || {}
|
10
10
|
pagination = json.slice(:page, :pages, :total)
|
11
11
|
{
|
@@ -14,12 +14,12 @@ module ShipStation
|
|
14
14
|
:metadata => pagination
|
15
15
|
}
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
# This middleware gives the user access to rate limiting information
|
19
19
|
def on_complete(env)
|
20
|
-
ShipStation.limit = env.response.headers["x-rate-limit-limit"]
|
21
|
-
ShipStation.remaining = env.response.headers["x-rate-limit-remaining"]
|
22
|
-
ShipStation.reset_time = env.response.headers["x-rate-limit-reset"]
|
20
|
+
ShipStation.limit = env.response.headers["x-rate-limit-limit"].to_i
|
21
|
+
ShipStation.remaining = env.response.headers["x-rate-limit-remaining"].to_i
|
22
|
+
ShipStation.reset_time = env.response.headers["x-rate-limit-reset"].to_i
|
23
23
|
super(env)
|
24
24
|
end
|
25
25
|
end
|
data/lib/ship_station/version.rb
CHANGED
@@ -13,25 +13,25 @@ RSpec.describe ShipStation do
|
|
13
13
|
|
14
14
|
it "stores rate limiting information after each request" do
|
15
15
|
stub_api_for(ShipStation::Order) do |stub|
|
16
|
-
stub.get("/orders") do |env|
|
16
|
+
stub.get("/orders") do |env|
|
17
17
|
[
|
18
|
-
200,
|
18
|
+
200,
|
19
19
|
{
|
20
20
|
"x-rate-limit-limit" => 40,
|
21
21
|
"x-rate-limit-remaining" => 39,
|
22
22
|
"x-rate-limit-reset"=>20
|
23
|
-
},
|
23
|
+
},
|
24
24
|
{ orders: [{}],
|
25
25
|
page: 1,
|
26
26
|
pages: 1,
|
27
27
|
total: 1
|
28
|
-
}.to_json
|
28
|
+
}.to_json
|
29
29
|
]
|
30
|
-
end
|
30
|
+
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
ShipStation::Order.all.fetch
|
34
|
-
|
34
|
+
|
35
35
|
expect(ShipStation.limit).to eq(40)
|
36
36
|
expect(ShipStation.remaining).to eq(39)
|
37
37
|
expect(ShipStation.reset_time).to eq(20)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Carrier do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Carrier) do |stub|
|
4
|
-
stub.get("/carriers") do |env|
|
4
|
+
stub.get("/carriers") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ carriers: [{
|
9
9
|
"name": "Stamps.com",
|
10
10
|
"code": "stamps_com",
|
@@ -18,12 +18,12 @@ RSpec.describe ShipStation::Carrier do
|
|
18
18
|
page: 1,
|
19
19
|
pages: 1,
|
20
20
|
total: 1
|
21
|
-
}.to_json
|
21
|
+
}.to_json
|
22
22
|
]
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "GET list" do
|
28
28
|
carriers = ShipStation::Carrier.all.fetch
|
29
29
|
expect(carriers.length).to eq(1)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Customer do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Customer) do |stub|
|
4
|
-
stub.get("/customers") do |env|
|
4
|
+
stub.get("/customers") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ customers: [{
|
9
9
|
"customerId": 12345678,
|
10
10
|
"createDate": "2014-11-18T10:33:01.1900000",
|
@@ -15,26 +15,26 @@ RSpec.describe ShipStation::Customer do
|
|
15
15
|
page: 1,
|
16
16
|
pages: 1,
|
17
17
|
total: 1
|
18
|
-
}.to_json
|
18
|
+
}.to_json
|
19
19
|
]
|
20
|
-
end
|
20
|
+
end
|
21
21
|
|
22
|
-
stub.get("/customers/12345678") do |env|
|
22
|
+
stub.get("/customers/12345678") do |env|
|
23
23
|
[
|
24
|
-
200,
|
25
|
-
{},
|
24
|
+
200,
|
25
|
+
{},
|
26
26
|
{
|
27
27
|
"customerId": 12345678,
|
28
28
|
"createDate": "2014-11-18T10:33:01.1900000",
|
29
29
|
"modifyDate": "2014-11-18T10:33:01.1900000",
|
30
30
|
"name": "Cam Newton",
|
31
31
|
"company": "Test Company",
|
32
|
-
}.to_json
|
32
|
+
}.to_json
|
33
33
|
]
|
34
|
-
end
|
34
|
+
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "GET list" do
|
39
39
|
customers = ShipStation::Customer.all.fetch
|
40
40
|
expect(customers.length).to eq(1)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Fulfillment do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Fulfillment) do |stub|
|
4
|
-
stub.get("/fulfillments") do |env|
|
4
|
+
stub.get("/fulfillments") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ fulfillments: [
|
9
9
|
{
|
10
10
|
"fulfillmentId": 33974374,
|
@@ -30,12 +30,12 @@ RSpec.describe ShipStation::Fulfillment do
|
|
30
30
|
page: 1,
|
31
31
|
pages: 1,
|
32
32
|
total: 2
|
33
|
-
}.to_json
|
33
|
+
}.to_json
|
34
34
|
]
|
35
|
-
end
|
35
|
+
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "GET list" do
|
40
40
|
fulfillments = ShipStation::Fulfillment.all.fetch
|
41
41
|
expect(fulfillments.length).to eq(2)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Order do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Order) do |stub|
|
4
|
-
stub.get("/orders") do |env|
|
4
|
+
stub.get("/orders") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ orders: [{
|
9
9
|
"orderId"=>9222306,
|
10
10
|
"orderNumber"=>"1918",
|
@@ -16,14 +16,14 @@ RSpec.describe ShipStation::Order do
|
|
16
16
|
page: 1,
|
17
17
|
pages: 1,
|
18
18
|
total: 1
|
19
|
-
}.to_json
|
19
|
+
}.to_json
|
20
20
|
]
|
21
|
-
end
|
21
|
+
end
|
22
22
|
|
23
|
-
stub.get("/orders/9222306") do |env|
|
23
|
+
stub.get("/orders/9222306") do |env|
|
24
24
|
[
|
25
|
-
200,
|
26
|
-
{},
|
25
|
+
200,
|
26
|
+
{},
|
27
27
|
{
|
28
28
|
"orderId"=>9222306,
|
29
29
|
"orderNumber"=>"1918",
|
@@ -31,12 +31,12 @@ RSpec.describe ShipStation::Order do
|
|
31
31
|
"orderDate"=>"2016-08-08T16:48:30.0000000",
|
32
32
|
"createDate"=>"2016-11-02T08:01:53.1400000",
|
33
33
|
"modifyDate"=>"2016-11-02T08:01:46.3970000"
|
34
|
-
}.to_json
|
34
|
+
}.to_json
|
35
35
|
]
|
36
|
-
end
|
36
|
+
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "GET list" do
|
41
41
|
orders = ShipStation::Order.all.fetch
|
42
42
|
expect(orders.length).to eq(1)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Product do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Product) do |stub|
|
4
|
-
stub.get("/products") do |env|
|
4
|
+
stub.get("/products") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ products: [
|
9
9
|
{
|
10
10
|
"aliases": nil,
|
@@ -24,25 +24,25 @@ RSpec.describe ShipStation::Product do
|
|
24
24
|
page: 1,
|
25
25
|
pages: 1,
|
26
26
|
total: 2
|
27
|
-
}.to_json
|
27
|
+
}.to_json
|
28
28
|
]
|
29
|
-
end
|
29
|
+
end
|
30
30
|
|
31
|
-
stub.get("/products/7854008") do |env|
|
31
|
+
stub.get("/products/7854008") do |env|
|
32
32
|
[
|
33
|
-
200,
|
34
|
-
{},
|
33
|
+
200,
|
34
|
+
{},
|
35
35
|
{
|
36
36
|
"aliases": nil,
|
37
37
|
"productId": 7854008,
|
38
38
|
"sku": "1005",
|
39
39
|
"name": "Coffee Mug"
|
40
|
-
}.to_json
|
40
|
+
}.to_json
|
41
41
|
]
|
42
|
-
end
|
42
|
+
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "GET list" do
|
47
47
|
products = ShipStation::Product.all.fetch
|
48
48
|
expect(products.length).to eq(2)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Shipment do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Shipment) do |stub|
|
4
|
-
stub.get("/shipments") do |env|
|
4
|
+
stub.get("/shipments") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ shipments: [{
|
9
9
|
shipmentId: 33974374,
|
10
10
|
orderId: 43945660,
|
@@ -19,14 +19,14 @@ RSpec.describe ShipStation::Shipment do
|
|
19
19
|
page: 1,
|
20
20
|
pages: 1,
|
21
21
|
total: 1
|
22
|
-
}.to_json
|
22
|
+
}.to_json
|
23
23
|
]
|
24
|
-
end
|
24
|
+
end
|
25
25
|
|
26
|
-
stub.get("/shipments/33974374") do |env|
|
26
|
+
stub.get("/shipments/33974374") do |env|
|
27
27
|
[
|
28
|
-
200,
|
29
|
-
{},
|
28
|
+
200,
|
29
|
+
{},
|
30
30
|
{
|
31
31
|
shipmentId: 33974374,
|
32
32
|
orderId: 43945660,
|
@@ -38,12 +38,12 @@ RSpec.describe ShipStation::Shipment do
|
|
38
38
|
shipmentCost: 1.93,
|
39
39
|
insuranceCost: 0,
|
40
40
|
trackingNumber: "9400111899561704681189"
|
41
|
-
}.to_json
|
41
|
+
}.to_json
|
42
42
|
]
|
43
|
-
end
|
43
|
+
end
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "GET list" do
|
48
48
|
shipments = ShipStation::Shipment.all.fetch
|
49
49
|
expect(shipments.length).to eq(1)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Store do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Store) do |stub|
|
4
|
-
stub.get("/stores") do |env|
|
4
|
+
stub.get("/stores") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
{ stores: [
|
9
9
|
{
|
10
10
|
"storeId": 22766,
|
@@ -26,14 +26,14 @@ RSpec.describe ShipStation::Store do
|
|
26
26
|
page: 1,
|
27
27
|
pages: 1,
|
28
28
|
total: 2
|
29
|
-
}.to_json
|
29
|
+
}.to_json
|
30
30
|
]
|
31
|
-
end
|
31
|
+
end
|
32
32
|
|
33
|
-
stub.get("/stores/22766") do |env|
|
33
|
+
stub.get("/stores/22766") do |env|
|
34
34
|
[
|
35
|
-
200,
|
36
|
-
{},
|
35
|
+
200,
|
36
|
+
{},
|
37
37
|
{
|
38
38
|
"storeId": 22766,
|
39
39
|
"storeName": "ShipStation Manual Store",
|
@@ -41,12 +41,12 @@ RSpec.describe ShipStation::Store do
|
|
41
41
|
"marketplaceName": "ShipStation",
|
42
42
|
"createDate": "2014-07-25T11:05:55.307",
|
43
43
|
"modifyDate": "2014-11-12T08:45:20.55",
|
44
|
-
}.to_json
|
44
|
+
}.to_json
|
45
45
|
]
|
46
|
-
end
|
46
|
+
end
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "GET list" do
|
51
51
|
stores = ShipStation::Store.all.fetch
|
52
52
|
expect(stores.length).to eq(2)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe ShipStation::Warehouse do
|
2
2
|
before do
|
3
3
|
stub_api_for(ShipStation::Warehouse) do |stub|
|
4
|
-
stub.get("/warehouses") do |env|
|
4
|
+
stub.get("/warehouses") do |env|
|
5
5
|
[
|
6
|
-
200,
|
7
|
-
{},
|
6
|
+
200,
|
7
|
+
{},
|
8
8
|
[{
|
9
9
|
"warehouseId": 17977,
|
10
10
|
"warehouseName": "Main warehouse",
|
@@ -16,25 +16,25 @@ RSpec.describe ShipStation::Warehouse do
|
|
16
16
|
"warehouseName": "Austin",
|
17
17
|
"createDate": "2014-05-27T09:54:29.9600000",
|
18
18
|
"isDefault": false
|
19
|
-
}].to_json
|
19
|
+
}].to_json
|
20
20
|
]
|
21
|
-
end
|
21
|
+
end
|
22
22
|
|
23
|
-
stub.get("/warehouses/17977") do |env|
|
23
|
+
stub.get("/warehouses/17977") do |env|
|
24
24
|
[
|
25
|
-
200,
|
26
|
-
{},
|
25
|
+
200,
|
26
|
+
{},
|
27
27
|
{
|
28
28
|
"warehouseId": 17977,
|
29
29
|
"warehouseName": "Main warehouse",
|
30
30
|
"createDate": "2014-10-21T08:11:43.8800000",
|
31
31
|
"isDefault": true
|
32
|
-
}.to_json
|
32
|
+
}.to_json
|
33
33
|
]
|
34
|
-
end
|
34
|
+
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "GET list" do
|
39
39
|
warehouses = ShipStation::Warehouse.all.fetch
|
40
40
|
expect(warehouses.length).to eq(2)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
+
require 'simplecov'
|
2
3
|
require 'pry'
|
3
|
-
require 'ship_station'
|
4
4
|
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'ship_station'
|
5
10
|
|
6
11
|
RSpec.configure do |config|
|
7
12
|
# Enable flags like --only-failures and --next-failure
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ship_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Jacobs
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: launchy
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: her
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,29 +80,15 @@ dependencies:
|
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '3.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: dotenv
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '2.2'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '2.2'
|
111
83
|
description: Shipstation API
|
112
84
|
email:
|
113
85
|
- benjaminpjacobs@gmail.com
|
114
|
-
executables:
|
115
|
-
- console
|
86
|
+
executables: []
|
116
87
|
extensions: []
|
117
88
|
extra_rdoc_files: []
|
118
89
|
files:
|
119
|
-
-
|
90
|
+
- MIT-LICENSE
|
91
|
+
- README.md
|
120
92
|
- lib/ship_station.rb
|
121
93
|
- lib/ship_station/api.rb
|
122
94
|
- lib/ship_station/api/carrier.rb
|
@@ -154,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
126
|
requirements:
|
155
127
|
- - ">="
|
156
128
|
- !ruby/object:Gem::Version
|
157
|
-
version: '2.
|
129
|
+
version: '2.3'
|
158
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
131
|
requirements:
|
160
132
|
- - ">="
|
data/bin/console
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.push File.expand_path("lib", __FILE__)
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
|
6
|
-
require "ship_station"
|
7
|
-
|
8
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
9
|
-
# with your gem easier. You can also use a different console, if you like.
|
10
|
-
|
11
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
12
|
-
require 'pry'
|
13
|
-
Pry.start
|