Class: PFS::Resources::Base
- Inherits:
-
Object
- Object
- PFS::Resources::Base
- Defined in:
- lib/pfs/resources/base.rb
Direct Known Subclasses
Accounts::Account, Accounts::AccountHolder, Accounts::AccountInfo, Accounts::Balance, Accounts::BalanceCredit, Accounts::IssuedAccount, Accounts::Status, Authentication::Token, Statements::Statement, Transactions::Transaction, Transfers::InternalTransfer, Transfers::InternalTransferFrom, Transfers::InternalTransferTo, Transfers::Transfer
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response, attributes = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(response, attributes = {}) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 14 |
# File 'lib/pfs/resources/base.rb', line 8 def initialize(response, attributes = {}) @response = response attributes.each do |key, value| m = "#{key}=".to_sym send(m, value) if respond_to?(m) end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/pfs/resources/base.rb', line 6 def response @response end |
Class Method Details
.map(original_attribute, mapped_attributes) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/pfs/resources/base.rb', line 16 def self.map(original_attribute, mapped_attributes) class_eval { attr_writer original_attribute.to_sym } mapped_attributes = [mapped_attributes].flatten mapped_attributes.each do |mapped_attribute| define_method(mapped_attribute) { instance_variable_get("@#{original_attribute}")} end end |