noths 0.1.0
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 +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +149 -0
- data/Rakefile +8 -0
- data/bin/generate_gem +18 -0
- data/bin/refresh_schemas +94 -0
- data/docs/AcceptanceBulkModel.md +11 -0
- data/docs/Currency.md +11 -0
- data/docs/DeclineBulkModel.md +9 -0
- data/docs/DeliveryAddress.md +13 -0
- data/docs/DeliveryService.md +9 -0
- data/docs/DeliveryZone.md +9 -0
- data/docs/DispatchBulkModel.md +12 -0
- data/docs/DispatchNotesBulkModel.md +8 -0
- data/docs/Enquiry.md +10 -0
- data/docs/EnquiryMessage.md +8 -0
- data/docs/Error.md +9 -0
- data/docs/Financials.md +25 -0
- data/docs/FinancialsDetails.md +10 -0
- data/docs/ImageUrl.md +13 -0
- data/docs/Item.md +15 -0
- data/docs/ItemFinancials.md +13 -0
- data/docs/Link.md +10 -0
- data/docs/ManualPayment.md +11 -0
- data/docs/Money.md +9 -0
- data/docs/Order.md +53 -0
- data/docs/OrderDetail.md +9 -0
- data/docs/OrderDetailsBulkModel.md +8 -0
- data/docs/OrderIndex.md +10 -0
- data/docs/OrderRefund.md +8 -0
- data/docs/OrdersApi.md +796 -0
- data/docs/Product.md +12 -0
- data/docs/ProductOption.md +9 -0
- data/docs/RefundResponse.md +10 -0
- data/docs/RefundsApi.md +69 -0
- data/docs/SearchResultMeta.md +9 -0
- data/docs/User.md +10 -0
- data/lib/noths.rb +70 -0
- data/lib/noths/api/orders_api.rb +819 -0
- data/lib/noths/api/refunds_api.rb +88 -0
- data/lib/noths/api_client.rb +389 -0
- data/lib/noths/api_error.rb +38 -0
- data/lib/noths/configuration.rb +209 -0
- data/lib/noths/models/acceptance_bulk_model.rb +233 -0
- data/lib/noths/models/currency.rb +235 -0
- data/lib/noths/models/decline_bulk_model.rb +208 -0
- data/lib/noths/models/delivery_address.rb +263 -0
- data/lib/noths/models/delivery_service.rb +207 -0
- data/lib/noths/models/delivery_zone.rb +207 -0
- data/lib/noths/models/dispatch_bulk_model.rb +236 -0
- data/lib/noths/models/dispatch_notes_bulk_model.rb +194 -0
- data/lib/noths/models/enquiry.rb +223 -0
- data/lib/noths/models/enquiry_message.rb +193 -0
- data/lib/noths/models/error.rb +207 -0
- data/lib/noths/models/financials.rb +433 -0
- data/lib/noths/models/financials_details.rb +221 -0
- data/lib/noths/models/image_url.rb +263 -0
- data/lib/noths/models/item.rb +293 -0
- data/lib/noths/models/item_financials.rb +263 -0
- data/lib/noths/models/link.rb +222 -0
- data/lib/noths/models/manual_payment.rb +235 -0
- data/lib/noths/models/money.rb +207 -0
- data/lib/noths/models/order.rb +812 -0
- data/lib/noths/models/order_detail.rb +207 -0
- data/lib/noths/models/order_details_bulk_model.rb +194 -0
- data/lib/noths/models/order_index.rb +225 -0
- data/lib/noths/models/order_refund.rb +193 -0
- data/lib/noths/models/product.rb +249 -0
- data/lib/noths/models/product_option.rb +207 -0
- data/lib/noths/models/refund_response.rb +223 -0
- data/lib/noths/models/search_result_meta.rb +207 -0
- data/lib/noths/models/user.rb +221 -0
- data/lib/noths/version.rb +15 -0
- data/noths.gemspec +45 -0
- data/schemas/api-docs.json +26 -0
- data/schemas/orders.json +2013 -0
- data/schemas/refunds.json +128 -0
- data/spec/api/orders_api_spec.rb +239 -0
- data/spec/api/refunds_api_spec.rb +50 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/acceptance_bulk_model_spec.rb +60 -0
- data/spec/models/currency_spec.rb +60 -0
- data/spec/models/decline_bulk_model_spec.rb +48 -0
- data/spec/models/delivery_address_spec.rb +72 -0
- data/spec/models/delivery_service_spec.rb +48 -0
- data/spec/models/delivery_zone_spec.rb +48 -0
- data/spec/models/dispatch_bulk_model_spec.rb +66 -0
- data/spec/models/dispatch_notes_bulk_model_spec.rb +42 -0
- data/spec/models/enquiry_message_spec.rb +42 -0
- data/spec/models/enquiry_spec.rb +54 -0
- data/spec/models/error_spec.rb +48 -0
- data/spec/models/financials_details_spec.rb +54 -0
- data/spec/models/financials_spec.rb +144 -0
- data/spec/models/image_url_spec.rb +72 -0
- data/spec/models/item_financials_spec.rb +72 -0
- data/spec/models/item_spec.rb +84 -0
- data/spec/models/link_spec.rb +54 -0
- data/spec/models/manual_payment_spec.rb +60 -0
- data/spec/models/money_spec.rb +48 -0
- data/spec/models/order_detail_spec.rb +48 -0
- data/spec/models/order_details_bulk_model_spec.rb +42 -0
- data/spec/models/order_index_spec.rb +54 -0
- data/spec/models/order_refund_spec.rb +42 -0
- data/spec/models/order_spec.rb +312 -0
- data/spec/models/product_option_spec.rb +48 -0
- data/spec/models/product_spec.rb +66 -0
- data/spec/models/refund_response_spec.rb +54 -0
- data/spec/models/search_result_meta_spec.rb +48 -0
- data/spec/models/user_spec.rb +54 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger_config.json +16 -0
- metadata +370 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f3c3f937a5855841321a0412e343360b7b5dad2f926a214c53263dd66299d6a6
|
|
4
|
+
data.tar.gz: 9609210479ca80d88dfee765e3074170046d280c85c56123d5523c68c01e2c3e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 29968d9dc3873ccaab3ef1d122d029520371806db69e3a0bd49b04c9870cac4daa5dac2d9e3173075668f2dab44feb02ea3383e94f7db13c7e662d519e366ff6
|
|
7
|
+
data.tar.gz: f09e08acfb0a6e4f17562cc91dc41fc1b6fad7c3c333be1099337d393ab24165b9838ce0a76a7cfc7977caf8c4939c0976ad958a0a703471defded37be383da2
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
noths (0.1.0)
|
|
5
|
+
json (~> 2.1, >= 2.1.0)
|
|
6
|
+
typhoeus (~> 1.0, >= 1.0.1)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
ZenTest (4.11.1)
|
|
12
|
+
addressable (2.5.2)
|
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
14
|
+
autotest (4.4.6)
|
|
15
|
+
ZenTest (>= 4.4.1)
|
|
16
|
+
autotest-fsevent (0.2.13)
|
|
17
|
+
sys-uname
|
|
18
|
+
autotest-growl (0.2.16)
|
|
19
|
+
autotest-rails-pure (4.1.2)
|
|
20
|
+
crack (0.4.3)
|
|
21
|
+
safe_yaml (~> 1.0.0)
|
|
22
|
+
diff-lcs (1.3)
|
|
23
|
+
ethon (0.11.0)
|
|
24
|
+
ffi (>= 1.3.0)
|
|
25
|
+
ffi (1.9.25)
|
|
26
|
+
hashdiff (0.3.7)
|
|
27
|
+
json (2.1.0)
|
|
28
|
+
public_suffix (3.0.2)
|
|
29
|
+
rake (12.0.0)
|
|
30
|
+
rspec (3.7.0)
|
|
31
|
+
rspec-core (~> 3.7.0)
|
|
32
|
+
rspec-expectations (~> 3.7.0)
|
|
33
|
+
rspec-mocks (~> 3.7.0)
|
|
34
|
+
rspec-core (3.7.1)
|
|
35
|
+
rspec-support (~> 3.7.0)
|
|
36
|
+
rspec-expectations (3.7.0)
|
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
38
|
+
rspec-support (~> 3.7.0)
|
|
39
|
+
rspec-mocks (3.7.0)
|
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
41
|
+
rspec-support (~> 3.7.0)
|
|
42
|
+
rspec-support (3.7.1)
|
|
43
|
+
safe_yaml (1.0.4)
|
|
44
|
+
sys-uname (1.0.3)
|
|
45
|
+
ffi (>= 1.0.0)
|
|
46
|
+
typhoeus (1.3.0)
|
|
47
|
+
ethon (>= 0.9.0)
|
|
48
|
+
vcr (3.0.3)
|
|
49
|
+
webmock (1.24.6)
|
|
50
|
+
addressable (>= 2.3.6)
|
|
51
|
+
crack (>= 0.3.2)
|
|
52
|
+
hashdiff
|
|
53
|
+
|
|
54
|
+
PLATFORMS
|
|
55
|
+
ruby
|
|
56
|
+
|
|
57
|
+
DEPENDENCIES
|
|
58
|
+
autotest (~> 4.4, >= 4.4.6)
|
|
59
|
+
autotest-fsevent (~> 0.2, >= 0.2.12)
|
|
60
|
+
autotest-growl (~> 0.2, >= 0.2.16)
|
|
61
|
+
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
|
62
|
+
noths!
|
|
63
|
+
rake (~> 12.0.0)
|
|
64
|
+
rspec (~> 3.6, >= 3.6.0)
|
|
65
|
+
vcr (~> 3.0, >= 3.0.1)
|
|
66
|
+
webmock (~> 1.24, >= 1.24.3)
|
|
67
|
+
|
|
68
|
+
BUNDLED WITH
|
|
69
|
+
1.16.2
|
data/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# noths
|
|
2
|
+
|
|
3
|
+
Noths - the Ruby gem for the Noths
|
|
4
|
+
|
|
5
|
+
www.notonthehighstreet.com API client
|
|
6
|
+
|
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
|
8
|
+
|
|
9
|
+
- API version: 1.0
|
|
10
|
+
- Package version: 0.1.0
|
|
11
|
+
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Build a gem
|
|
16
|
+
|
|
17
|
+
To build the Ruby code into a gem:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
gem build noths.gemspec
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then either install the gem locally:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
gem install ./noths-0.1.0.gem
|
|
27
|
+
```
|
|
28
|
+
(for development, run `gem install --dev ./noths-0.1.0.gem` to install the development dependencies)
|
|
29
|
+
|
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
31
|
+
|
|
32
|
+
Finally add this to the Gemfile:
|
|
33
|
+
|
|
34
|
+
gem 'noths', '~> 0.1.0'
|
|
35
|
+
|
|
36
|
+
### Install from Git
|
|
37
|
+
|
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/veeqo/noths, then add the following in the Gemfile:
|
|
39
|
+
|
|
40
|
+
gem 'noths', :git => 'https://github.com/veeqo/noths.git'
|
|
41
|
+
|
|
42
|
+
### Include the Ruby code directly
|
|
43
|
+
|
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
ruby -Ilib script.rb
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Getting Started
|
|
51
|
+
|
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
|
53
|
+
```ruby
|
|
54
|
+
# Load the gem
|
|
55
|
+
require 'noths'
|
|
56
|
+
|
|
57
|
+
# Setup authorization
|
|
58
|
+
Noths.configure do |config|
|
|
59
|
+
# Configure API key authorization: token
|
|
60
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
61
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
62
|
+
#config.api_key_prefix['token'] = 'Bearer'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
api_instance = Noths::OrdersApi.new
|
|
66
|
+
|
|
67
|
+
id = 56 # Integer | Order id
|
|
68
|
+
|
|
69
|
+
estimated_delivery_date = Date.parse("2013-10-20") # Date | 'yyyy-mm-dd'
|
|
70
|
+
|
|
71
|
+
estimated_dispatch_at = Date.parse("2013-10-20") # Date | 'yyyy-mm-dd'
|
|
72
|
+
|
|
73
|
+
opts = {
|
|
74
|
+
confirmation_note: "confirmation_note_example" # String |
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
begin
|
|
78
|
+
#Accept an order
|
|
79
|
+
api_instance.orders_acceptance(id, estimated_delivery_date, estimated_dispatch_at, opts)
|
|
80
|
+
rescue Noths::ApiError => e
|
|
81
|
+
puts "Exception when calling OrdersApi->orders_acceptance: #{e}"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Documentation for API Endpoints
|
|
87
|
+
|
|
88
|
+
All URIs are relative to *http://localhost*
|
|
89
|
+
|
|
90
|
+
Class | Method | HTTP request | Description
|
|
91
|
+
------------ | ------------- | ------------- | -------------
|
|
92
|
+
*Noths::OrdersApi* | [**orders_acceptance**](docs/OrdersApi.md#orders_acceptance) | **POST** /api/v1/orders/{id}/accept | Accept an order
|
|
93
|
+
*Noths::OrdersApi* | [**orders_acceptance_bulk**](docs/OrdersApi.md#orders_acceptance_bulk) | **POST** /api/v1/orders/accept | Accept multiple orders
|
|
94
|
+
*Noths::OrdersApi* | [**orders_decline**](docs/OrdersApi.md#orders_decline) | **POST** /api/v1/orders/{id}/decline | Decline an order
|
|
95
|
+
*Noths::OrdersApi* | [**orders_decline_bulk**](docs/OrdersApi.md#orders_decline_bulk) | **POST** /api/v1/orders/decline | Decline multiple orders
|
|
96
|
+
*Noths::OrdersApi* | [**orders_dispatch_note**](docs/OrdersApi.md#orders_dispatch_note) | **GET** /api/v1/orders/{id}/dispatch_note | Generate a dispatch note pdf or gift note pdf.
|
|
97
|
+
*Noths::OrdersApi* | [**orders_dispatch_notes_bulk**](docs/OrdersApi.md#orders_dispatch_notes_bulk) | **POST** /api/v1/orders/dispatch_notes | Generate pdf with dispatch note for each order
|
|
98
|
+
*Noths::OrdersApi* | [**orders_dispatch_order**](docs/OrdersApi.md#orders_dispatch_order) | **POST** /api/v1/orders/{id}/dispatch | Dispatch an order
|
|
99
|
+
*Noths::OrdersApi* | [**orders_dispatch_orders_bulk**](docs/OrdersApi.md#orders_dispatch_orders_bulk) | **POST** /api/v1/orders/dispatch | Dispatch multiple orders
|
|
100
|
+
*Noths::OrdersApi* | [**orders_index**](docs/OrdersApi.md#orders_index) | **GET** /api/v1/orders | Fetch orders
|
|
101
|
+
*Noths::OrdersApi* | [**orders_invoice**](docs/OrdersApi.md#orders_invoice) | **GET** /api/v1/orders/{id}/invoice | Generate a vat invoice pdf.
|
|
102
|
+
*Noths::OrdersApi* | [**orders_order_details**](docs/OrdersApi.md#orders_order_details) | **GET** /api/v1/orders/{id}/order_details | Generate an order details pdf
|
|
103
|
+
*Noths::OrdersApi* | [**orders_order_details_bulk**](docs/OrdersApi.md#orders_order_details_bulk) | **POST** /api/v1/orders/order_details | Generate pdf with order details for each order
|
|
104
|
+
*Noths::OrdersApi* | [**orders_show**](docs/OrdersApi.md#orders_show) | **GET** /api/v1/orders/{id} | Fetch a single Order
|
|
105
|
+
*Noths::RefundsApi* | [**refunds_create**](docs/RefundsApi.md#refunds_create) | **POST** /api/v1/orders/{order_id}/refunds | Refund an order
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## Documentation for Models
|
|
109
|
+
|
|
110
|
+
- [Noths::AcceptanceBulkModel](docs/AcceptanceBulkModel.md)
|
|
111
|
+
- [Noths::Currency](docs/Currency.md)
|
|
112
|
+
- [Noths::DeclineBulkModel](docs/DeclineBulkModel.md)
|
|
113
|
+
- [Noths::DeliveryAddress](docs/DeliveryAddress.md)
|
|
114
|
+
- [Noths::DeliveryService](docs/DeliveryService.md)
|
|
115
|
+
- [Noths::DeliveryZone](docs/DeliveryZone.md)
|
|
116
|
+
- [Noths::DispatchBulkModel](docs/DispatchBulkModel.md)
|
|
117
|
+
- [Noths::DispatchNotesBulkModel](docs/DispatchNotesBulkModel.md)
|
|
118
|
+
- [Noths::Enquiry](docs/Enquiry.md)
|
|
119
|
+
- [Noths::EnquiryMessage](docs/EnquiryMessage.md)
|
|
120
|
+
- [Noths::Error](docs/Error.md)
|
|
121
|
+
- [Noths::Financials](docs/Financials.md)
|
|
122
|
+
- [Noths::FinancialsDetails](docs/FinancialsDetails.md)
|
|
123
|
+
- [Noths::ImageUrl](docs/ImageUrl.md)
|
|
124
|
+
- [Noths::Item](docs/Item.md)
|
|
125
|
+
- [Noths::ItemFinancials](docs/ItemFinancials.md)
|
|
126
|
+
- [Noths::Link](docs/Link.md)
|
|
127
|
+
- [Noths::ManualPayment](docs/ManualPayment.md)
|
|
128
|
+
- [Noths::Money](docs/Money.md)
|
|
129
|
+
- [Noths::Order](docs/Order.md)
|
|
130
|
+
- [Noths::OrderDetail](docs/OrderDetail.md)
|
|
131
|
+
- [Noths::OrderDetailsBulkModel](docs/OrderDetailsBulkModel.md)
|
|
132
|
+
- [Noths::OrderIndex](docs/OrderIndex.md)
|
|
133
|
+
- [Noths::OrderRefund](docs/OrderRefund.md)
|
|
134
|
+
- [Noths::Product](docs/Product.md)
|
|
135
|
+
- [Noths::ProductOption](docs/ProductOption.md)
|
|
136
|
+
- [Noths::RefundResponse](docs/RefundResponse.md)
|
|
137
|
+
- [Noths::SearchResultMeta](docs/SearchResultMeta.md)
|
|
138
|
+
- [Noths::User](docs/User.md)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## Documentation for Authorization
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### token
|
|
145
|
+
|
|
146
|
+
- **Type**: API key
|
|
147
|
+
- **API key parameter name**: token
|
|
148
|
+
- **Location**: URL query string
|
|
149
|
+
|
data/Rakefile
ADDED
data/bin/generate_gem
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
gem_dir = File.expand_path('../', __dir__)
|
|
4
|
+
config_path = File.expand_path('../swagger_config.json', __dir__)
|
|
5
|
+
api_schema_path = File.expand_path('../schemas/api-docs.json', __dir__)
|
|
6
|
+
|
|
7
|
+
default_generator_options = {
|
|
8
|
+
'-l' => 'ruby',
|
|
9
|
+
'-i' => api_schema_path,
|
|
10
|
+
'-o' => gem_dir,
|
|
11
|
+
'-c' => config_path
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
generator_options = default_generator_options.merge(Hash[*ARGV])
|
|
15
|
+
.map { |node| node.join(' ') }
|
|
16
|
+
.join(' ')
|
|
17
|
+
|
|
18
|
+
system "swagger-codegen generate #{generator_options}"
|
data/bin/refresh_schemas
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'net/http'
|
|
4
|
+
require 'json'
|
|
5
|
+
|
|
6
|
+
api_docs_uri = URI('https://api.notonthehighstreet.com/doc-1.0/api-docs.json')
|
|
7
|
+
|
|
8
|
+
schemas_dir = File.expand_path('../schemas', __dir__)
|
|
9
|
+
|
|
10
|
+
def fetch_json(uri)
|
|
11
|
+
res = Net::HTTP.start(uri.hostname,
|
|
12
|
+
uri.port,
|
|
13
|
+
use_ssl: uri.scheme == 'https') do |http|
|
|
14
|
+
http.request(Net::HTTP::Get.new(uri))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
res.error! unless res.is_a?(Net::HTTPSuccess)
|
|
18
|
+
|
|
19
|
+
JSON.parse(res.body, symbolize_names: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Fix original schema invalid directives
|
|
23
|
+
def apply_ammendments(api_schema)
|
|
24
|
+
api_schema.fetch(:apis).each do |endpoint|
|
|
25
|
+
endpoint.fetch(:operations).each do |method|
|
|
26
|
+
method[:nickname] = method[:nickname].sub('Api::V1::', '') unless method[:nickname].nil?
|
|
27
|
+
|
|
28
|
+
token_parameter = method[:parameters].detect { |p| p[:name] == 'token' }
|
|
29
|
+
|
|
30
|
+
if token_parameter
|
|
31
|
+
method[:authorizations] ||= { token: [] }
|
|
32
|
+
method[:parameters].delete(token_parameter)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
method[:parameters].each do |p|
|
|
36
|
+
p[:required] = true if p[:required] == 'required'
|
|
37
|
+
|
|
38
|
+
case p[:type]
|
|
39
|
+
when 'date'
|
|
40
|
+
p[:type] = 'string'
|
|
41
|
+
p[:format] = 'date'
|
|
42
|
+
when 'datetime'
|
|
43
|
+
p[:type] = 'string'
|
|
44
|
+
p[:format] = 'date-time'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
p[:name] = :payload if p[:paramType] == 'body' && p[:name] == ''
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
api_schema.fetch(:models).values.each do |model|
|
|
53
|
+
model.fetch(:properties).values.each do |p|
|
|
54
|
+
p[:type] = p[:items][:'$ref'] if p[:type] == 'complex'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
main_schema = fetch_json(api_docs_uri)
|
|
60
|
+
|
|
61
|
+
main_schema.fetch(:apis).each do |api|
|
|
62
|
+
api_path = api.fetch(:path).sub('.{format}', '.json')
|
|
63
|
+
|
|
64
|
+
api_uri = api_docs_uri.dup
|
|
65
|
+
|
|
66
|
+
api_uri.path = ['/', api_path].join
|
|
67
|
+
|
|
68
|
+
api[:path] = File.basename(api_path) # making path relative to schema file
|
|
69
|
+
|
|
70
|
+
File.open [schemas_dir, File.basename(api_uri.path)].join('/'), 'w' do |io|
|
|
71
|
+
api_schema = fetch_json(api_uri)
|
|
72
|
+
|
|
73
|
+
apply_ammendments(api_schema) unless ARGV.include?('--skip-amendments')
|
|
74
|
+
|
|
75
|
+
io.write JSON.pretty_generate(api_schema)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
main_schema[:info] ||= {
|
|
80
|
+
title: 'Noths',
|
|
81
|
+
description: 'www.notonthehighstreet.com API client'
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
main_schema[:authorizations] ||= {
|
|
85
|
+
token: {
|
|
86
|
+
'type': 'apiKey',
|
|
87
|
+
'passAs': 'query',
|
|
88
|
+
'keyname': 'token'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
File.open [schemas_dir, File.basename(api_docs_uri.path)].join('/'), 'w' do |io|
|
|
93
|
+
io.write JSON.pretty_generate(main_schema)
|
|
94
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Noths::AcceptanceBulkModel
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**id** | **Integer** | Order Id |
|
|
7
|
+
**estimated_delivery_date** | **Date** | 'yyyy-mm-dd' |
|
|
8
|
+
**estimated_dispatch_at** | **Date** | 'yyyy-mm-dd' |
|
|
9
|
+
**confirmation_note** | **String** | | [optional]
|
|
10
|
+
|
|
11
|
+
|
data/docs/Currency.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Noths::Currency
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**subunit_to_unit** | **Integer** | |
|
|
7
|
+
**symbol** | **String** | |
|
|
8
|
+
**html_entity** | **String** | |
|
|
9
|
+
**iso_code** | **String** | |
|
|
10
|
+
|
|
11
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Noths::DeliveryAddress
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**address1** | **String** | |
|
|
7
|
+
**address2** | **String** | |
|
|
8
|
+
**town** | **String** | |
|
|
9
|
+
**post_code** | **String** | |
|
|
10
|
+
**country** | **String** | |
|
|
11
|
+
**county** | **String** | |
|
|
12
|
+
|
|
13
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Noths::DispatchBulkModel
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**id** | **Integer** | Order Id |
|
|
7
|
+
**estimated_delivery_date** | **Date** | 'yyyy-mm-dd' |
|
|
8
|
+
**resolve_enquiry** | **BOOLEAN** | | [optional]
|
|
9
|
+
**tracking_number** | **String** | | [optional]
|
|
10
|
+
**parcel_tracking_url** | **String** | | [optional]
|
|
11
|
+
|
|
12
|
+
|