Class: OrbipayPaymentsapiClient::Base
- Inherits:
-
Object
- Object
- OrbipayPaymentsapiClient::Base
- Defined in:
- lib/orbipay_paymentsapi_client/wrappers/base.rb
Direct Known Subclasses
Customer, CustomerAccount, CustomerAccounts, Customers, FeePayment, FundingAccount, FundingAccounts, OrbipayPaymentsapiClientHandlers::AddFundingAccountHandler, OrbipayPaymentsapiClientHandlers::CancelPaymentAuthorizationHandler, OrbipayPaymentsapiClientHandlers::CreateCustomerHandler, OrbipayPaymentsapiClientHandlers::CreatePaymentAuthorizationHandler, OrbipayPaymentsapiClientHandlers::CreatePaymentHandler, OrbipayPaymentsapiClientHandlers::CreateRecurringPaymentSetupHandler, OrbipayPaymentsapiClientHandlers::CreateRefundHandler, OrbipayPaymentsapiClientHandlers::DeleteFundingAccountHandler, OrbipayPaymentsapiClientHandlers::DeletePaymentHandler, OrbipayPaymentsapiClientHandlers::DeletePaymentSetupHandler, OrbipayPaymentsapiClientHandlers::DeleteRecordPaymentHandler, OrbipayPaymentsapiClientHandlers::GetCustomerAccountHandler, OrbipayPaymentsapiClientHandlers::GetCustomerHandler, OrbipayPaymentsapiClientHandlers::GetFundingAccountHandler, OrbipayPaymentsapiClientHandlers::GetPaymentHandler, OrbipayPaymentsapiClientHandlers::GetPaymentSetupHandler, OrbipayPaymentsapiClientHandlers::GetRefundHandler, OrbipayPaymentsapiClientHandlers::RecordPaymentHandler, OrbipayPaymentsapiClientHandlers::RenewCustomerAccountHandler, OrbipayPaymentsapiClientHandlers::ReplaceFundingAccountHandler, OrbipayPaymentsapiClientHandlers::RetrieveCustomerAccountsHandler, OrbipayPaymentsapiClientHandlers::RetrieveCustomerAccountsPageHandler, OrbipayPaymentsapiClientHandlers::RetrieveCustomersHandler, OrbipayPaymentsapiClientHandlers::RetrieveCustomersPageHandler, OrbipayPaymentsapiClientHandlers::RetrieveFeePaymentHandler, OrbipayPaymentsapiClientHandlers::RetrieveFundingAccountsHandler, OrbipayPaymentsapiClientHandlers::RetrieveFundingAccountsPageHandler, OrbipayPaymentsapiClientHandlers::RetrievePaymentSetupsHandler, OrbipayPaymentsapiClientHandlers::RetrievePaymentsHandler, OrbipayPaymentsapiClientHandlers::RetrieveRefundsHandler, OrbipayPaymentsapiClientHandlers::SimplePaymentHandler, OrbipayPaymentsapiClientHandlers::UpdateCustomerHandler, OrbipayPaymentsapiClientHandlers::UpdateFundingAccountHandler, OrbipayPaymentsapiClientHandlers::UpdatePaymentHandler, OrbipayPaymentsapiClientHandlers::UpdatePaymentSetupHandler, Payment, PaymentAuthorization, PaymentSetup, PaymentSetups, Payments, RecordedPayment, RecordedPayments, Refund, Refunds, SimplePayment
Instance Attribute Summary collapse
-
#api_end_point ⇒ Object
readonly
api_end_point of a call.
-
#http_status_code ⇒ Object
readonly
http_status_code of a call.
-
#invocation_context ⇒ Object
readonly
invocation_context of a call.
-
#live_mode ⇒ Object
readonly
live_mode of a call.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
- #for_client(client_key: nil) ⇒ Object
-
#initialize(api_end_point: nil, live_mode: nil, invocation_context: nil) ⇒ Base
constructor
A new instance of Base.
- #requested_by(requestor: nil, requestor_type: nil) ⇒ Object
- #set_api_end_point(api_end_point: nil) ⇒ Object
- #set_values(args) ⇒ Object
- #vide_channel(channel: nil) ⇒ Object
- #with_context(invocation_context, live_mode: nil, api_end_point: nil) ⇒ Object
Constructor Details
#initialize(api_end_point: nil, live_mode: nil, invocation_context: nil) ⇒ Base
Returns a new instance of Base.
46 47 48 49 50 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 46 def initialize(api_end_point: nil, live_mode: nil, invocation_context: nil) @api_end_point = api_end_point @live_mode = live_mode @invocation_context = invocation_context end |
Instance Attribute Details
#api_end_point ⇒ Object (readonly)
api_end_point of a call.
15 16 17 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 15 def api_end_point @api_end_point end |
#http_status_code ⇒ Object (readonly)
http_status_code of a call.
24 25 26 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 24 def http_status_code @http_status_code end |
#invocation_context ⇒ Object (readonly)
invocation_context of a call.
21 22 23 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 21 def invocation_context @invocation_context end |
#live_mode ⇒ Object (readonly)
live_mode of a call.
18 19 20 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 18 def live_mode @live_mode end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
27 28 29 30 31 32 33 34 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 27 def self.attribute_map { :'api_end_point' => :'api_end_point', :'live_mode' => :'live_mode', :'invocation_context' => :'invocation_context', :'http_status_code' => :'http_status_code' } end |
.swagger_types ⇒ Object
Attribute type mapping.
37 38 39 40 41 42 43 44 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 37 def self.swagger_types { :'api_end_point' => :'String', :'live_mode' => :'String', :'invocation_context' => :'InvocationContext', :'http_status_code' => :'Integer' } end |
Instance Method Details
#for_client(client_key: nil) ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 114 def for_client(client_key: nil) if @invocation_context.nil? @invocation_context = InvocationContext.new end @invocation_context.set_values(client_key: client_key) self end |
#requested_by(requestor: nil, requestor_type: nil) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 106 def requested_by(requestor: nil, requestor_type: nil) if @invocation_context.nil? @invocation_context = InvocationContext.new end @invocation_context.set_values(requestor: requestor) @invocation_context.set_values(requestor_type: requestor_type) self end |
#set_api_end_point(api_end_point: nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 52 def set_api_end_point(api_end_point: nil) if @live_mode == "true" @api_end_point = "https://api.orbipay.com/payments/v1" elsif @live_mode == "false" && api_end_point.nil? @api_end_point = "https://sbapi.orbipay.com/payments/v1" elsif @live_mode == "false" && !api_end_point.nil? @api_end_point = api_end_point else if @live_mode.nil? OrbipayPaymentsapiClient.logger.error "Invalid value for live_mode, value Received in request : nil, valid values for live_mode: true, false" fail ApiError.new(:message => "Invalid value for live_mode, value Received in request : nil, valid values for live_mode: true, false", :code => 0) else OrbipayPaymentsapiClient.logger.error "Invalid value for live_mode, value Received in request : "+@live_mode+", valid values for live_mode: true, false" fail ApiError.new(:message => "Invalid value for live_mode, value Received in request : "+@live_mode+", valid values for live_mode: true, false", :code => 0) end end end |
#set_values(args) ⇒ Object
122 123 124 125 126 127 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 122 def set_values(args) args.each do |attr, arg| (class << self; self; end).send(:attr_reader, attr.to_sym) instance_variable_set("@#{attr}", arg) end end |
#vide_channel(channel: nil) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 99 def vide_channel(channel: nil) if @invocation_context.nil? @invocation_context = InvocationContext.new end @invocation_context.set_values(channel: channel) self end |
#with_context(invocation_context, live_mode: nil, api_end_point: nil) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/orbipay_paymentsapi_client/wrappers/base.rb', line 70 def with_context(invocation_context, live_mode: nil, api_end_point: nil) @live_mode = live_mode set_api_end_point(api_end_point: api_end_point) if @invocation_context.nil? @invocation_context = InvocationContext() end if !invocation_context.product.nil? @invocation_context.set_values(product: invocation_context.product) end if !invocation_context.secret.nil? @invocation_context.set_values(secret: invocation_context.secret) end if !invocation_context.idempotent_request_key.nil? @invocation_context.set_values(idempotent_request_key: invocation_context.idempotent_request_key) end if !invocation_context.x_opay_headers.nil? @invocation_context.set_values(x_opay_headers: invocation_context.x_opay_headers) end if !invocation_context.api_key.nil? @invocation_context.set_values(api_key: invocation_context.api_key) end if !invocation_context.auth_scheme.nil? @invocation_context.set_values(auth_scheme: invocation_context.auth_scheme) end if !invocation_context.trace_id.nil? @invocation_context.set_values(trace_id: invocation_context.trace_id) end end |