newgistics 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +25 -0
- data/.env.sample +2 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.simplecov +4 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +187 -0
- data/Rakefile +6 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/newgistics.rb +68 -0
- data/lib/newgistics/api.rb +26 -0
- data/lib/newgistics/configuration.rb +23 -0
- data/lib/newgistics/customer.rb +20 -0
- data/lib/newgistics/default_logger.rb +11 -0
- data/lib/newgistics/errors.rb +4 -0
- data/lib/newgistics/fee.rb +9 -0
- data/lib/newgistics/inbound_return.rb +29 -0
- data/lib/newgistics/inventory.rb +22 -0
- data/lib/newgistics/item.rb +19 -0
- data/lib/newgistics/order.rb +32 -0
- data/lib/newgistics/product.rb +30 -0
- data/lib/newgistics/query.rb +43 -0
- data/lib/newgistics/requests/cancel_shipment.rb +70 -0
- data/lib/newgistics/requests/post_inbound_return.rb +76 -0
- data/lib/newgistics/requests/post_shipment.rb +121 -0
- data/lib/newgistics/requests/search.rb +21 -0
- data/lib/newgistics/requests/update_shipment_contents.rb +74 -0
- data/lib/newgistics/response_handlers/cancel_shipment.rb +25 -0
- data/lib/newgistics/response_handlers/post_errors.rb +40 -0
- data/lib/newgistics/response_handlers/post_inbound_return.rb +25 -0
- data/lib/newgistics/response_handlers/post_shipment.rb +25 -0
- data/lib/newgistics/response_handlers/search.rb +57 -0
- data/lib/newgistics/response_handlers/update_shipment_contents.rb +25 -0
- data/lib/newgistics/return.rb +40 -0
- data/lib/newgistics/shipment.rb +79 -0
- data/lib/newgistics/shipment_cancellation.rb +24 -0
- data/lib/newgistics/shipment_update.rb +24 -0
- data/lib/newgistics/string_helper.rb +13 -0
- data/lib/newgistics/time_zone.rb +31 -0
- data/lib/newgistics/timestamp.rb +31 -0
- data/lib/newgistics/version.rb +3 -0
- data/lib/newgistics/warehouse.rb +14 -0
- data/lib/newgistics/xml_marshaller.rb +72 -0
- data/newgistics.gemspec +37 -0
- metadata +263 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a4bcf5101a15db9de29e852df07c6561d08858ae
|
4
|
+
data.tar.gz: 7f608f2476a8d3cf2bd9ee34122cfb5ea1c1f757
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7b56a167e8451fdf7c0cb5b5a631f8c62d485fc83c9036e07826c9d8a411531db8f80ff43db72ed4aeba07357ce0cf58c34b511467ee5e3b74530a8e1ea7556
|
7
|
+
data.tar.gz: df095043057ee1c87513bd1e14e15604ef04f8553356beb1035b3a0e46e858c4c9626f2b234540000add8cafbceb17c9b2ceb005b22fad4f9bbfb726c9ca3455
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
engines:
|
2
|
+
rubocop:
|
3
|
+
enabled: true
|
4
|
+
checks:
|
5
|
+
Rubocop/Style/Documentation:
|
6
|
+
enabled: false
|
7
|
+
Rubocop/Style/FrozenStringLiteralComment:
|
8
|
+
enabled: false
|
9
|
+
Rubocop/Style/StringLiterals:
|
10
|
+
enabled: false
|
11
|
+
duplication:
|
12
|
+
enabled: true
|
13
|
+
config:
|
14
|
+
languages:
|
15
|
+
- ruby:
|
16
|
+
mass_threshold: 20
|
17
|
+
ratings:
|
18
|
+
paths:
|
19
|
+
- app/**
|
20
|
+
- lib/**
|
21
|
+
- "**.rb"
|
22
|
+
- "**.go"
|
23
|
+
exclude_paths:
|
24
|
+
- spec/**/*
|
25
|
+
- "**/vendor/**/*"
|
data/.env.sample
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at vmmf08@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Manuel Martinez
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/repos/5991e52637216b02640002d4/badges/9e19d346f6da0db0783c/gpa.svg)](https://codeclimate.com/repos/5991e52637216b02640002d4/feed)
|
2
|
+
[![Test Coverage](https://codeclimate.com/repos/5991e52637216b02640002d4/badges/9e19d346f6da0db0783c/coverage.svg)](https://codeclimate.com/repos/5991e52637216b02640002d4/coverage)
|
3
|
+
[ ![Codeship Status for rocketsofawesome/newgistics-ruby](https://app.codeship.com/projects/63cb9a70-68b6-0135-a28b-5ec5668067cc/status?branch=master)](https://app.codeship.com/projects/241459)
|
4
|
+
# Newgistics
|
5
|
+
|
6
|
+
This Ruby gem allows you to interact with the Newgistics Fulfillment API.
|
7
|
+
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'newgistics', github: 'rocketsofawesome/newgistics-ruby'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
## Configuration
|
22
|
+
Here is a list of the available configuration options and their default values
|
23
|
+
|
24
|
+
| Option | Description | Default Value |
|
25
|
+
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|
|
26
|
+
| `api_base_url` | The URL of the Newgistics API | `"https://apistaging.newgisticsfulfillment.com"` |
|
27
|
+
| `api_key` | Your Newgistics API key | `nil` |
|
28
|
+
| `time_zone` | The time zone used by Newgistics. When the API sends timestamps back it doesn't include a time zone, if it's not provided, the value of this setting will be used when parsing the timestamps into `Time` objects. You shouldn't need to change this setting | `"America/Denver"` |
|
29
|
+
| `local_time_zone` | The time zone used by your application, all Newgistics timestamps will be translated to this time zone automatically. | `"UTC"` |
|
30
|
+
|
31
|
+
### Setting your configuration
|
32
|
+
|
33
|
+
To set configuration options use the `Newgistics.configure` method:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Newgistics.configure do |config|
|
37
|
+
config.api_key = ENV['NEWGISTICS_API_KEY']
|
38
|
+
config.api_base_url = ENV['NEWGISTIC_API_URL']
|
39
|
+
config.local_time_zone = "America/New_York"
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
When setting `time_zone` or `local_time_zone` pass a `String` with [the name of your time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
44
|
+
|
45
|
+
If you're using this gem in a Rails app, you'll probably want to put this config in an initializer.
|
46
|
+
|
47
|
+
## Resources
|
48
|
+
|
49
|
+
### Orders
|
50
|
+
|
51
|
+
#### Placing an order on Newgistics
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
order = Newgistics::Order.new(order_attributes)
|
55
|
+
order.save
|
56
|
+
```
|
57
|
+
|
58
|
+
`order_attributes` is a `Hash` containing all the attributes for the order, the attributes should map one-to-one to the Newgistics API spec.
|
59
|
+
|
60
|
+
`order.save` will return `true` if the order is placed successfully and `false` otherwise, any errors or warnings generated when placing the order are available under `order.errors` and `order.warnings` respectively
|
61
|
+
|
62
|
+
#### Updating a shipment's/order's contents on Newgistics
|
63
|
+
```ruby
|
64
|
+
shipment_update = Newgistics::ShipmentUpdate.new(id: SHIPMENT_ID)
|
65
|
+
shipment_update.add_items = [Newgistics::Item]
|
66
|
+
shipment_update.remove_items = [Newgistics::Item]
|
67
|
+
shipment_update.save
|
68
|
+
```
|
69
|
+
|
70
|
+
`add_items` and `remove_items` are arrays of `Newgistics::Item` that only require a `sku` and a `qty`. With these arrays we will update Newgistics what items to add and/or remove on the specified shipment_update object by either the shipment id(`id`) or you can use the internal order id(`order_id`) but BEWARE: use one or the other not both.
|
71
|
+
|
72
|
+
`shipment_update.save` will return `true` if the order is updated successfully and `false` otherwise, any errors or warnings generated when updating the shipment are available under `shipment_update.errors` and `shipment_update.warnings` respectively. `shipment_update.success` or also `shipment_update.success?` will also be updated to the corresponding value.
|
73
|
+
|
74
|
+
#### Cancelling a shipment/order on Newgistics
|
75
|
+
```ruby
|
76
|
+
shipment_cancellation = Newgistics::ShipmentCancellation.new(shipment_id: SHIPMENT_ID)
|
77
|
+
shipment_cancellation.save
|
78
|
+
```
|
79
|
+
|
80
|
+
You must either give a `shipment_id` or `order_id` when cancelling a shipment in order for Newgistics to find the appropriate shipment. There are also optional parameters of `cancel_if_in_process` and `cancel_if_backorder` which are boolean values and covered in the Newgistics API documentation.
|
81
|
+
|
82
|
+
`shipment_cancellation.save` will return `true` if the order is cancelled successfully and `false` otherwise, any errors or warnings generated when cancelling the shipment are available under `shipment_cancellation.errors` and `shipment_cancellation.warnings` respectively. `shipment_cancellation.success` or also `shipment_cancellation.success?` will also be updated to the corresponding value.
|
83
|
+
|
84
|
+
### Shipments
|
85
|
+
|
86
|
+
#### Searching for shipments on Newgistics
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
Newgistics::Shipment.
|
90
|
+
where(start_received_timestamp: start_date).
|
91
|
+
where(end_received_timestamp: end_date).
|
92
|
+
all
|
93
|
+
```
|
94
|
+
|
95
|
+
`start_date` and `end_date` are `Date` types in ISO 8601 format. Please note that when using timestamps the Newgistics API expects that you send both the `start_` timestamp and the `end_` timestamp. This means you cannot send `start_received_timestamp` without sending `end_received_timestamp` the same goes for `shipped_timestamp` and `exception_timestamp`.
|
96
|
+
|
97
|
+
You can use the `where` method to specify the parameters of the Search. Parameter keys will be automatically camelized when sent to Newgistics, for a full list of the available parameters refer to the Newgistics API documentation.
|
98
|
+
|
99
|
+
`Newgistics::Shipment.where(conditions).all` will return a list of `Newgistics::Shipment` elements if the request is successful. Otherwise it will raise a `Newgistics::QueryError`.
|
100
|
+
|
101
|
+
### Inbound Returns
|
102
|
+
|
103
|
+
#### Sending inbound returns to Newgistics
|
104
|
+
```ruby
|
105
|
+
Newgistics::InboundReturn.new(inbound_return_attributes).save
|
106
|
+
```
|
107
|
+
|
108
|
+
`inbound_return_attributes` is a `Hash` containing all the attributes for the inbound return, the attributes should map one-to-one to the Newgistics API spec. *Caveat*: you should only supply either `shipment_id` or `order_id` but not both because you will receive an error from the API.
|
109
|
+
|
110
|
+
`inbound_return.save` will return `true` if the inbound return is sent successfully to Newgistics and `false` otherwise, any errors or warnings generated when sending the inbound_return are available under `inbound_return.errors` and `inbound_return.warnings` respectively
|
111
|
+
|
112
|
+
#### Searching for inbound returns on Newgistics
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Newgistics::InboundReturn.
|
116
|
+
where(start_created_timestamp: start_date).
|
117
|
+
where(end_created_timestamp: end_date).
|
118
|
+
all
|
119
|
+
```
|
120
|
+
|
121
|
+
You can use the `where` method to specify the parameters of the Search. Parameter keys will be automatically camelized when sent to Newgistics, for a full list of the available parameters refer to the Newgistics API documentation.
|
122
|
+
|
123
|
+
`Newgistics::InboundReturn.where(conditions).all` will return a list of `Newgistics::InboundReturn` elements if the request is successful. Otherwise it will raise a `Newgistics::QueryError`.
|
124
|
+
|
125
|
+
### Returns
|
126
|
+
|
127
|
+
#### Searching for returns received by Newgistics
|
128
|
+
```ruby
|
129
|
+
Newgistics::Return.
|
130
|
+
where(start_timestamp: start_date).
|
131
|
+
where(end_timestamp: end_date).
|
132
|
+
all
|
133
|
+
```
|
134
|
+
|
135
|
+
`start_date` and `end_date` are Date types in ISO 8601 format. Please note that when using timestamps the Newgistics API expects that you send both the `start_timestamp` and the `end_timestamp.` This means you cannot send `start_timestamp` without sending `end_timestamp`.
|
136
|
+
|
137
|
+
You can use the where method to specify the parameters of the Search. Parameter keys will be automatically camelized when sent to Newgistics, for a full list of the available parameters refer to the Newgistics API documentation.
|
138
|
+
|
139
|
+
`Newgistics::Return.where(conditions).all` will return a list of `Newgistics::Return` elements if the request is successful. Otherwise it will raise a `Newgistics::QueryError`.
|
140
|
+
|
141
|
+
### Products
|
142
|
+
|
143
|
+
#### Retrieving products from Newgistics
|
144
|
+
```ruby
|
145
|
+
products = Newgistics::Product.all
|
146
|
+
products = Newgistics::Product.
|
147
|
+
where(sku: sku).
|
148
|
+
where(warehouse: warehouse_id).
|
149
|
+
all
|
150
|
+
```
|
151
|
+
`sku` is a product's sku and `warehouse` is the warehouse's id number, where both of these values are strings. Parameter keys will be automatically camelized when sent to Newgistics, for a full list of the available parameters refer to the Newgistics API documentation.
|
152
|
+
|
153
|
+
However, parameters are not necessary for this endpoint and you will receive the complete inventory of products if you give it no parameters, so this allows you to just use the `all` method to retrieve the entire inventory.
|
154
|
+
|
155
|
+
`Newgistics::Product.all` will return a list of `Newgistics::Product` elements if the request is successful. Otherwise it will raise a `Newgistics::QueryError`.
|
156
|
+
|
157
|
+
### Inventory
|
158
|
+
|
159
|
+
#### Retrieve inventory details from Newgistics
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
Newgistics::Inventory.
|
163
|
+
where(start_timestamp: start_date, end_timestamp: end_date).
|
164
|
+
all
|
165
|
+
```
|
166
|
+
`start_date` and `end_date` are Date types in ISO8601 format.
|
167
|
+
|
168
|
+
You can use the `where` method to specify the parameters for the Search. Parameter keys will be automatically camelized when sent to
|
169
|
+
Newgistics, for a full list of the available parameters refer to the Newgistics API documentation.
|
170
|
+
|
171
|
+
## Development
|
172
|
+
|
173
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
174
|
+
|
175
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
176
|
+
|
177
|
+
## Contributing
|
178
|
+
|
179
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rocketsofawesome/newgistics-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
180
|
+
|
181
|
+
## License
|
182
|
+
|
183
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
184
|
+
|
185
|
+
## Code of Conduct
|
186
|
+
|
187
|
+
Everyone interacting in the Newgistics project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/newgistics/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "newgistics"
|
5
|
+
require "irb"
|
6
|
+
require "pry"
|
7
|
+
require "dotenv"
|
8
|
+
|
9
|
+
Dotenv.load
|
10
|
+
|
11
|
+
Newgistics.configure do |config|
|
12
|
+
config.api_base_url = ENV.fetch('NEWGISTICS_API_URL', "https://apistaging.newgisticsfulfillment.com")
|
13
|
+
config.api_key = ENV['NEWGISTICS_API_KEY']
|
14
|
+
end
|
15
|
+
|
16
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/newgistics.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require "virtus"
|
2
|
+
require "nokogiri"
|
3
|
+
require "faraday"
|
4
|
+
require "tzinfo"
|
5
|
+
|
6
|
+
require "newgistics/api"
|
7
|
+
require "newgistics/default_logger"
|
8
|
+
require "newgistics/configuration"
|
9
|
+
require "newgistics/time_zone"
|
10
|
+
require "newgistics/timestamp"
|
11
|
+
require "newgistics/customer"
|
12
|
+
require "newgistics/item"
|
13
|
+
require "newgistics/order"
|
14
|
+
require "newgistics/product"
|
15
|
+
require "newgistics/return"
|
16
|
+
require "newgistics/inbound_return"
|
17
|
+
require "newgistics/inventory"
|
18
|
+
require "newgistics/query"
|
19
|
+
require "newgistics/errors"
|
20
|
+
require "newgistics/string_helper"
|
21
|
+
require "newgistics/shipment_cancellation"
|
22
|
+
require "newgistics/shipment_update"
|
23
|
+
require "newgistics/warehouse"
|
24
|
+
require "newgistics/requests/cancel_shipment"
|
25
|
+
require "newgistics/requests/post_shipment"
|
26
|
+
require "newgistics/requests/post_inbound_return"
|
27
|
+
require "newgistics/requests/search"
|
28
|
+
require "newgistics/requests/update_shipment_contents"
|
29
|
+
require "newgistics/response_handlers/cancel_shipment"
|
30
|
+
require "newgistics/response_handlers/post_shipment"
|
31
|
+
require "newgistics/response_handlers/post_inbound_return"
|
32
|
+
require "newgistics/response_handlers/post_errors"
|
33
|
+
require "newgistics/response_handlers/search"
|
34
|
+
require "newgistics/response_handlers/update_shipment_contents"
|
35
|
+
require "newgistics/fee"
|
36
|
+
require "newgistics/shipment"
|
37
|
+
require "newgistics/version"
|
38
|
+
require "newgistics/xml_marshaller"
|
39
|
+
|
40
|
+
module Newgistics
|
41
|
+
def self.configuration
|
42
|
+
@configuration ||= Configuration.new
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.api
|
46
|
+
@api ||= Api.new
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.logger
|
50
|
+
@logger ||= DefaultLogger.build
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.logger=(logger)
|
54
|
+
@logger = logger
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.time_zone
|
58
|
+
configuration.time_zone
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.local_time_zone
|
62
|
+
configuration.local_time_zone
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.configure
|
66
|
+
yield(configuration)
|
67
|
+
end
|
68
|
+
end
|