Class: RockRMS::Response::Base
- Inherits:
-
Object
- Object
- RockRMS::Response::Base
- Defined in:
- lib/rock_rms/response/base.rb
Direct Known Subclasses
Attribute, AttributeValue, Batch, Block, BlockType, Campus, DefinedType, DefinedValue, Fund, Gateway, Group, GroupLocation, History, Location, Page, PaymentDetail, Person, PhoneNumber, RecurringDonation, RecurringDonationDetails, Registration, RegistrationInstance, SavedPaymentMethod, ServiceJob, Transaction, TransactionDetail, UserLogin, WorkflowActionType, WorkflowActivityType, WorkflowType
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
- #to_h(dict, data) ⇒ Object
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/rock_rms/response/base.rb', line 10 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/rock_rms/response/base.rb', line 4 def data @data end |
Class Method Details
.format(data) ⇒ Object
6 7 8 |
# File 'lib/rock_rms/response/base.rb', line 6 def self.format(data) new(data).format end |
Instance Method Details
#format ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rock_rms/response/base.rb', line 14 def format if data.is_a?(Array) data.map { |item| format_single(item) } else format_single(data) end end |
#to_h(dict, data) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/rock_rms/response/base.rb', line 22 def to_h(dict, data) return {} if data.nil? dict.each_with_object({}) do |(l, r), object| object[l] = data[r] end end |