Class: Square::BaseApi
- Inherits:
-
Object
- Object
- Square::BaseApi
- Defined in:
- lib/square/api/base_api.rb
Overview
BaseApi.
Direct Known Subclasses
ApplePayApi, BankAccountsApi, BookingCustomAttributesApi, BookingsApi, CardsApi, CashDrawersApi, CatalogApi, CheckoutApi, CustomerCustomAttributesApi, CustomerGroupsApi, CustomerSegmentsApi, CustomersApi, DevicesApi, DisputesApi, EmployeesApi, GiftCardActivitiesApi, GiftCardsApi, InventoryApi, InvoicesApi, LaborApi, LocationCustomAttributesApi, LocationsApi, LoyaltyApi, MerchantCustomAttributesApi, MerchantsApi, MobileAuthorizationApi, OAuthApi, OrderCustomAttributesApi, OrdersApi, PaymentsApi, PayoutsApi, RefundsApi, SitesApi, SnippetsApi, SubscriptionsApi, TeamApi, TerminalApi, TransactionsApi, V1TransactionsApi, VendorsApi, WebhookSubscriptionsApi
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#http_call_back ⇒ Object
Returns the value of attribute http_call_back.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(global_configuration) ⇒ BaseApi
constructor
Initialization constructor.
-
#new_api_call_builder ⇒ ApiCall
Creates a new builder for the Api Call instance.
-
#new_parameter(value, key: nil) ⇒ Parameter
Creates a new instance of the parameter.
-
#new_request_builder(http_method, path, server) ⇒ RequestBuilder
Creates a new instance of the request builder.
-
#new_response_handler ⇒ ResponseHandler
Creates a new instance of the response handler.
Constructor Details
#initialize(global_configuration) ⇒ BaseApi
Initialization constructor.
20 21 22 23 24 25 |
# File 'lib/square/api/base_api.rb', line 20 def initialize(global_configuration) @global_configuration = global_configuration @config = @global_configuration.client_configuration @http_call_back = @config.http_callback @api_call = ApiCall.new(@global_configuration) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/square/api/base_api.rb', line 4 def config @config end |
#http_call_back ⇒ Object
Returns the value of attribute http_call_back.
4 5 6 |
# File 'lib/square/api/base_api.rb', line 4 def http_call_back @http_call_back end |
Class Method Details
.user_agent ⇒ Object
6 7 8 |
# File 'lib/square/api/base_api.rb', line 6 def self.user_agent 'Square-Ruby-SDK/35.0.1.20240118 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}' end |
.user_agent_parameters ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/square/api/base_api.rb', line 10 def self.user_agent_parameters { '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false }, '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false }, '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false } } end |
Instance Method Details
#new_api_call_builder ⇒ ApiCall
Creates a new builder for the Api Call instance.
29 30 31 |
# File 'lib/square/api/base_api.rb', line 29 def new_api_call_builder @api_call.new_builder end |
#new_parameter(value, key: nil) ⇒ Parameter
Creates a new instance of the parameter.
55 56 57 58 59 |
# File 'lib/square/api/base_api.rb', line 55 def new_parameter(value, key: nil) Parameter.new .key(key) .value(value) end |
#new_request_builder(http_method, path, server) ⇒ RequestBuilder
Creates a new instance of the request builder.
38 39 40 41 42 43 |
# File 'lib/square/api/base_api.rb', line 38 def new_request_builder(http_method, path, server) RequestBuilder.new .http_method(http_method) .path(path) .server(server) end |
#new_response_handler ⇒ ResponseHandler
Creates a new instance of the response handler.
47 48 49 |
# File 'lib/square/api/base_api.rb', line 47 def new_response_handler ResponseHandler.new end |