rose-nielsen-sdk 0.0.6 → 0.0.7
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/README.md +18 -60
- data/lib/{swagger_petstore → cypress_test_api}/api_helper.rb +2 -2
- data/lib/cypress_test_api/client.rb +47 -0
- data/lib/{swagger_petstore → cypress_test_api}/configuration.rb +17 -41
- data/lib/cypress_test_api/controllers/api_controller.rb +102 -0
- data/lib/{swagger_petstore → cypress_test_api}/controllers/base_controller.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/exceptions/api_exception.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_call_back.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_method_enum.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_request.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_response.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/proxy_settings.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/models/base_model.rb +2 -2
- data/lib/cypress_test_api/models/custom_enum.rb +26 -0
- data/lib/{swagger_petstore/models/category.rb → cypress_test_api/models/deer.rb} +18 -21
- data/lib/cypress_test_api/models/item.rb +166 -0
- data/lib/{swagger_petstore/models/category2.rb → cypress_test_api/models/item_response.rb} +19 -10
- data/lib/cypress_test_api/models/lion.rb +68 -0
- data/lib/cypress_test_api/models/message.rb +68 -0
- data/lib/{swagger_petstore/models/api_response.rb → cypress_test_api/models/message2.rb} +14 -24
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +70 -0
- data/lib/cypress_test_api/models/nac_tag.rb +265 -0
- data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +29 -0
- data/lib/cypress_test_api/models/response_http400.rb +62 -0
- data/lib/{swagger_petstore/models/tag.rb → cypress_test_api/models/response_http404.rb} +9 -18
- data/lib/cypress_test_api/models/status11_enum.rb +26 -0
- data/lib/cypress_test_api/models/status1_enum.rb +26 -0
- data/lib/{swagger_petstore → cypress_test_api}/models/status_enum.rb +9 -9
- data/lib/cypress_test_api/models/tokens_request.rb +60 -0
- data/lib/{swagger_petstore → cypress_test_api}/utilities/date_time_helper.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/utilities/file_wrapper.rb +2 -2
- data/lib/cypress_test_api.rb +55 -0
- data/test/controllers/controller_test_base.rb +5 -13
- data/test/controllers/test_api_controller.rb +40 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +33 -40
- data/lib/swagger_petstore/client.rb +0 -84
- data/lib/swagger_petstore/controllers/pet_controller.rb +0 -206
- data/lib/swagger_petstore/controllers/store_controller.rb +0 -94
- data/lib/swagger_petstore/controllers/user_controller.rb +0 -165
- data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +0 -64
- data/lib/swagger_petstore/http/auth/api_key.rb +0 -42
- data/lib/swagger_petstore/http/auth/http_basic.rb +0 -50
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +0 -98
- data/lib/swagger_petstore/models/content_type_enum.rb +0 -20
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +0 -45
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +0 -23
- data/lib/swagger_petstore/models/o_auth_token.rb +0 -96
- data/lib/swagger_petstore/models/order.rb +0 -120
- data/lib/swagger_petstore/models/pet.rb +0 -117
- data/lib/swagger_petstore/models/pet_request.rb +0 -117
- data/lib/swagger_petstore/models/status1_enum.rb +0 -26
- data/lib/swagger_petstore/models/status2_enum.rb +0 -26
- data/lib/swagger_petstore/models/store_order_request.rb +0 -120
- data/lib/swagger_petstore/models/user.rb +0 -132
- data/lib/swagger_petstore/models/user_request.rb +0 -132
- data/lib/swagger_petstore.rb +0 -62
- data/test/controllers/test_store_controller.rb +0 -31
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# cypress_test_api
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
4
4
|
# ( https://www.apimatic.io ).
|
@@ -8,30 +8,22 @@ require 'minitest/autorun'
|
|
8
8
|
require 'minitest/hell'
|
9
9
|
require 'minitest/pride'
|
10
10
|
require 'minitest/proveit'
|
11
|
-
require '
|
11
|
+
require 'cypress_test_api'
|
12
12
|
require_relative '../http_response_catcher'
|
13
13
|
|
14
14
|
class ControllerTestBase < Minitest::Test
|
15
15
|
parallelize_me!
|
16
|
-
include
|
16
|
+
include CypressTestApi
|
17
17
|
include CoreLibrary
|
18
18
|
|
19
19
|
# Create configuration and set any test parameters
|
20
20
|
def create_configuration
|
21
|
-
Configuration.new(
|
22
|
-
http_basic_credentials: HttpBasicCredentials.new(username: 'test',
|
23
|
-
passwprd: 'testPassword'),
|
24
|
-
http_callback: HttpResponseCatcher.new
|
25
|
-
)
|
21
|
+
Configuration.new(http_callback: HttpResponseCatcher.new)
|
26
22
|
end
|
27
23
|
|
28
24
|
# Initializes the base test controller
|
29
25
|
def setup_class
|
30
26
|
_config = create_configuration
|
31
27
|
@client = Client.new(config: _config)
|
32
|
-
|
33
|
-
petstore_auth_token = @client.petstore_auth.fetch_token()
|
34
|
-
petstore_auth_credentials = _config.petstore_auth_credentials.clone_with(o_auth_token: petstore_auth_token)
|
35
|
-
_config = _config.clone_with(petstore_auth_credentials: petstore_auth_credentials)
|
36
|
-
@client = Client.new(config: _config)
|
37
28
|
end
|
29
|
+
end
|
38
30
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# cypress_test_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
4
|
+
# ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class APIControllerTest < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.client
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Generates a new OAuth token with the specified scopes.
|
17
|
+
def test_create_o_auth_token
|
18
|
+
# Parameters for the API call
|
19
|
+
body = nil
|
20
|
+
|
21
|
+
# Perform the API call through the SDK function
|
22
|
+
@controller.create_o_auth_token(body: body)
|
23
|
+
|
24
|
+
# Test response code
|
25
|
+
assert_equal(201, @response_catcher.response.status_code)
|
26
|
+
end
|
27
|
+
|
28
|
+
# This endpoint accepts a complex structure with multiple arrays.
|
29
|
+
def test_test_endpointwith_arrays
|
30
|
+
# Parameters for the API call
|
31
|
+
body = nil
|
32
|
+
|
33
|
+
# Perform the API call through the SDK function
|
34
|
+
@controller.test_endpointwith_arrays(body: body)
|
35
|
+
|
36
|
+
# Test response code
|
37
|
+
assert_equal(200, @response_catcher.response.status_code)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# cypress_test_api
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
4
4
|
# ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
class HttpResponseCatcher <
|
6
|
+
class HttpResponseCatcher < CypressTestApi::HttpCallBack
|
7
7
|
attr_reader :response
|
8
8
|
|
9
9
|
def on_before_request(request)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rose-nielsen-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zahra Naseem
|
@@ -89,46 +89,39 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- LICENSE
|
91
91
|
- README.md
|
92
|
-
- lib/
|
93
|
-
- lib/
|
94
|
-
- lib/
|
95
|
-
- lib/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
102
|
-
- lib/
|
103
|
-
- lib/
|
104
|
-
- lib/
|
105
|
-
- lib/
|
106
|
-
- lib/
|
107
|
-
- lib/
|
108
|
-
- lib/
|
109
|
-
- lib/
|
110
|
-
- lib/
|
111
|
-
- lib/
|
112
|
-
- lib/
|
113
|
-
- lib/
|
114
|
-
- lib/
|
115
|
-
- lib/
|
116
|
-
- lib/
|
117
|
-
- lib/
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/swagger_petstore/models/status_enum.rb
|
124
|
-
- lib/swagger_petstore/models/store_order_request.rb
|
125
|
-
- lib/swagger_petstore/models/tag.rb
|
126
|
-
- lib/swagger_petstore/models/user.rb
|
127
|
-
- lib/swagger_petstore/models/user_request.rb
|
128
|
-
- lib/swagger_petstore/utilities/date_time_helper.rb
|
129
|
-
- lib/swagger_petstore/utilities/file_wrapper.rb
|
92
|
+
- lib/cypress_test_api.rb
|
93
|
+
- lib/cypress_test_api/api_helper.rb
|
94
|
+
- lib/cypress_test_api/client.rb
|
95
|
+
- lib/cypress_test_api/configuration.rb
|
96
|
+
- lib/cypress_test_api/controllers/api_controller.rb
|
97
|
+
- lib/cypress_test_api/controllers/base_controller.rb
|
98
|
+
- lib/cypress_test_api/exceptions/api_exception.rb
|
99
|
+
- lib/cypress_test_api/http/http_call_back.rb
|
100
|
+
- lib/cypress_test_api/http/http_method_enum.rb
|
101
|
+
- lib/cypress_test_api/http/http_request.rb
|
102
|
+
- lib/cypress_test_api/http/http_response.rb
|
103
|
+
- lib/cypress_test_api/http/proxy_settings.rb
|
104
|
+
- lib/cypress_test_api/models/base_model.rb
|
105
|
+
- lib/cypress_test_api/models/custom_enum.rb
|
106
|
+
- lib/cypress_test_api/models/deer.rb
|
107
|
+
- lib/cypress_test_api/models/item.rb
|
108
|
+
- lib/cypress_test_api/models/item_response.rb
|
109
|
+
- lib/cypress_test_api/models/lion.rb
|
110
|
+
- lib/cypress_test_api/models/message.rb
|
111
|
+
- lib/cypress_test_api/models/message2.rb
|
112
|
+
- lib/cypress_test_api/models/multiple_arrays_request.rb
|
113
|
+
- lib/cypress_test_api/models/nac_tag.rb
|
114
|
+
- lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb
|
115
|
+
- lib/cypress_test_api/models/response_http400.rb
|
116
|
+
- lib/cypress_test_api/models/response_http404.rb
|
117
|
+
- lib/cypress_test_api/models/status11_enum.rb
|
118
|
+
- lib/cypress_test_api/models/status1_enum.rb
|
119
|
+
- lib/cypress_test_api/models/status_enum.rb
|
120
|
+
- lib/cypress_test_api/models/tokens_request.rb
|
121
|
+
- lib/cypress_test_api/utilities/date_time_helper.rb
|
122
|
+
- lib/cypress_test_api/utilities/file_wrapper.rb
|
130
123
|
- test/controllers/controller_test_base.rb
|
131
|
-
- test/controllers/
|
124
|
+
- test/controllers/test_api_controller.rb
|
132
125
|
- test/http_response_catcher.rb
|
133
126
|
homepage: https://www.medika.tv
|
134
127
|
licenses:
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# swagger_petstore client class.
|
8
|
-
class Client
|
9
|
-
include CoreLibrary
|
10
|
-
attr_reader :config, :auth_managers
|
11
|
-
|
12
|
-
# Returns the configured authentication petstore_auth instance.
|
13
|
-
def petstore_auth
|
14
|
-
@auth_managers['petstore_auth']
|
15
|
-
end
|
16
|
-
|
17
|
-
# Access to pet controller.
|
18
|
-
# @return [PetController] Returns the controller instance.
|
19
|
-
def pet
|
20
|
-
@pet ||= PetController.new @global_configuration
|
21
|
-
end
|
22
|
-
|
23
|
-
# Access to store controller.
|
24
|
-
# @return [StoreController] Returns the controller instance.
|
25
|
-
def store
|
26
|
-
@store ||= StoreController.new @global_configuration
|
27
|
-
end
|
28
|
-
|
29
|
-
# Access to user controller.
|
30
|
-
# @return [UserController] Returns the controller instance.
|
31
|
-
def user
|
32
|
-
@user ||= UserController.new @global_configuration
|
33
|
-
end
|
34
|
-
|
35
|
-
def initialize(
|
36
|
-
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
37
|
-
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
38
|
-
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
39
|
-
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
40
|
-
environment: Environment::PRODUCTION, api_key_credentials: nil,
|
41
|
-
http_basic_credentials: nil, petstore_auth_credentials: nil,
|
42
|
-
test_header: 'TestHeaderDefaultValue', config: nil
|
43
|
-
)
|
44
|
-
@config = if config.nil?
|
45
|
-
Configuration.new(
|
46
|
-
connection: connection, adapter: adapter, timeout: timeout,
|
47
|
-
max_retries: max_retries, retry_interval: retry_interval,
|
48
|
-
backoff_factor: backoff_factor,
|
49
|
-
retry_statuses: retry_statuses,
|
50
|
-
retry_methods: retry_methods, http_callback: http_callback,
|
51
|
-
proxy_settings: proxy_settings, environment: environment,
|
52
|
-
api_key_credentials: api_key_credentials,
|
53
|
-
http_basic_credentials: http_basic_credentials,
|
54
|
-
petstore_auth_credentials: petstore_auth_credentials,
|
55
|
-
test_header: test_header
|
56
|
-
)
|
57
|
-
else
|
58
|
-
config
|
59
|
-
end
|
60
|
-
|
61
|
-
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
62
|
-
.base_uri_executor(@config.method(:get_base_uri))
|
63
|
-
.global_errors(BaseController::GLOBAL_ERRORS)
|
64
|
-
.user_agent(BaseController.user_agent)
|
65
|
-
.global_header('TestHeader', @config.test_header)
|
66
|
-
|
67
|
-
initialize_auth_managers(@global_configuration)
|
68
|
-
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
69
|
-
end
|
70
|
-
|
71
|
-
# Initializes the auth managers hash used for authenticating API calls.
|
72
|
-
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
73
|
-
def initialize_auth_managers(global_config)
|
74
|
-
@auth_managers = {}
|
75
|
-
http_client_config = global_config.client_configuration
|
76
|
-
%w[api_key httpBasic petstore_auth].each { |auth| @auth_managers[auth] = nil }
|
77
|
-
@auth_managers['api_key'] = ApiKey.new(http_client_config.api_key_credentials)
|
78
|
-
@auth_managers['httpBasic'] = HttpBasic.new(http_client_config.http_basic_credentials)
|
79
|
-
@auth_managers['petstore_auth'] = PetstoreAuth.new(
|
80
|
-
http_client_config.petstore_auth_credentials, global_config
|
81
|
-
)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,206 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# PetController
|
8
|
-
class PetController < BaseController
|
9
|
-
# Returns a single pet
|
10
|
-
# @param [Integer] pet_id Required parameter: ID of pet to return
|
11
|
-
# @return [Pet] Response from the API call.
|
12
|
-
def get_pet_by_id(pet_id)
|
13
|
-
@api_call
|
14
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
15
|
-
'/pet/{petId}',
|
16
|
-
Server::DEFAULT)
|
17
|
-
.template_param(new_parameter(pet_id, key: 'petId')
|
18
|
-
.should_encode(true))
|
19
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
20
|
-
.auth(Single.new('api_key')))
|
21
|
-
.response(new_response_handler
|
22
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
23
|
-
.deserialize_into(Pet.method(:from_hash))
|
24
|
-
.local_error('400',
|
25
|
-
'Invalid ID supplied',
|
26
|
-
APIException)
|
27
|
-
.local_error('404',
|
28
|
-
'Pet not found',
|
29
|
-
APIException))
|
30
|
-
.execute
|
31
|
-
end
|
32
|
-
|
33
|
-
# Updates a pet in the store with form data
|
34
|
-
# @param [Integer] pet_id Required parameter: ID of pet that needs to be
|
35
|
-
# updated
|
36
|
-
# @param [ContentTypeEnum] content_type Required parameter: Example:
|
37
|
-
# @param [String] name Optional parameter: Updated name of the pet
|
38
|
-
# @param [String] status Optional parameter: Updated status of the pet
|
39
|
-
# @return [void] Response from the API call.
|
40
|
-
def update_pet_with_form(pet_id,
|
41
|
-
content_type,
|
42
|
-
name: nil,
|
43
|
-
status: nil)
|
44
|
-
@api_call
|
45
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
46
|
-
'/pet/{petId}',
|
47
|
-
Server::DEFAULT)
|
48
|
-
.template_param(new_parameter(pet_id, key: 'petId')
|
49
|
-
.should_encode(true))
|
50
|
-
.form_param(new_parameter(name, key: 'name'))
|
51
|
-
.form_param(new_parameter(status, key: 'status'))
|
52
|
-
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
53
|
-
.auth(Single.new('petstore_auth')))
|
54
|
-
.response(new_response_handler
|
55
|
-
.is_response_void(true)
|
56
|
-
.local_error('405',
|
57
|
-
'Invalid input',
|
58
|
-
APIException))
|
59
|
-
.execute
|
60
|
-
end
|
61
|
-
|
62
|
-
# Deletes a pet
|
63
|
-
# @param [Integer] pet_id Required parameter: Pet id to delete
|
64
|
-
# @param [String] api_key Optional parameter: Example:
|
65
|
-
# @return [void] Response from the API call.
|
66
|
-
def delete_pet(pet_id,
|
67
|
-
api_key: nil)
|
68
|
-
@api_call
|
69
|
-
.request(new_request_builder(HttpMethodEnum::DELETE,
|
70
|
-
'/pet/{petId}',
|
71
|
-
Server::DEFAULT)
|
72
|
-
.template_param(new_parameter(pet_id, key: 'petId')
|
73
|
-
.should_encode(true))
|
74
|
-
.header_param(new_parameter(api_key, key: 'api_key'))
|
75
|
-
.auth(Single.new('petstore_auth')))
|
76
|
-
.response(new_response_handler
|
77
|
-
.is_response_void(true)
|
78
|
-
.local_error('400',
|
79
|
-
'Invalid ID supplied',
|
80
|
-
APIException)
|
81
|
-
.local_error('404',
|
82
|
-
'Pet not found',
|
83
|
-
APIException))
|
84
|
-
.execute
|
85
|
-
end
|
86
|
-
|
87
|
-
# Add a new pet to the store
|
88
|
-
# @param [PetRequest] body Required parameter: Pet object that needs to be
|
89
|
-
# added to the store
|
90
|
-
# @return [void] Response from the API call.
|
91
|
-
def add_pet(body)
|
92
|
-
@api_call
|
93
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
94
|
-
'/pet',
|
95
|
-
Server::DEFAULT)
|
96
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
97
|
-
.body_param(new_parameter(body))
|
98
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
99
|
-
.auth(Single.new('petstore_auth')))
|
100
|
-
.response(new_response_handler
|
101
|
-
.is_response_void(true)
|
102
|
-
.local_error('405',
|
103
|
-
'Invalid input',
|
104
|
-
APIException))
|
105
|
-
.execute
|
106
|
-
end
|
107
|
-
|
108
|
-
# Update an existing pet
|
109
|
-
# @param [PetRequest] body Required parameter: Pet object that needs to be
|
110
|
-
# added to the store
|
111
|
-
# @return [void] Response from the API call.
|
112
|
-
def update_pet(body)
|
113
|
-
@api_call
|
114
|
-
.request(new_request_builder(HttpMethodEnum::PUT,
|
115
|
-
'/pet',
|
116
|
-
Server::DEFAULT)
|
117
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
118
|
-
.body_param(new_parameter(body))
|
119
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
120
|
-
.auth(Single.new('petstore_auth')))
|
121
|
-
.response(new_response_handler
|
122
|
-
.is_response_void(true)
|
123
|
-
.local_error('400',
|
124
|
-
'Invalid ID supplied',
|
125
|
-
APIException)
|
126
|
-
.local_error('404',
|
127
|
-
'Pet not found',
|
128
|
-
APIException)
|
129
|
-
.local_error('405',
|
130
|
-
'Validation exception',
|
131
|
-
APIException))
|
132
|
-
.execute
|
133
|
-
end
|
134
|
-
|
135
|
-
# Multiple status values can be provided with comma separated strings
|
136
|
-
# @param [Array[Status2Enum]] status Required parameter: Status values that
|
137
|
-
# need to be considered for filter
|
138
|
-
# @return [Array[Pet]] Response from the API call.
|
139
|
-
def find_pets_by_status(status)
|
140
|
-
@api_call
|
141
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
142
|
-
'/pet/findByStatus',
|
143
|
-
Server::DEFAULT)
|
144
|
-
.query_param(new_parameter(status, key: 'status'))
|
145
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
146
|
-
.auth(Single.new('petstore_auth')))
|
147
|
-
.response(new_response_handler
|
148
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
149
|
-
.deserialize_into(Pet.method(:from_hash))
|
150
|
-
.is_response_array(true)
|
151
|
-
.local_error('400',
|
152
|
-
'Invalid status value',
|
153
|
-
APIException))
|
154
|
-
.execute
|
155
|
-
end
|
156
|
-
|
157
|
-
# uploads an image
|
158
|
-
# @param [Integer] pet_id Required parameter: ID of pet to update
|
159
|
-
# @param [String] additional_metadata Optional parameter: Additional data to
|
160
|
-
# pass to server
|
161
|
-
# @param [File | UploadIO] file Optional parameter: file to upload
|
162
|
-
# @return [ApiResponse] Response from the API call.
|
163
|
-
def upload_file(pet_id,
|
164
|
-
additional_metadata: nil,
|
165
|
-
file: nil)
|
166
|
-
@api_call
|
167
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
168
|
-
'/pet/{petId}/uploadImage',
|
169
|
-
Server::DEFAULT)
|
170
|
-
.template_param(new_parameter(pet_id, key: 'petId')
|
171
|
-
.should_encode(true))
|
172
|
-
.form_param(new_parameter(additional_metadata, key: 'additionalMetadata'))
|
173
|
-
.multipart_param(new_parameter(file, key: 'file')
|
174
|
-
.default_content_type('application/octet-stream'))
|
175
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
176
|
-
.auth(Single.new('petstore_auth')))
|
177
|
-
.response(new_response_handler
|
178
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
179
|
-
.deserialize_into(ApiResponse.method(:from_hash)))
|
180
|
-
.execute
|
181
|
-
end
|
182
|
-
|
183
|
-
# Multiple tags can be provided with comma separated strings. Use tag1,
|
184
|
-
# tag2, tag3 for testing.
|
185
|
-
# @param [Array[String]] tags Required parameter: Tags to filter by
|
186
|
-
# @return [Array[Pet]] Response from the API call.
|
187
|
-
def find_pets_by_tags(tags)
|
188
|
-
warn 'Endpoint find_pets_by_tags in PetController is deprecated'
|
189
|
-
@api_call
|
190
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
191
|
-
'/pet/findByTags',
|
192
|
-
Server::DEFAULT)
|
193
|
-
.query_param(new_parameter(tags, key: 'tags'))
|
194
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
195
|
-
.auth(Single.new('petstore_auth')))
|
196
|
-
.response(new_response_handler
|
197
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
198
|
-
.deserialize_into(Pet.method(:from_hash))
|
199
|
-
.is_response_array(true)
|
200
|
-
.local_error('400',
|
201
|
-
'Invalid tag value',
|
202
|
-
APIException))
|
203
|
-
.execute
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# StoreController
|
8
|
-
class StoreController < BaseController
|
9
|
-
# For valid response try integer IDs with value >= 1 and <= 10. Other values
|
10
|
-
# will generated exceptions
|
11
|
-
# @param [Integer] order_id Required parameter: ID of pet that needs to be
|
12
|
-
# fetched
|
13
|
-
# @return [Order] Response from the API call.
|
14
|
-
def get_order_by_id(order_id)
|
15
|
-
@api_call
|
16
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
17
|
-
'/store/order/{orderId}',
|
18
|
-
Server::DEFAULT)
|
19
|
-
.template_param(new_parameter(order_id, key: 'orderId')
|
20
|
-
.should_encode(true))
|
21
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
22
|
-
.response(new_response_handler
|
23
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
24
|
-
.deserialize_into(Order.method(:from_hash))
|
25
|
-
.local_error('400',
|
26
|
-
'Invalid ID supplied',
|
27
|
-
APIException)
|
28
|
-
.local_error('404',
|
29
|
-
'Order not found',
|
30
|
-
APIException))
|
31
|
-
.execute
|
32
|
-
end
|
33
|
-
|
34
|
-
# For valid response try integer IDs with positive integer value. Negative
|
35
|
-
# or non-integer values will generate API errors
|
36
|
-
# @param [Integer] order_id Required parameter: ID of the order that needs
|
37
|
-
# to be deleted
|
38
|
-
# @return [void] Response from the API call.
|
39
|
-
def delete_order(order_id)
|
40
|
-
@api_call
|
41
|
-
.request(new_request_builder(HttpMethodEnum::DELETE,
|
42
|
-
'/store/order/{orderId}',
|
43
|
-
Server::DEFAULT)
|
44
|
-
.template_param(new_parameter(order_id, key: 'orderId')
|
45
|
-
.should_encode(true)))
|
46
|
-
.response(new_response_handler
|
47
|
-
.is_response_void(true)
|
48
|
-
.local_error('400',
|
49
|
-
'Invalid ID supplied',
|
50
|
-
APIException)
|
51
|
-
.local_error('404',
|
52
|
-
'Order not found',
|
53
|
-
APIException))
|
54
|
-
.execute
|
55
|
-
end
|
56
|
-
|
57
|
-
# Returns a map of status codes to quantities
|
58
|
-
# @return [Hash[String, Integer]] Response from the API call.
|
59
|
-
def get_inventory
|
60
|
-
@api_call
|
61
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
62
|
-
'/store/inventory',
|
63
|
-
Server::DEFAULT)
|
64
|
-
.auth(Single.new('api_key')))
|
65
|
-
.response(new_response_handler
|
66
|
-
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
67
|
-
.deserialize_into(proc do |response| response&.to_i end)
|
68
|
-
.is_primitive_response(true))
|
69
|
-
.execute
|
70
|
-
end
|
71
|
-
|
72
|
-
# Place an order for a pet
|
73
|
-
# @param [StoreOrderRequest] body Required parameter: order placed for
|
74
|
-
# purchasing the pet
|
75
|
-
# @return [Order] Response from the API call.
|
76
|
-
def place_order(body)
|
77
|
-
@api_call
|
78
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
79
|
-
'/store/order',
|
80
|
-
Server::DEFAULT)
|
81
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
82
|
-
.body_param(new_parameter(body))
|
83
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
84
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
85
|
-
.response(new_response_handler
|
86
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
87
|
-
.deserialize_into(Order.method(:from_hash))
|
88
|
-
.local_error('400',
|
89
|
-
'Invalid Order',
|
90
|
-
APIException))
|
91
|
-
.execute
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|