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,53 +1,24 @@
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
12
-
13
- require 'spec_helper'
14
- require 'json'
15
- require 'date'
1
+ # frozen_string_literal: true
16
2
 
17
3
  # Unit tests for Noths::RefundResponse
18
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
- # Please update as you see appropriate
20
4
  describe 'RefundResponse' do
21
- before do
22
- # run before each test
23
- @instance = Noths::RefundResponse.new
24
- end
25
-
26
- after do
27
- # run after each test
28
- end
5
+ let(:instance) { Noths::RefundResponse.new }
29
6
 
30
7
  describe 'test an instance of RefundResponse' do
31
8
  it 'should create an instance of RefundResponse' do
32
- expect(@instance).to be_instance_of(Noths::RefundResponse)
9
+ expect(instance).to be_instance_of(Noths::RefundResponse)
33
10
  end
34
11
  end
35
12
  describe 'test attribute "status"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
13
+ it 'should work'
39
14
  end
40
15
 
41
16
  describe 'test attribute "errors"' do
42
- it 'should work' do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
17
+ it 'should work'
45
18
  end
46
19
 
47
20
  describe 'test attribute "order_refund"' do
48
- it 'should work' do
49
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
- end
21
+ it 'should work'
51
22
  end
52
23
 
53
24
  end
@@ -1,47 +1,20 @@
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
12
-
13
- require 'spec_helper'
14
- require 'json'
15
- require 'date'
1
+ # frozen_string_literal: true
16
2
 
17
3
  # Unit tests for Noths::SearchResultMeta
18
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
- # Please update as you see appropriate
20
4
  describe 'SearchResultMeta' do
21
- before do
22
- # run before each test
23
- @instance = Noths::SearchResultMeta.new
24
- end
25
-
26
- after do
27
- # run after each test
28
- end
5
+ let(:instance) { Noths::SearchResultMeta.new }
29
6
 
30
7
  describe 'test an instance of SearchResultMeta' do
31
8
  it 'should create an instance of SearchResultMeta' do
32
- expect(@instance).to be_instance_of(Noths::SearchResultMeta)
9
+ expect(instance).to be_instance_of(Noths::SearchResultMeta)
33
10
  end
34
11
  end
35
12
  describe 'test attribute "results"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
13
+ it 'should work'
39
14
  end
40
15
 
41
16
  describe 'test attribute "total"' do
42
- it 'should work' do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
17
+ it 'should work'
45
18
  end
46
19
 
47
20
  end
@@ -1,53 +1,24 @@
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
12
-
13
- require 'spec_helper'
14
- require 'json'
15
- require 'date'
1
+ # frozen_string_literal: true
16
2
 
17
3
  # Unit tests for Noths::User
18
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
- # Please update as you see appropriate
20
4
  describe 'User' do
21
- before do
22
- # run before each test
23
- @instance = Noths::User.new
24
- end
25
-
26
- after do
27
- # run after each test
28
- end
5
+ let(:instance) { Noths::User.new }
29
6
 
30
7
  describe 'test an instance of User' do
31
8
  it 'should create an instance of User' do
32
- expect(@instance).to be_instance_of(Noths::User)
9
+ expect(instance).to be_instance_of(Noths::User)
33
10
  end
34
11
  end
35
12
  describe 'test attribute "name"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
13
+ it 'should work'
39
14
  end
40
15
 
41
16
  describe 'test attribute "telephone"' do
42
- it 'should work' do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
17
+ it 'should work'
45
18
  end
46
19
 
47
20
  describe 'test attribute "telephone_country_code"' do
48
- it 'should work' do
49
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
- end
21
+ it 'should work'
51
22
  end
52
23
 
53
24
  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
  # load the gem
14
4
  require 'noths'
@@ -8,7 +8,7 @@
8
8
  "gemAuthorEmail":"rustam@sharshenov.com",
9
9
  "gemHomepage":"https://github.com/veeqo/noths",
10
10
  "gemLicense":"MIT",
11
- "gemVersion":"0.1.0",
11
+ "gemVersion":"0.2.0",
12
12
  "moduleName":"Noths",
13
13
  "gemSummary":"Swagger client for https://www.notonthehighstreet.com/",
14
14
  "gemDescription":"Swagger client for https://www.notonthehighstreet.com/"
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.0.0'
7
+ end
@@ -0,0 +1,127 @@
1
+ # {{gemName}}
2
+
3
+ {{moduleName}} - the Ruby gem for the www.notonthehighstreet.com API
4
+
5
+ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
6
+
7
+ - API version: {{appVersion}}
8
+ - Package version: {{gemVersion}}
9
+ {{^hideGenerationTimestamp}}
10
+ - Build date: {{generatedDate}}
11
+ {{/hideGenerationTimestamp}}
12
+ - Build package: {{generatorClass}}
13
+ {{#infoUrl}}
14
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
15
+ {{/infoUrl}}
16
+
17
+ ## Installation
18
+
19
+ ### Build a gem
20
+
21
+ To build the Ruby code into a gem:
22
+
23
+ ```shell
24
+ gem build {{{gemName}}}.gemspec
25
+ ```
26
+
27
+ Then either install the gem locally:
28
+
29
+ ```shell
30
+ gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
31
+ ```
32
+ (for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
33
+
34
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
35
+
36
+ Finally add this to the Gemfile:
37
+
38
+ gem '{{{gemName}}}', '~> {{{gemVersion}}}'
39
+
40
+ ### Install from Git
41
+
42
+ If the Ruby gem is hosted at a git repository: https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
43
+
44
+ gem '{{{gemName}}}', :git => 'https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
45
+
46
+ ### Include the Ruby code directly
47
+
48
+ Include the Ruby code directly using `-I` as follows:
49
+
50
+ ```shell
51
+ ruby -Ilib script.rb
52
+ ```
53
+
54
+ ## Getting Started
55
+
56
+ Please follow the [installation](#installation) procedure and then run the following code:
57
+ ```ruby
58
+ # Load the gem
59
+ require '{{{gemName}}}'
60
+ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
61
+ # Setup authorization
62
+ {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}
63
+ # Configure HTTP basic authorization: {{{name}}}
64
+ config.username = 'YOUR USERNAME'
65
+ config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
66
+ # Configure API key authorization: {{{name}}}
67
+ config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY'
68
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
69
+ #config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
70
+ # Configure OAuth2 access token for authorization: {{{name}}}
71
+ config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
72
+ {{/authMethods}}end
73
+ {{/hasAuthMethods}}
74
+
75
+ api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
76
+ {{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
77
+ {{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
78
+ {{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
79
+ opts = { {{#allParams}}{{^required}}
80
+ {{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
81
+ }{{/hasOptionalParams}}{{/hasParams}}
82
+
83
+ begin
84
+ {{#summary}} #{{{.}}}
85
+ {{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
86
+ p result{{/returnType}}
87
+ rescue {{{moduleName}}}::ApiError => e
88
+ puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
89
+ end
90
+ {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
91
+ ```
92
+
93
+ ## Documentation for API Endpoints
94
+
95
+ All URIs are relative to https://api.notonthehighstreet.com
96
+
97
+ Class | Method | HTTP request | Description
98
+ ------------ | ------------- | ------------- | -------------
99
+ {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
100
+ {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
101
+
102
+ ## Documentation for Models
103
+
104
+ {{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
105
+ {{/model}}{{/models}}
106
+
107
+ ## Documentation for Authorization
108
+
109
+ {{^authMethods}} All endpoints do not require authorization.
110
+ {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
111
+ {{#authMethods}}### {{name}}
112
+
113
+ {{#isApiKey}}- **Type**: API key
114
+ - **API key parameter name**: {{keyParamName}}
115
+ - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
116
+ {{/isApiKey}}
117
+ {{#isBasic}}- **Type**: HTTP basic authentication
118
+ {{/isBasic}}
119
+ {{#isOAuth}}- **Type**: OAuth
120
+ - **Flow**: {{flow}}
121
+ - **Authorization URL**: {{authorizationUrl}}
122
+ - **Scopes**: {{^scopes}}N/A{{/scopes}}
123
+ {{#scopes}} - {{scope}}: {{description}}
124
+ {{/scopes}}
125
+ {{/isOAuth}}
126
+
127
+ {{/authMethods}}
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
@@ -0,0 +1,194 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+
5
+ module {{moduleName}}
6
+ {{#operations}}
7
+ class {{classname}}
8
+ attr_accessor :api_client
9
+
10
+ def initialize(api_client = ApiClient.default)
11
+ @api_client = api_client
12
+ end
13
+ {{#operation}}
14
+ {{newline}}
15
+ # {{{summary}}}
16
+ # {{{notes}}}
17
+ {{#allParams}}{{#required}} # @param {{paramName}} {{description}}
18
+ {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
19
+ {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
20
+ {{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
21
+ def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
22
+ {{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
23
+ {{#returnType}}return data{{/returnType}}{{^returnType}}return nil{{/returnType}}
24
+ end
25
+
26
+ # {{summary}}
27
+ # {{notes}}
28
+ {{#allParams}}{{#required}} # @param {{paramName}} {{description}}
29
+ {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
30
+ {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
31
+ {{/required}}{{/allParams}} # @return [Array<({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Fixnum, Hash)>] {{#returnType}}{{{returnType}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers
32
+ def {{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
33
+ if @api_client.config.debugging
34
+ @api_client.config.logger.debug "Calling API: {{classname}}.{{operationId}} ..."
35
+ end
36
+ {{#allParams}}
37
+ {{#required}}
38
+ # verify the required parameter '{{paramName}}' is set
39
+ if @api_client.config.client_side_validation && {{{paramName}}}.nil?
40
+ fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}"
41
+ end
42
+ {{#isEnum}}
43
+ {{^isContainer}}
44
+ # verify enum value
45
+ if @api_client.config.client_side_validation && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?({{{paramName}}})
46
+ fail ArgumentError, "invalid value for '{{{paramName}}}', must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"
47
+ end
48
+ {{/isContainer}}
49
+ {{/isEnum}}
50
+ {{/required}}
51
+ {{^required}}
52
+ {{#isEnum}}
53
+ {{#collectionFormat}}
54
+ if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all?{|item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item)}
55
+ fail ArgumentError, 'invalid value for "{{{paramName}}}", must include one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}'
56
+ end
57
+ {{/collectionFormat}}
58
+ {{^collectionFormat}}
59
+ if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(opts[:'{{{paramName}}}'])
60
+ fail ArgumentError, 'invalid value for "{{{paramName}}}", must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}'
61
+ end
62
+ {{/collectionFormat}}
63
+ {{/isEnum}}
64
+ {{/required}}
65
+ {{#hasValidation}}
66
+ {{#maxLength}}
67
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}}
68
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be smaller than or equal to {{{maxLength}}}.'
69
+ end
70
+
71
+ {{/maxLength}}
72
+ {{#minLength}}
73
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}}
74
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be great than or equal to {{{minLength}}}.'
75
+ end
76
+
77
+ {{/minLength}}
78
+ {{#maximum}}
79
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
80
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.'
81
+ end
82
+
83
+ {{/maximum}}
84
+ {{#minimum}}
85
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
86
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.'
87
+ end
88
+
89
+ {{/minimum}}
90
+ {{#pattern}}
91
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} !~ Regexp.new({{{pattern}}})
92
+ fail ArgumentError, "invalid value for '{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:\"{{{paramName}}}\"]{{/required}}' when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."
93
+ end
94
+
95
+ {{/pattern}}
96
+ {{#maxItems}}
97
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length > {{{maxItems}}}
98
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{{maxItems}}}.'
99
+ end
100
+
101
+ {{/maxItems}}
102
+ {{#minItems}}
103
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length < {{{minItems}}}
104
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{{minItems}}}.'
105
+ end
106
+
107
+ {{/minItems}}
108
+ {{/hasValidation}}
109
+ {{/allParams}}
110
+ # resource path
111
+ local_var_path = "{{{path}}}"{{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
112
+
113
+ # query parameters
114
+ query_params = {}
115
+ {{#queryParams}}
116
+ {{#required}}
117
+ query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
118
+ {{/required}}
119
+ {{/queryParams}}
120
+ {{#queryParams}}
121
+ {{^required}}
122
+ query_params[:'{{{baseName}}}'] = normalize({{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}}) if !opts[:'{{{paramName}}}'].nil?
123
+ {{/required}}
124
+ {{/queryParams}}
125
+
126
+ # header parameters
127
+ header_params = {}
128
+ {{#hasProduces}}
129
+ # HTTP header 'Accept' (if needed)
130
+ header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}])
131
+ {{/hasProduces}}
132
+ {{#hasConsumes}}
133
+ # HTTP header 'Content-Type'
134
+ header_params['Content-Type'] = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}])
135
+ {{/hasConsumes}}
136
+ {{#headerParams}}
137
+ {{#required}}
138
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
139
+ {{/required}}
140
+ {{/headerParams}}
141
+ {{#headerParams}}
142
+ {{^required}}
143
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
144
+ {{/required}}
145
+ {{/headerParams}}
146
+
147
+ # form parameters
148
+ form_params = {}
149
+ {{#formParams}}
150
+ {{#required}}
151
+ form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
152
+ {{/required}}
153
+ {{/formParams}}
154
+ {{#formParams}}
155
+ {{^required}}
156
+ form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil?
157
+ {{/required}}
158
+ {{/formParams}}
159
+
160
+ # http body (model)
161
+ {{^bodyParam}}
162
+ post_body = nil
163
+ {{/bodyParam}}
164
+ {{#bodyParam}}
165
+ post_body = @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}})
166
+ {{/bodyParam}}
167
+ auth_names = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
168
+ data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path,
169
+ :header_params => header_params,
170
+ :query_params => query_params,
171
+ :form_params => form_params,
172
+ :body => post_body,
173
+ :auth_names => auth_names{{#returnType}},
174
+ :return_type => '{{{returnType}}}'{{/returnType}})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
177
+ end
178
+ return data, status_code, headers
179
+ end
180
+ {{/operation}}
181
+
182
+ private
183
+
184
+ def normalize(param)
185
+ case param
186
+ when Date, DateTime, Time
187
+ param.to_s(:iso8601)
188
+ else
189
+ param
190
+ end
191
+ end
192
+ end
193
+ {{/operations}}
194
+ end