Class: PaysecureApiDocumentationLive::Client

Inherits:
BaseModel
  • Object
show all
Includes:
CoreLibrary
Defined in:
lib/paysecure_api_documentation_live/client.rb,
lib/paysecure_api_documentation_live/models/client.rb

Overview

Client Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(email:, street_address:, city:, full_name:, zip_code:, country:, date_of_birth:, state_code:, phone:, additional_properties: nil) ⇒ Client

Returns a new instance of Client.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/paysecure_api_documentation_live/client.rb', line 112

def initialize(
  connection: nil, adapter: :net_http_persistent, timeout: 30,
  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,
  bearer_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,
                bearer_auth_credentials: bearer_auth_credentials
              )
            else
              config
            end
  user_agent_params = BaseApi.user_agent_parameters

  @global_configuration = GlobalConfiguration.new(client_configuration: @config)
                                             .base_uri_executor(@config.method(:get_base_uri))
                                             .global_errors(BaseApi::GLOBAL_ERRORS)
                                             .user_agent(BaseApi.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_managersObject (readonly)

Returns the value of attribute auth_managers.



10
11
12
# File 'lib/paysecure_api_documentation_live/client.rb', line 10

def auth_managers
  @auth_managers
end

#cityString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 22

def city
  @city
end

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/paysecure_api_documentation_live/client.rb', line 10

def config
  @config
end

#countryString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 34

def country
  @country
end

#date_of_birthString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 38

def date_of_birth
  @date_of_birth
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 14

def email
  @email
end

#full_nameString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 26

def full_name
  @full_name
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 46

def phone
  @phone
end

#state_codeString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 42

def state_code
  @state_code
end

#street_addressString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 18

def street_address
  @street_address
end

#zip_codeString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 30

def zip_code
  @zip_code
end

Class Method Details

.from_env(**overrides) ⇒ Object

Creates a client directly from environment variables.



157
158
159
160
161
# File 'lib/paysecure_api_documentation_live/client.rb', line 157

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email = hash.key?('email') ? hash['email'] : nil
  street_address =
    hash.key?('street_address') ? hash['street_address'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  full_name = hash.key?('full_name') ? hash['full_name'] : nil
  zip_code = hash.key?('zip_code') ? hash['zip_code'] : nil
  country = hash.key?('country') ? hash['country'] : nil
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : nil
  state_code = hash.key?('stateCode') ? hash['stateCode'] : nil
  phone = hash.key?('phone') ? hash['phone'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Client.new(email: email,
             street_address: street_address,
             city: city,
             full_name: full_name,
             zip_code: zip_code,
             country: country,
             date_of_birth: date_of_birth,
             state_code: state_code,
             phone: phone,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email'] = 'email'
  @_hash['street_address'] = 'street_address'
  @_hash['city'] = 'city'
  @_hash['full_name'] = 'full_name'
  @_hash['zip_code'] = 'zip_code'
  @_hash['country'] = 'country'
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['state_code'] = 'stateCode'
  @_hash['phone'] = 'phone'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 64

def self.optionals
  []
end

Instance Method Details

#ap_isApIsApi

Access to ap_is controller.

Returns:

  • (ApIsApi)

    Returns the controller instance.



18
19
20
# File 'lib/paysecure_api_documentation_live/client.rb', line 18

def ap_is
  @ap_is ||= ApIsApi.new @global_configuration
end

#cashier_ap_isCashierApIsApi

Access to cashier_ap_is controller.

Returns:



78
79
80
# File 'lib/paysecure_api_documentation_live/client.rb', line 78

def cashier_ap_is
  @cashier_ap_is ||= CashierApIsApi.new @global_configuration
end

#clientApi

Access to client controller.

Returns:

  • (Api)

    Returns the controller instance.



108
109
110
# File 'lib/paysecure_api_documentation_live/client.rb', line 108

def client
  @client ||= Api.new @global_configuration
end

#get_balance_apiGetBalanceApi

Access to get_balance_api controller.

Returns:



36
37
38
# File 'lib/paysecure_api_documentation_live/client.rb', line 36

def get_balance_api
  @get_balance_api ||= GetBalanceApi.new @global_configuration
end

#get_balance_api_v2_orchestrationGetBalanceApiV2OrchestrationApi

Access to get_balance_api_v2_orchestration controller.

Returns:



90
91
92
# File 'lib/paysecure_api_documentation_live/client.rb', line 90

def get_balance_api_v2_orchestration
  @get_balance_api_v2_orchestration ||= GetBalanceApiV2OrchestrationApi.new @global_configuration
end

#global_collectionGlobalCollectionApi

Access to global_collection controller.

Returns:



96
97
98
# File 'lib/paysecure_api_documentation_live/client.rb', line 96

def global_collection
  @global_collection ||= GlobalCollectionApi.new @global_configuration
end

#initialize_auth_managers(global_config) ⇒ Object

Initializes the auth managers hash used for authenticating API calls.

Parameters:

  • global_config (GlobalConfiguration)

    The global configuration of the SDK)



149
150
151
152
153
154
# File 'lib/paysecure_api_documentation_live/client.rb', line 149

def initialize_auth_managers(global_config)
  @auth_managers = {}
  http_client_config = global_config.client_configuration
  %w[bearer].each { |auth| @auth_managers[auth] = nil }
  @auth_managers['bearer'] = Oauth2.new(http_client_config.bearer_auth_credentials)
end

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
144
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email.inspect}, street_address: #{@street_address.inspect}, city:"\
  " #{@city.inspect}, full_name: #{@full_name.inspect}, zip_code: #{@zip_code.inspect},"\
  " country: #{@country.inspect}, date_of_birth: #{@date_of_birth.inspect}, state_code:"\
  " #{@state_code.inspect}, phone: #{@phone.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#m_paypal_walletMPaypalWalletApi

Access to m_paypal_wallet controller.

Returns:



60
61
62
# File 'lib/paysecure_api_documentation_live/client.rb', line 60

def m_paypal_wallet
  @m_paypal_wallet ||= MPaypalWalletApi.new @global_configuration
end

#m_virtual_cards_payoutMVirtualCardsPayoutApi

Access to m_virtual_cards_payout controller.

Returns:



66
67
68
# File 'lib/paysecure_api_documentation_live/client.rb', line 66

def m_virtual_cards_payout
  @m_virtual_cards_payout ||= MVirtualCardsPayoutApi.new @global_configuration
end

#payinPayinApi

Access to payin controller.

Returns:

  • (PayinApi)

    Returns the controller instance.



54
55
56
# File 'lib/paysecure_api_documentation_live/client.rb', line 54

def payin
  @payin ||= PayinApi.new @global_configuration
end

#payin_ap_isPayinApIsApi

Access to payin_ap_is controller.

Returns:



24
25
26
# File 'lib/paysecure_api_documentation_live/client.rb', line 24

def payin_ap_is
  @payin_ap_is ||= PayinApIsApi.new @global_configuration
end

#payoutPayoutApi

Access to payout controller.

Returns:

  • (PayoutApi)

    Returns the controller instance.



48
49
50
# File 'lib/paysecure_api_documentation_live/client.rb', line 48

def payout
  @payout ||= PayoutApi.new @global_configuration
end

#payout_ap_isPayoutApIsApi

Access to payout_ap_is controller.

Returns:



30
31
32
# File 'lib/paysecure_api_documentation_live/client.rb', line 30

def payout_ap_is
  @payout_ap_is ||= PayoutApIsApi.new @global_configuration
end

#payout_manual_reviewPayoutManualReviewApi

Access to payout_manual_review controller.

Returns:



102
103
104
# File 'lib/paysecure_api_documentation_live/client.rb', line 102

def payout_manual_review
  @payout_manual_review ||= PayoutManualReviewApi.new @global_configuration
end

#refund_apiRefundApi

Access to refund_api controller.

Returns:

  • (RefundApi)

    Returns the controller instance.



42
43
44
# File 'lib/paysecure_api_documentation_live/client.rb', line 42

def refund_api
  @refund_api ||= RefundApi.new @global_configuration
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
134
# File 'lib/paysecure_api_documentation_live/models/client.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email}, street_address: #{@street_address}, city: #{@city},"\
  " full_name: #{@full_name}, zip_code: #{@zip_code}, country: #{@country}, date_of_birth:"\
  " #{@date_of_birth}, state_code: #{@state_code}, phone: #{@phone}, additional_properties:"\
  " #{@additional_properties}>"
end

#transaction_reportingTransactionReportingApi

Access to transaction_reporting controller.

Returns:



84
85
86
# File 'lib/paysecure_api_documentation_live/client.rb', line 84

def transaction_reporting
  @transaction_reporting ||= TransactionReportingApi.new @global_configuration
end

#trust_scoreTrustScoreApi

Access to trust_score controller.

Returns:



72
73
74
# File 'lib/paysecure_api_documentation_live/client.rb', line 72

def trust_score
  @trust_score ||= TrustScoreApi.new @global_configuration
end

#user_agent_detailObject



12
13
14
# File 'lib/paysecure_api_documentation_live/client.rb', line 12

def user_agent_detail
  config.user_agent_detail
end