Class: SwaggerPetstoreOpenApi30::Client
- Inherits:
-
Object
- Object
- SwaggerPetstoreOpenApi30::Client
- Includes:
- CoreLibrary
- Defined in:
- lib/swagger_petstore_open_api30/client.rb
Overview
swagger_petstore_open_api30 client class.
Instance Attribute Summary collapse
-
#auth_managers ⇒ Object
readonly
Returns the value of attribute auth_managers.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(connection: nil, adapter: :net_http_persistent, timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put],, http_callback: nil, environment: Environment::PRODUCTION, api_key: nil, custom_header_authentication_credentials: nil, config: nil) ⇒ Client
constructor
A new instance of Client.
-
#initialize_auth_managers(global_config) ⇒ Object
Initializes the auth managers hash used for authenticating API calls.
-
#pet ⇒ PetController
Access to pet controller.
-
#store ⇒ StoreController
Access to store controller.
-
#user ⇒ UserController
Access to user controller.
Constructor Details
#initialize(connection: nil, adapter: :net_http_persistent, timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put],, http_callback: nil, environment: Environment::PRODUCTION, api_key: nil, custom_header_authentication_credentials: nil, config: nil) ⇒ Client
Returns a new instance of Client.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 30 def initialize( connection: nil, adapter: :net_http_persistent, timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put], http_callback: nil, environment: Environment::PRODUCTION, api_key: nil, custom_header_authentication_credentials: nil, config: nil ) @config = if config.nil? Configuration.new( connection: connection, adapter: adapter, timeout: timeout, max_retries: max_retries, retry_interval: retry_interval, backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, http_callback: http_callback, environment: environment, api_key: api_key, custom_header_authentication_credentials: custom_header_authentication_credentials ) else config end @global_configuration = GlobalConfiguration.new(client_configuration: @config) .base_uri_executor(@config.method(:get_base_uri)) .global_errors(BaseController::GLOBAL_ERRORS) .user_agent(BaseController.user_agent) initialize_auth_managers(@global_configuration) @global_configuration = @global_configuration.auth_managers(@auth_managers) end |
Instance Attribute Details
#auth_managers ⇒ Object (readonly)
Returns the value of attribute auth_managers.
10 11 12 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 10 def auth_managers @auth_managers end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 10 def config @config end |
Instance Method Details
#initialize_auth_managers(global_config) ⇒ Object
Initializes the auth managers hash used for authenticating API calls.
63 64 65 66 67 68 69 70 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 63 def initialize_auth_managers(global_config) @auth_managers = {} http_client_config = global_config.client_configuration %w[api_key].each { |auth| @auth_managers[auth] = nil } @auth_managers['api_key'] = CustomHeaderAuthentication.new( http_client_config.custom_header_authentication_credentials ) end |
#pet ⇒ PetController
Access to pet controller.
14 15 16 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 14 def pet @pet ||= PetController.new @global_configuration end |
#store ⇒ StoreController
Access to store controller.
20 21 22 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 20 def store @store ||= StoreController.new @global_configuration end |
#user ⇒ UserController
Access to user controller.
26 27 28 |
# File 'lib/swagger_petstore_open_api30/client.rb', line 26 def user @user ||= UserController.new @global_configuration end |