Class: FdxV660Api::Client
- Inherits:
-
Object
- Object
- FdxV660Api::Client
- Includes:
- CoreLibrary
- Defined in:
- lib/fdx_v660_api/client.rb
Overview
fdx_v660_api 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.
Class Method Summary collapse
-
.from_env(**overrides) ⇒ Object
Creates a client directly from environment variables.
Instance Method Summary collapse
-
#account_information ⇒ AccountInformationController
Access to account_information controller.
-
#account_statements ⇒ AccountStatementsController
Access to account_statements controller.
-
#account_transactions ⇒ AccountTransactionsController
Access to account_transactions controller.
-
#data_providers ⇒ DataProvidersController
Access to data_providers controller.
-
#event_notifications ⇒ EventNotificationsController
Access to event_notifications controller.
-
#fraud_notification ⇒ FraudNotificationController
Access to fraud_notification controller.
-
#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, proxy_settings: nil, logging_configuration: nil, environment: Environment::PRODUCTION, oauth_fapi1_advanced_credentials: nil, oauth_fapi1_baseline_credentials: nil, tax_basic_auth_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.
-
#internal_transfers ⇒ InternalTransfersController
Access to internal_transfers controller.
-
#meta ⇒ MetaController
Access to meta controller.
-
#money_movement ⇒ MoneyMovementController
Access to money_movement controller.
-
#oauth_authorization ⇒ OauthAuthorizationController
Access to oauth_authorization controller.
-
#oauth_fapi1_advanced ⇒ Object
Returns the configured authentication OAuthFapi1Advanced instance.
-
#oauth_fapi1_baseline ⇒ Object
Returns the configured authentication OAuthFapi1Baseline instance.
-
#pay_stub_information ⇒ PayStubInformationController
Access to pay_stub_information controller.
-
#payee_management ⇒ PayeeManagementController
Access to payee_management controller.
-
#payment_initiation_parties ⇒ PaymentInitiationPartiesController
Access to payment_initiation_parties controller.
-
#payments ⇒ PaymentsController
Access to payments controller.
-
#payroll_information ⇒ PayrollInformationController
Access to payroll_information controller.
-
#personal_information ⇒ PersonalInformationController
Access to personal_information controller.
-
#recipients ⇒ RecipientsController
Access to recipients controller.
-
#recurring_payments ⇒ RecurringPaymentsController
Access to recurring_payments controller.
-
#request_for_payments ⇒ RequestForPaymentsController
Access to request_for_payments controller.
-
#reward_program_categories ⇒ RewardProgramCategoriesController
Access to reward_program_categories controller.
-
#reward_program_information ⇒ RewardProgramInformationController
Access to reward_program_information controller.
-
#submit_tax_forms ⇒ SubmitTaxFormsController
Access to submit_tax_forms controller.
-
#tax_forms ⇒ TaxFormsController
Access to tax_forms controller.
-
#terms_and_conditions ⇒ TermsAndConditionsController
Access to terms_and_conditions controller.
- #user_agent_detail ⇒ Object
-
#user_consent ⇒ UserConsentController
Access to user_consent 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, proxy_settings: nil, logging_configuration: nil, environment: Environment::PRODUCTION, oauth_fapi1_advanced_credentials: nil, oauth_fapi1_baseline_credentials: nil, tax_basic_auth_credentials: nil, config: nil) ⇒ Client
Returns a new instance of Client.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/fdx_v660_api/client.rb', line 176 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, proxy_settings: nil, logging_configuration: nil, environment: Environment::PRODUCTION, oauth_fapi1_advanced_credentials: nil, oauth_fapi1_baseline_credentials: nil, tax_basic_auth_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, proxy_settings: proxy_settings, logging_configuration: logging_configuration, environment: environment, oauth_fapi1_advanced_credentials: oauth_fapi1_advanced_credentials, oauth_fapi1_baseline_credentials: oauth_fapi1_baseline_credentials, tax_basic_auth_credentials: tax_basic_auth_credentials ) else config end user_agent_params = BaseController.user_agent_parameters @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, agent_parameters: user_agent_params) 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/fdx_v660_api/client.rb', line 10 def auth_managers @auth_managers end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/fdx_v660_api/client.rb', line 10 def config @config end |
Class Method Details
.from_env(**overrides) ⇒ Object
Creates a client directly from environment variables.
235 236 237 238 239 |
# File 'lib/fdx_v660_api/client.rb', line 235 def self.from_env(**overrides) default_config = Configuration.build_default_config_from_env new_config = default_config.clone_with(**overrides) new(config: new_config) end |
Instance Method Details
#account_information ⇒ AccountInformationController
Access to account_information controller.
28 29 30 |
# File 'lib/fdx_v660_api/client.rb', line 28 def account_information @account_information ||= AccountInformationController.new @global_configuration end |
#account_statements ⇒ AccountStatementsController
Access to account_statements controller.
34 35 36 |
# File 'lib/fdx_v660_api/client.rb', line 34 def account_statements @account_statements ||= AccountStatementsController.new @global_configuration end |
#account_transactions ⇒ AccountTransactionsController
Access to account_transactions controller.
40 41 42 |
# File 'lib/fdx_v660_api/client.rb', line 40 def account_transactions @account_transactions ||= AccountTransactionsController.new @global_configuration end |
#data_providers ⇒ DataProvidersController
Access to data_providers controller.
154 155 156 |
# File 'lib/fdx_v660_api/client.rb', line 154 def data_providers @data_providers ||= DataProvidersController.new @global_configuration end |
#event_notifications ⇒ EventNotificationsController
Access to event_notifications controller.
82 83 84 |
# File 'lib/fdx_v660_api/client.rb', line 82 def event_notifications @event_notifications ||= EventNotificationsController.new @global_configuration end |
#fraud_notification ⇒ FraudNotificationController
Access to fraud_notification controller.
88 89 90 |
# File 'lib/fdx_v660_api/client.rb', line 88 def fraud_notification @fraud_notification ||= FraudNotificationController.new @global_configuration end |
#initialize_auth_managers(global_config) ⇒ Object
Initializes the auth managers hash used for authenticating API calls.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/fdx_v660_api/client.rb', line 217 def initialize_auth_managers(global_config) @auth_managers = {} http_client_config = global_config.client_configuration %w[OAuthFapi1Advanced OAuthFapi1Baseline TaxBasicAuth].each do |auth| @auth_managers[auth] = nil end @auth_managers['OAuthFapi1Advanced'] = OauthFapi1Advanced.new( http_client_config.oauth_fapi1_advanced_credentials, global_config ) @auth_managers['OAuthFapi1Baseline'] = OauthFapi1Baseline.new( http_client_config.oauth_fapi1_baseline_credentials, global_config ) @auth_managers['TaxBasicAuth'] = TaxBasicAuth.new( http_client_config.tax_basic_auth_credentials ) end |
#internal_transfers ⇒ InternalTransfersController
Access to internal_transfers controller.
100 101 102 |
# File 'lib/fdx_v660_api/client.rb', line 100 def internal_transfers @internal_transfers ||= InternalTransfersController.new @global_configuration end |
#meta ⇒ MetaController
Access to meta controller.
94 95 96 |
# File 'lib/fdx_v660_api/client.rb', line 94 def @meta ||= MetaController.new @global_configuration end |
#money_movement ⇒ MoneyMovementController
Access to money_movement controller.
46 47 48 |
# File 'lib/fdx_v660_api/client.rb', line 46 def money_movement @money_movement ||= MoneyMovementController.new @global_configuration end |
#oauth_authorization ⇒ OauthAuthorizationController
Access to oauth_authorization controller.
172 173 174 |
# File 'lib/fdx_v660_api/client.rb', line 172 def @oauth_authorization ||= OauthAuthorizationController.new @global_configuration end |
#oauth_fapi1_advanced ⇒ Object
Returns the configured authentication OAuthFapi1Advanced instance.
17 18 19 |
# File 'lib/fdx_v660_api/client.rb', line 17 def oauth_fapi1_advanced @auth_managers['OAuthFapi1Advanced'] end |
#oauth_fapi1_baseline ⇒ Object
Returns the configured authentication OAuthFapi1Baseline instance.
22 23 24 |
# File 'lib/fdx_v660_api/client.rb', line 22 def oauth_fapi1_baseline @auth_managers['OAuthFapi1Baseline'] end |
#pay_stub_information ⇒ PayStubInformationController
Access to pay_stub_information controller.
136 137 138 |
# File 'lib/fdx_v660_api/client.rb', line 136 def pay_stub_information @pay_stub_information ||= PayStubInformationController.new @global_configuration end |
#payee_management ⇒ PayeeManagementController
Access to payee_management controller.
106 107 108 |
# File 'lib/fdx_v660_api/client.rb', line 106 def payee_management @payee_management ||= PayeeManagementController.new @global_configuration end |
#payment_initiation_parties ⇒ PaymentInitiationPartiesController
Access to payment_initiation_parties controller.
112 113 114 |
# File 'lib/fdx_v660_api/client.rb', line 112 def payment_initiation_parties @payment_initiation_parties ||= PaymentInitiationPartiesController.new @global_configuration end |
#payments ⇒ PaymentsController
Access to payments controller.
118 119 120 |
# File 'lib/fdx_v660_api/client.rb', line 118 def payments @payments ||= PaymentsController.new @global_configuration end |
#payroll_information ⇒ PayrollInformationController
Access to payroll_information controller.
142 143 144 |
# File 'lib/fdx_v660_api/client.rb', line 142 def payroll_information @payroll_information ||= PayrollInformationController.new @global_configuration end |
#personal_information ⇒ PersonalInformationController
Access to personal_information controller.
52 53 54 |
# File 'lib/fdx_v660_api/client.rb', line 52 def personal_information @personal_information ||= PersonalInformationController.new @global_configuration end |
#recipients ⇒ RecipientsController
Access to recipients controller.
148 149 150 |
# File 'lib/fdx_v660_api/client.rb', line 148 def recipients @recipients ||= RecipientsController.new @global_configuration end |
#recurring_payments ⇒ RecurringPaymentsController
Access to recurring_payments controller.
124 125 126 |
# File 'lib/fdx_v660_api/client.rb', line 124 def recurring_payments @recurring_payments ||= RecurringPaymentsController.new @global_configuration end |
#request_for_payments ⇒ RequestForPaymentsController
Access to request_for_payments controller.
130 131 132 |
# File 'lib/fdx_v660_api/client.rb', line 130 def request_for_payments @request_for_payments ||= RequestForPaymentsController.new @global_configuration end |
#reward_program_categories ⇒ RewardProgramCategoriesController
Access to reward_program_categories controller.
58 59 60 |
# File 'lib/fdx_v660_api/client.rb', line 58 def reward_program_categories @reward_program_categories ||= RewardProgramCategoriesController.new @global_configuration end |
#reward_program_information ⇒ RewardProgramInformationController
Access to reward_program_information controller.
64 65 66 |
# File 'lib/fdx_v660_api/client.rb', line 64 def reward_program_information @reward_program_information ||= RewardProgramInformationController.new @global_configuration end |
#submit_tax_forms ⇒ SubmitTaxFormsController
Access to submit_tax_forms controller.
160 161 162 |
# File 'lib/fdx_v660_api/client.rb', line 160 def submit_tax_forms @submit_tax_forms ||= SubmitTaxFormsController.new @global_configuration end |
#tax_forms ⇒ TaxFormsController
Access to tax_forms controller.
166 167 168 |
# File 'lib/fdx_v660_api/client.rb', line 166 def tax_forms @tax_forms ||= TaxFormsController.new @global_configuration end |
#terms_and_conditions ⇒ TermsAndConditionsController
Access to terms_and_conditions controller.
70 71 72 |
# File 'lib/fdx_v660_api/client.rb', line 70 def terms_and_conditions @terms_and_conditions ||= TermsAndConditionsController.new @global_configuration end |
#user_agent_detail ⇒ Object
12 13 14 |
# File 'lib/fdx_v660_api/client.rb', line 12 def user_agent_detail config.user_agent_detail end |
#user_consent ⇒ UserConsentController
Access to user_consent controller.
76 77 78 |
# File 'lib/fdx_v660_api/client.rb', line 76 def @user_consent ||= UserConsentController.new @global_configuration end |