shipstation 0.25 → 0.26
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 -20
- data/Rakefile +30 -30
- data/lib/shipstation/api_operations/create.rb +10 -10
- data/lib/shipstation/api_operations/delete.rb +10 -10
- data/lib/shipstation/api_operations/list.rb +11 -11
- data/lib/shipstation/api_operations/retrieve.rb +10 -10
- data/lib/shipstation/api_operations/shipment.rb +10 -10
- data/lib/shipstation/api_operations/update.rb +9 -9
- data/lib/shipstation/api_resource.rb +7 -7
- data/lib/shipstation/carrier.rb +11 -11
- data/lib/shipstation/customer.rb +5 -5
- data/lib/shipstation/fulfillment.rb +16 -0
- data/lib/shipstation/order.rb +42 -42
- data/lib/shipstation/product.rb +6 -6
- data/lib/shipstation/shipment.rb +18 -18
- data/lib/shipstation/store.rb +14 -14
- data/lib/shipstation/tag.rb +11 -11
- data/lib/shipstation/version.rb +3 -3
- data/lib/shipstation/warehouse.rb +14 -14
- data/lib/shipstation/webhook.rb +18 -18
- data/lib/shipstation.rb +97 -96
- data/lib/tasks/shipstation_tasks.rake +4 -4
- data/test/dummy/Gemfile +54 -54
- data/test/dummy/Gemfile.lock +191 -191
- data/test/dummy/README.rdoc +28 -28
- data/test/dummy/Rakefile +6 -6
- data/test/dummy/app/assets/javascripts/application.js +16 -16
- data/test/dummy/app/assets/stylesheets/application.css +15 -15
- data/test/dummy/app/controllers/application_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +2 -2
- data/test/dummy/app/views/layouts/application.html.erb +14 -14
- data/test/dummy/bin/bundle +3 -3
- data/test/dummy/bin/rails +9 -9
- data/test/dummy/bin/rake +9 -9
- data/test/dummy/bin/setup +29 -29
- data/test/dummy/bin/spring +17 -17
- data/test/dummy/config/application.rb +26 -26
- data/test/dummy/config/boot.rb +3 -3
- data/test/dummy/config/database.yml +25 -25
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/environments/development.rb +41 -41
- data/test/dummy/config/environments/production.rb +79 -79
- data/test/dummy/config/environments/test.rb +42 -42
- data/test/dummy/config/initializers/assets.rb +11 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/test/dummy/config/initializers/inflections.rb +16 -16
- data/test/dummy/config/initializers/mime_types.rb +4 -4
- data/test/dummy/config/initializers/session_store.rb +3 -3
- data/test/dummy/config/initializers/shipstation.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/test/dummy/config/locales/en.yml +23 -23
- data/test/dummy/config/routes.rb +56 -56
- data/test/dummy/config/secrets.yml +22 -22
- data/test/dummy/config.ru +4 -4
- data/test/dummy/db/seeds.rb +7 -7
- data/test/dummy/public/404.html +67 -67
- data/test/dummy/public/422.html +67 -67
- data/test/dummy/public/500.html +66 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -5
- data/test/dummy/test/test_helper.rb +10 -10
- data/test/shipstation_test.rb +7 -7
- data/test/test_helper.rb +20 -20
- metadata +38 -37
data/lib/shipstation.rb
CHANGED
|
@@ -1,96 +1,97 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rest-client'
|
|
4
|
-
|
|
5
|
-
require 'shipstation/api_operations/list'
|
|
6
|
-
require 'shipstation/api_operations/create'
|
|
7
|
-
require 'shipstation/api_operations/retrieve'
|
|
8
|
-
require 'shipstation/api_operations/update'
|
|
9
|
-
require 'shipstation/api_operations/delete'
|
|
10
|
-
|
|
11
|
-
require 'shipstation/api_resource'
|
|
12
|
-
require 'shipstation/order'
|
|
13
|
-
require 'shipstation/customer'
|
|
14
|
-
require 'shipstation/
|
|
15
|
-
require 'shipstation/
|
|
16
|
-
require 'shipstation/
|
|
17
|
-
require 'shipstation/
|
|
18
|
-
require 'shipstation/
|
|
19
|
-
require 'shipstation/
|
|
20
|
-
require 'shipstation/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@
|
|
39
|
-
@
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
str_response
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rest-client'
|
|
4
|
+
|
|
5
|
+
require 'shipstation/api_operations/list'
|
|
6
|
+
require 'shipstation/api_operations/create'
|
|
7
|
+
require 'shipstation/api_operations/retrieve'
|
|
8
|
+
require 'shipstation/api_operations/update'
|
|
9
|
+
require 'shipstation/api_operations/delete'
|
|
10
|
+
|
|
11
|
+
require 'shipstation/api_resource'
|
|
12
|
+
require 'shipstation/order'
|
|
13
|
+
require 'shipstation/customer'
|
|
14
|
+
require 'shipstation/fulfillment'
|
|
15
|
+
require 'shipstation/shipment'
|
|
16
|
+
require 'shipstation/carrier'
|
|
17
|
+
require 'shipstation/store'
|
|
18
|
+
require 'shipstation/warehouse'
|
|
19
|
+
require 'shipstation/product'
|
|
20
|
+
require 'shipstation/tag'
|
|
21
|
+
require 'shipstation/webhook'
|
|
22
|
+
|
|
23
|
+
module Shipstation
|
|
24
|
+
|
|
25
|
+
API_BASE = "https://ssapi.shipstation.com/"
|
|
26
|
+
|
|
27
|
+
class ShipstationError < StandardError
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class AuthenticationError < ShipstationError;
|
|
31
|
+
end
|
|
32
|
+
class ConfigurationError < ShipstationError;
|
|
33
|
+
end
|
|
34
|
+
class ApiRequestError < ShipstationError
|
|
35
|
+
attr_reader :response_code, :response_headers, :response_body
|
|
36
|
+
|
|
37
|
+
def initialize(response_code:, response_headers:, response_body:)
|
|
38
|
+
@response_code = response_code
|
|
39
|
+
@response_headers = response_headers
|
|
40
|
+
@response_body = response_body
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class << self
|
|
45
|
+
def username
|
|
46
|
+
defined? @username and @username or raise(
|
|
47
|
+
ConfigurationError, "Shipstation username not configured"
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
attr_writer :username
|
|
52
|
+
|
|
53
|
+
def password
|
|
54
|
+
defined? @password and @password or raise(
|
|
55
|
+
ConfigurationError, "Shipstation password not configured"
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
attr_writer :password
|
|
60
|
+
|
|
61
|
+
def request method, resource, params = {}
|
|
62
|
+
ss_username = params[:username] || Shipstation.username
|
|
63
|
+
ss_password = params[:password] || Shipstation.password
|
|
64
|
+
|
|
65
|
+
params.except!(:username, :password)
|
|
66
|
+
|
|
67
|
+
defined? method or raise(
|
|
68
|
+
ArgumentError, "Request method has not been specified"
|
|
69
|
+
)
|
|
70
|
+
defined? resource or raise(
|
|
71
|
+
ArgumentError, "Request resource has not been specified"
|
|
72
|
+
)
|
|
73
|
+
if method == :get
|
|
74
|
+
headers = {:accept => :json, content_type: :json}.merge({params: params})
|
|
75
|
+
payload = nil
|
|
76
|
+
else
|
|
77
|
+
headers = {:accept => :json, content_type: :json}
|
|
78
|
+
payload = params
|
|
79
|
+
end
|
|
80
|
+
RestClient::Request.new({
|
|
81
|
+
method: method,
|
|
82
|
+
url: API_BASE + resource,
|
|
83
|
+
user: ss_username,
|
|
84
|
+
password: ss_password,
|
|
85
|
+
payload: payload ? payload.to_json : nil,
|
|
86
|
+
headers: headers
|
|
87
|
+
}).execute do |response, request, result|
|
|
88
|
+
str_response = response.to_str
|
|
89
|
+
str_response.blank? ? '' : JSON.parse(str_response)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def datetime_format datetime
|
|
94
|
+
datetime.strftime("%Y-%m-%d %T")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# desc "Explaining what the task does"
|
|
2
|
-
# task :shipstation do
|
|
3
|
-
# # Task goes here
|
|
4
|
-
# end
|
|
1
|
+
# desc "Explaining what the task does"
|
|
2
|
+
# task :shipstation do
|
|
3
|
+
# # Task goes here
|
|
4
|
+
# end
|
data/test/dummy/Gemfile
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
source 'http://rubygems.org'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
5
|
-
gem 'rails', '4.2.7'
|
|
6
|
-
# Use sqlite3 as the database for Active Record
|
|
7
|
-
gem 'sqlite3'
|
|
8
|
-
# Use SCSS for stylesheets
|
|
9
|
-
gem 'sass-rails', '~> 5.0'
|
|
10
|
-
# Use Uglifier as compressor for JavaScript assets
|
|
11
|
-
gem 'uglifier', '>= 1.3.0'
|
|
12
|
-
# Use CoffeeScript for .coffee assets and views
|
|
13
|
-
gem 'coffee-rails', '~> 4.1.0'
|
|
14
|
-
# See https://github.com/rails/execjs#readme for more supported runtimes
|
|
15
|
-
# gem 'therubyracer', platforms: :ruby
|
|
16
|
-
|
|
17
|
-
# Use jquery as the JavaScript library
|
|
18
|
-
gem 'jquery-rails'
|
|
19
|
-
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
20
|
-
gem 'turbolinks'
|
|
21
|
-
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
22
|
-
gem 'jbuilder', '~> 2.0'
|
|
23
|
-
# bundle exec rake doc:rails generates the API under doc/api.
|
|
24
|
-
gem 'sdoc', '~> 0.4.0', group: :doc
|
|
25
|
-
|
|
26
|
-
gem 'ffi', '~> 1.9.24'
|
|
27
|
-
gem 'sprockets', '~> 3.7.2'
|
|
28
|
-
|
|
29
|
-
gem 'rest-client'
|
|
30
|
-
gem 'shipstation'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Use ActiveModel has_secure_password
|
|
34
|
-
# gem 'bcrypt', '~> 3.1.7'
|
|
35
|
-
|
|
36
|
-
# Use Unicorn as the app server
|
|
37
|
-
# gem 'unicorn'
|
|
38
|
-
|
|
39
|
-
# Use Capistrano for deployment
|
|
40
|
-
# gem 'capistrano-rails', group: :development
|
|
41
|
-
|
|
42
|
-
group :development, :test do
|
|
43
|
-
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
|
44
|
-
gem 'byebug'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
group :development do
|
|
48
|
-
# Access an IRB console on exception pages or by using <%= console %> in views
|
|
49
|
-
gem 'web-console', '~> 2.0'
|
|
50
|
-
|
|
51
|
-
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
|
52
|
-
gem 'spring'
|
|
53
|
-
end
|
|
54
|
-
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
5
|
+
gem 'rails', '4.2.7'
|
|
6
|
+
# Use sqlite3 as the database for Active Record
|
|
7
|
+
gem 'sqlite3'
|
|
8
|
+
# Use SCSS for stylesheets
|
|
9
|
+
gem 'sass-rails', '~> 5.0'
|
|
10
|
+
# Use Uglifier as compressor for JavaScript assets
|
|
11
|
+
gem 'uglifier', '>= 1.3.0'
|
|
12
|
+
# Use CoffeeScript for .coffee assets and views
|
|
13
|
+
gem 'coffee-rails', '~> 4.1.0'
|
|
14
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
|
16
|
+
|
|
17
|
+
# Use jquery as the JavaScript library
|
|
18
|
+
gem 'jquery-rails'
|
|
19
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
20
|
+
gem 'turbolinks'
|
|
21
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
22
|
+
gem 'jbuilder', '~> 2.0'
|
|
23
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
|
24
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
|
25
|
+
|
|
26
|
+
gem 'ffi', '~> 1.9.24'
|
|
27
|
+
gem 'sprockets', '~> 3.7.2'
|
|
28
|
+
|
|
29
|
+
gem 'rest-client'
|
|
30
|
+
gem 'shipstation'
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Use ActiveModel has_secure_password
|
|
34
|
+
# gem 'bcrypt', '~> 3.1.7'
|
|
35
|
+
|
|
36
|
+
# Use Unicorn as the app server
|
|
37
|
+
# gem 'unicorn'
|
|
38
|
+
|
|
39
|
+
# Use Capistrano for deployment
|
|
40
|
+
# gem 'capistrano-rails', group: :development
|
|
41
|
+
|
|
42
|
+
group :development, :test do
|
|
43
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
|
44
|
+
gem 'byebug'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
group :development do
|
|
48
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
|
49
|
+
gem 'web-console', '~> 2.0'
|
|
50
|
+
|
|
51
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
|
52
|
+
gem 'spring'
|
|
53
|
+
end
|
|
54
|
+
|