Class: UspsApi::PaymentsPaymentAccount
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::PaymentsPaymentAccount
- Defined in:
- lib/usps_api/models/payments_payment_account.rb
Overview
Payment account information.
Instance Attribute Summary collapse
-
#account_number ⇒ String
The Enterprise Payment Account number or PC Postage meter number to use for payment.
-
#account_type ⇒ AccountType2
The type of payment account.
-
#non_profit_status ⇒ TrueClass | FalseClass
This status is applicable only for permits and indicates whether the permit has been issued to a non-profit organization.
-
#permit_number ⇒ String
The permit number or Federal Agency Number to use for payment.
-
#permit_zip ⇒ String
The ZIP Code™ associated to the permit number.
-
#sufficient_funds ⇒ TrueClass | FalseClass
This attribute is relevant only when an amount parameter is provided, and it informs the API caller whether the payment account holds sufficient funds to process the payment.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_type: SKIP, account_number: SKIP, permit_number: SKIP, permit_zip: SKIP, non_profit_status: SKIP, sufficient_funds: SKIP, additional_properties: nil) ⇒ PaymentsPaymentAccount
constructor
A new instance of PaymentsPaymentAccount.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(account_type: SKIP, account_number: SKIP, permit_number: SKIP, permit_zip: SKIP, non_profit_status: SKIP, sufficient_funds: SKIP, additional_properties: nil) ⇒ PaymentsPaymentAccount
Returns a new instance of PaymentsPaymentAccount.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 72 def initialize(account_type: SKIP, account_number: SKIP, permit_number: SKIP, permit_zip: SKIP, non_profit_status: SKIP, sufficient_funds: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_type = account_type unless account_type == SKIP @account_number = account_number unless account_number == SKIP @permit_number = permit_number unless permit_number == SKIP @permit_zip = permit_zip unless permit_zip == SKIP @non_profit_status = non_profit_status unless non_profit_status == SKIP @sufficient_funds = sufficient_funds unless sufficient_funds == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_number ⇒ String
The Enterprise Payment Account number or PC Postage meter number to use for payment. Required when ‘accountType` is `EPS` or `METER`.
20 21 22 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 20 def account_number @account_number end |
#account_type ⇒ AccountType2
The type of payment account. METER pricing is only available to PC Postage providers.
15 16 17 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 15 def account_type @account_type end |
#non_profit_status ⇒ TrueClass | FalseClass
This status is applicable only for permits and indicates whether the permit has been issued to a non-profit organization.
35 36 37 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 35 def non_profit_status @non_profit_status end |
#permit_number ⇒ String
The permit number or Federal Agency Number to use for payment. Required when ‘accountType` is `PERMIT` or `OMAS`.
25 26 27 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 25 def permit_number @permit_number end |
#permit_zip ⇒ String
The ZIP Code™ associated to the permit number. Required when ‘accountType` is `PERMIT` or `OMAS`.
30 31 32 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 30 def permit_zip @permit_zip end |
#sufficient_funds ⇒ TrueClass | FalseClass
This attribute is relevant only when an amount parameter is provided, and it informs the API caller whether the payment account holds sufficient funds to process the payment.
41 42 43 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 41 def sufficient_funds @sufficient_funds end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
89 90 91 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 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_type = hash.key?('accountType') ? hash['accountType'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP permit_number = hash.key?('permitNumber') ? hash['permitNumber'] : SKIP permit_zip = hash.key?('permitZIP') ? hash['permitZIP'] : SKIP non_profit_status = hash.key?('nonProfitStatus') ? hash['nonProfitStatus'] : SKIP sufficient_funds = hash.key?('sufficientFunds') ? hash['sufficientFunds'] : SKIP # 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. PaymentsPaymentAccount.new(account_type: account_type, account_number: account_number, permit_number: permit_number, permit_zip: permit_zip, non_profit_status: non_profit_status, sufficient_funds: sufficient_funds, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['account_type'] = 'accountType' @_hash['account_number'] = 'accountNumber' @_hash['permit_number'] = 'permitNumber' @_hash['permit_zip'] = 'permitZIP' @_hash['non_profit_status'] = 'nonProfitStatus' @_hash['sufficient_funds'] = 'sufficientFunds' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 68 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 56 def self.optionals %w[ account_type account_number permit_number permit_zip non_profit_status sufficient_funds ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
129 130 131 132 133 134 135 136 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 129 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_type: #{@account_type.inspect}, account_number:"\ " #{@account_number.inspect}, permit_number: #{@permit_number.inspect}, permit_zip:"\ " #{@permit_zip.inspect}, non_profit_status: #{@non_profit_status.inspect},"\ " sufficient_funds: #{@sufficient_funds.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 126 |
# File 'lib/usps_api/models/payments_payment_account.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_type: #{@account_type}, account_number: #{@account_number},"\ " permit_number: #{@permit_number}, permit_zip: #{@permit_zip}, non_profit_status:"\ " #{@non_profit_status}, sufficient_funds: #{@sufficient_funds}, additional_properties:"\ " #{@additional_properties}>" end |