Class: Tinker::Model::Dto::QueryDataDto
- Inherits:
-
Object
- Object
- Tinker::Model::Dto::QueryDataDto
- Defined in:
- lib/tinker/model/dto/query_data_dto.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#paid_at ⇒ Object
readonly
Returns the value of attribute paid_at.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(data) ⇒ QueryDataDto
constructor
A new instance of QueryDataDto.
- #to_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ QueryDataDto
Returns a new instance of QueryDataDto.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 9 def initialize(data) @id = data['id'] status_value = data['status'] || 'pending' @status = begin Tinker::Enum::PaymentStatus.const_get(status_value.upcase) rescue NameError Tinker::Enum::PaymentStatus::PENDING end @reference = data['reference'] @amount = data['amount'].to_f @currency = data['currency'] @paid_at = data['paid_at'] @created_at = data['created_at'] @channel = data['channel'] end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def amount @amount end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def channel @channel end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def id @id end |
#paid_at ⇒ Object (readonly)
Returns the value of attribute paid_at.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def paid_at @paid_at end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def reference @reference end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 7 def status @status end |
Instance Method Details
#to_hash ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tinker/model/dto/query_data_dto.rb', line 25 def to_hash { id: @id, status: @status, reference: @reference, amount: @amount, currency: @currency, paid_at: @paid_at, created_at: @created_at, channel: @channel } end |