noths 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +10 -23
  4. data/bin/generate_gem +3 -1
  5. data/bin/refresh_schemas +22 -16
  6. data/docs/AcceptanceBulkModel.md +2 -2
  7. data/docs/DispatchBulkModel.md +1 -1
  8. data/docs/Financials.md +1 -1
  9. data/docs/Order.md +12 -11
  10. data/docs/OrdersApi.md +104 -151
  11. data/docs/RefundsApi.md +8 -12
  12. data/git_push.sh +55 -0
  13. data/lib/noths.rb +1 -11
  14. data/lib/noths/api/orders_api.rb +234 -114
  15. data/lib/noths/api/refunds_api.rb +25 -15
  16. data/lib/noths/api_client.rb +3 -12
  17. data/lib/noths/api_error.rb +16 -11
  18. data/lib/noths/configuration.rb +3 -20
  19. data/lib/noths/models/acceptance_bulk_model.rb +3 -14
  20. data/lib/noths/models/currency.rb +1 -12
  21. data/lib/noths/models/decline_bulk_model.rb +1 -12
  22. data/lib/noths/models/delivery_address.rb +1 -12
  23. data/lib/noths/models/delivery_service.rb +1 -12
  24. data/lib/noths/models/delivery_zone.rb +1 -12
  25. data/lib/noths/models/dispatch_bulk_model.rb +2 -13
  26. data/lib/noths/models/dispatch_notes_bulk_model.rb +1 -12
  27. data/lib/noths/models/enquiry.rb +1 -12
  28. data/lib/noths/models/enquiry_message.rb +1 -12
  29. data/lib/noths/models/error.rb +1 -12
  30. data/lib/noths/models/financials.rb +5 -14
  31. data/lib/noths/models/financials_details.rb +1 -12
  32. data/lib/noths/models/image_url.rb +1 -12
  33. data/lib/noths/models/item.rb +1 -12
  34. data/lib/noths/models/item_financials.rb +1 -12
  35. data/lib/noths/models/link.rb +1 -12
  36. data/lib/noths/models/manual_payment.rb +1 -12
  37. data/lib/noths/models/money.rb +1 -12
  38. data/lib/noths/models/order.rb +28 -28
  39. data/lib/noths/models/order_detail.rb +1 -12
  40. data/lib/noths/models/order_details_bulk_model.rb +1 -12
  41. data/lib/noths/models/order_index.rb +1 -12
  42. data/lib/noths/models/order_refund.rb +1 -12
  43. data/lib/noths/models/product.rb +1 -12
  44. data/lib/noths/models/product_option.rb +1 -12
  45. data/lib/noths/models/refund_response.rb +1 -12
  46. data/lib/noths/models/search_result_meta.rb +1 -12
  47. data/lib/noths/models/user.rb +1 -12
  48. data/lib/noths/version.rb +2 -12
  49. data/noths.gemspec +1 -11
  50. data/schemas/api-docs.json +3 -7
  51. data/schemas/orders.json +163 -88
  52. data/schemas/refunds.json +10 -5
  53. data/spec/api/orders_api_spec.rb +53 -99
  54. data/spec/api/refunds_api_spec.rb +6 -28
  55. data/spec/api_client_spec.rb +2 -14
  56. data/spec/configuration_spec.rb +9 -25
  57. data/spec/models/acceptance_bulk_model_spec.rb +7 -38
  58. data/spec/models/currency_spec.rb +7 -38
  59. data/spec/models/decline_bulk_model_spec.rb +5 -32
  60. data/spec/models/delivery_address_spec.rb +9 -44
  61. data/spec/models/delivery_service_spec.rb +5 -32
  62. data/spec/models/delivery_zone_spec.rb +5 -32
  63. data/spec/models/dispatch_bulk_model_spec.rb +8 -41
  64. data/spec/models/dispatch_notes_bulk_model_spec.rb +4 -29
  65. data/spec/models/enquiry_message_spec.rb +4 -29
  66. data/spec/models/enquiry_spec.rb +6 -35
  67. data/spec/models/error_spec.rb +5 -32
  68. data/spec/models/financials_details_spec.rb +6 -35
  69. data/spec/models/financials_spec.rb +21 -80
  70. data/spec/models/image_url_spec.rb +9 -44
  71. data/spec/models/item_financials_spec.rb +9 -44
  72. data/spec/models/item_spec.rb +11 -50
  73. data/spec/models/link_spec.rb +6 -35
  74. data/spec/models/manual_payment_spec.rb +7 -38
  75. data/spec/models/money_spec.rb +5 -32
  76. data/spec/models/order_detail_spec.rb +5 -32
  77. data/spec/models/order_details_bulk_model_spec.rb +4 -29
  78. data/spec/models/order_index_spec.rb +6 -35
  79. data/spec/models/order_refund_spec.rb +4 -29
  80. data/spec/models/order_spec.rb +53 -164
  81. data/spec/models/product_option_spec.rb +5 -32
  82. data/spec/models/product_spec.rb +8 -41
  83. data/spec/models/refund_response_spec.rb +6 -35
  84. data/spec/models/search_result_meta_spec.rb +5 -32
  85. data/spec/models/user_spec.rb +6 -35
  86. data/spec/spec_helper.rb +1 -11
  87. data/swagger_config.json +1 -1
  88. data/templates/Gemfile.mustache +7 -0
  89. data/templates/README.mustache +127 -0
  90. data/templates/Rakefile.mustache +8 -0
  91. data/templates/api.mustache +194 -0
  92. data/templates/api_client.mustache +383 -0
  93. data/templates/api_client_spec.mustache +214 -0
  94. data/templates/api_doc.mustache +79 -0
  95. data/templates/api_error.mustache +43 -0
  96. data/templates/api_info.mustache +12 -0
  97. data/templates/api_test.mustache +29 -0
  98. data/templates/base_object.mustache +102 -0
  99. data/templates/base_object_spec.mustache +107 -0
  100. data/templates/configuration.mustache +221 -0
  101. data/templates/configuration_spec.mustache +26 -0
  102. data/templates/gem.mustache +38 -0
  103. data/templates/gemspec.mustache +41 -0
  104. data/templates/git_push.sh.mustache +55 -0
  105. data/templates/gitignore.mustache +35 -0
  106. data/templates/model.mustache +7 -0
  107. data/templates/model_doc.mustache +9 -0
  108. data/templates/model_test.mustache +19 -0
  109. data/templates/partial_model_enum_class.mustache +13 -0
  110. data/templates/partial_model_generic.mustache +275 -0
  111. data/templates/rspec.mustache +2 -0
  112. data/templates/spec_helper.mustache +101 -0
  113. data/templates/version.mustache +5 -0
  114. metadata +30 -3
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require "uri"
14
4
 
@@ -22,27 +12,33 @@ module Noths
22
12
 
23
13
  # Refund an order
24
14
  # Refunds all or part of an order
15
+ # @param token Authentication credential
25
16
  # @param order_id Order id
26
17
  # @param refund_reason Customer will see this message
27
18
  # @param cents
28
19
  # @param [Hash] opts the optional parameters
29
20
  # @return [RefundResponse]
30
- def refunds_create(order_id, refund_reason, cents, opts = {})
31
- data, _status_code, _headers = refunds_create_with_http_info(order_id, refund_reason, cents, opts)
21
+ def refunds_create(token, order_id, refund_reason, cents, opts = {})
22
+ data, _status_code, _headers = refunds_create_with_http_info(token, order_id, refund_reason, cents, opts)
32
23
  return data
33
24
  end
34
25
 
35
26
  # Refund an order
36
27
  # Refunds all or part of an order
28
+ # @param token Authentication credential
37
29
  # @param order_id Order id
38
30
  # @param refund_reason Customer will see this message
39
31
  # @param cents
40
32
  # @param [Hash] opts the optional parameters
41
33
  # @return [Array<(RefundResponse, Fixnum, Hash)>] RefundResponse data, response status code and response headers
42
- def refunds_create_with_http_info(order_id, refund_reason, cents, opts = {})
34
+ def refunds_create_with_http_info(token, order_id, refund_reason, cents, opts = {})
43
35
  if @api_client.config.debugging
44
36
  @api_client.config.logger.debug "Calling API: RefundsApi.refunds_create ..."
45
37
  end
38
+ # verify the required parameter 'token' is set
39
+ if @api_client.config.client_side_validation && token.nil?
40
+ fail ArgumentError, "Missing the required parameter 'token' when calling RefundsApi.refunds_create"
41
+ end
46
42
  # verify the required parameter 'order_id' is set
47
43
  if @api_client.config.client_side_validation && order_id.nil?
48
44
  fail ArgumentError, "Missing the required parameter 'order_id' when calling RefundsApi.refunds_create"
@@ -60,9 +56,12 @@ module Noths
60
56
 
61
57
  # query parameters
62
58
  query_params = {}
59
+ query_params[:'token'] = token
63
60
 
64
61
  # header parameters
65
62
  header_params = {}
63
+ # HTTP header 'Content-Type'
64
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
66
65
 
67
66
  # form parameters
68
67
  form_params = {}
@@ -71,7 +70,7 @@ module Noths
71
70
 
72
71
  # http body (model)
73
72
  post_body = nil
74
- auth_names = ['token']
73
+ auth_names = []
75
74
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
76
75
  :header_params => header_params,
77
76
  :query_params => query_params,
@@ -84,5 +83,16 @@ module Noths
84
83
  end
85
84
  return data, status_code, headers
86
85
  end
86
+
87
+ private
88
+
89
+ def normalize(param)
90
+ case param
91
+ when Date, DateTime, Time
92
+ param.to_s(:iso8601)
93
+ else
94
+ param
95
+ end
96
+ end
87
97
  end
88
98
  end
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
  require 'json'
@@ -94,7 +84,6 @@ module Noths
94
84
  query_params = opts[:query_params] || {}
95
85
  form_params = opts[:form_params] || {}
96
86
 
97
- update_params_for_auth! header_params, query_params, opts[:auth_names]
98
87
 
99
88
  # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
100
89
  _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
@@ -283,6 +272,8 @@ module Noths
283
272
  when ::File, ::Array, nil
284
273
  # let typhoeus handle File, Array and nil parameters
285
274
  data[key] = value
275
+ when :DateTime, :Date
276
+ data[key] = value.to_s(:iso_8601)
286
277
  else
287
278
  data[key] = value.to_s
288
279
  end
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  module Noths
14
4
  class ApiError < StandardError
@@ -34,5 +24,20 @@ module Noths
34
24
  super arg
35
25
  end
36
26
  end
27
+
28
+ def to_s
29
+ [
30
+ super,
31
+ response
32
+ ].compact.join(': ')
33
+ end
34
+
35
+ def response
36
+ return if response_headers.blank?
37
+
38
+ return response_body unless response_headers['Content-Type'].include?('application/json')
39
+
40
+ JSON.parse(response_body, symbolize_names: true)
41
+ end
37
42
  end
38
43
  end
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'uri'
14
4
 
@@ -128,8 +118,8 @@ module Noths
128
118
  attr_accessor :force_ending_format
129
119
 
130
120
  def initialize
131
- @scheme = 'http'
132
- @host = ''
121
+ @scheme = 'https'
122
+ @host = 'api.notonthehighstreet.com'
133
123
  @base_path = '/'
134
124
  @api_key = {}
135
125
  @api_key_prefix = {}
@@ -196,13 +186,6 @@ module Noths
196
186
  # Returns Auth Settings hash for api client.
197
187
  def auth_settings
198
188
  {
199
- 'token' =>
200
- {
201
- type: 'api_key',
202
- in: 'query',
203
- key: 'token',
204
- value: api_key_with_prefix('token')
205
- },
206
189
  }
207
190
  end
208
191
  end
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -41,8 +31,8 @@ module Noths
41
31
  def self.swagger_types
42
32
  {
43
33
  :'id' => :'Integer',
44
- :'estimated_delivery_date' => :'Date',
45
- :'estimated_dispatch_at' => :'Date',
34
+ :'estimated_delivery_date' => :'DateTime',
35
+ :'estimated_dispatch_at' => :'DateTime',
46
36
  :'confirmation_note' => :'String'
47
37
  }
48
38
  end
@@ -204,7 +194,6 @@ module Noths
204
194
  hash = {}
205
195
  self.class.attribute_map.each_pair do |attr, param|
206
196
  value = self.send(attr)
207
- next if value.nil?
208
197
  hash[param] = _to_hash(value)
209
198
  end
210
199
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -206,7 +196,6 @@ module Noths
206
196
  hash = {}
207
197
  self.class.attribute_map.each_pair do |attr, param|
208
198
  value = self.send(attr)
209
- next if value.nil?
210
199
  hash[param] = _to_hash(value)
211
200
  end
212
201
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -179,7 +169,6 @@ module Noths
179
169
  hash = {}
180
170
  self.class.attribute_map.each_pair do |attr, param|
181
171
  value = self.send(attr)
182
- next if value.nil?
183
172
  hash[param] = _to_hash(value)
184
173
  end
185
174
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -234,7 +224,6 @@ module Noths
234
224
  hash = {}
235
225
  self.class.attribute_map.each_pair do |attr, param|
236
226
  value = self.send(attr)
237
- next if value.nil?
238
227
  hash[param] = _to_hash(value)
239
228
  end
240
229
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -178,7 +168,6 @@ module Noths
178
168
  hash = {}
179
169
  self.class.attribute_map.each_pair do |attr, param|
180
170
  value = self.send(attr)
181
- next if value.nil?
182
171
  hash[param] = _to_hash(value)
183
172
  end
184
173
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -178,7 +168,6 @@ module Noths
178
168
  hash = {}
179
169
  self.class.attribute_map.each_pair do |attr, param|
180
170
  value = self.send(attr)
181
- next if value.nil?
182
171
  hash[param] = _to_hash(value)
183
172
  end
184
173
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -43,7 +33,7 @@ module Noths
43
33
  def self.swagger_types
44
34
  {
45
35
  :'id' => :'Integer',
46
- :'estimated_delivery_date' => :'Date',
36
+ :'estimated_delivery_date' => :'DateTime',
47
37
  :'resolve_enquiry' => :'BOOLEAN',
48
38
  :'tracking_number' => :'String',
49
39
  :'parcel_tracking_url' => :'String'
@@ -207,7 +197,6 @@ module Noths
207
197
  hash = {}
208
198
  self.class.attribute_map.each_pair do |attr, param|
209
199
  value = self.send(attr)
210
- next if value.nil?
211
200
  hash[param] = _to_hash(value)
212
201
  end
213
202
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -165,7 +155,6 @@ module Noths
165
155
  hash = {}
166
156
  self.class.attribute_map.each_pair do |attr, param|
167
157
  value = self.send(attr)
168
- next if value.nil?
169
158
  hash[param] = _to_hash(value)
170
159
  end
171
160
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -194,7 +184,6 @@ module Noths
194
184
  hash = {}
195
185
  self.class.attribute_map.each_pair do |attr, param|
196
186
  value = self.send(attr)
197
- next if value.nil?
198
187
  hash[param] = _to_hash(value)
199
188
  end
200
189
  hash
@@ -1,14 +1,4 @@
1
- =begin
2
- #Noths
3
-
4
- #www.notonthehighstreet.com API client
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
1
+ # frozen_string_literal: true
12
2
 
13
3
  require 'date'
14
4
 
@@ -164,7 +154,6 @@ module Noths
164
154
  hash = {}
165
155
  self.class.attribute_map.each_pair do |attr, param|
166
156
  value = self.send(attr)
167
- next if value.nil?
168
157
  hash[param] = _to_hash(value)
169
158
  end
170
159
  hash