Class: DatagroutConduit::Receipt
- Inherits:
-
Struct
- Object
- Struct
- DatagroutConduit::Receipt
- Defined in:
- lib/datagrout_conduit/types.rb
Instance Attribute Summary collapse
-
#actual_credits ⇒ Object
Returns the value of attribute actual_credits.
-
#balance_after ⇒ Object
Returns the value of attribute balance_after.
-
#balance_before ⇒ Object
Returns the value of attribute balance_before.
-
#breakdown ⇒ Object
Returns the value of attribute breakdown.
-
#byok ⇒ Object
Returns the value of attribute byok.
-
#estimated_credits ⇒ Object
Returns the value of attribute estimated_credits.
-
#net_credits ⇒ Object
Returns the value of attribute net_credits.
-
#receipt_id ⇒ Object
Returns the value of attribute receipt_id.
-
#savings ⇒ Object
Returns the value of attribute savings.
-
#savings_bonus ⇒ Object
Returns the value of attribute savings_bonus.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Class Method Summary collapse
Instance Attribute Details
#actual_credits ⇒ Object
Returns the value of attribute actual_credits
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def actual_credits @actual_credits end |
#balance_after ⇒ Object
Returns the value of attribute balance_after
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def balance_after @balance_after end |
#balance_before ⇒ Object
Returns the value of attribute balance_before
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def balance_before @balance_before end |
#breakdown ⇒ Object
Returns the value of attribute breakdown
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def breakdown @breakdown end |
#byok ⇒ Object
Returns the value of attribute byok
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def byok @byok end |
#estimated_credits ⇒ Object
Returns the value of attribute estimated_credits
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def estimated_credits @estimated_credits end |
#net_credits ⇒ Object
Returns the value of attribute net_credits
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def net_credits @net_credits end |
#receipt_id ⇒ Object
Returns the value of attribute receipt_id
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def receipt_id @receipt_id end |
#savings ⇒ Object
Returns the value of attribute savings
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def savings @savings end |
#savings_bonus ⇒ Object
Returns the value of attribute savings_bonus
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def savings_bonus @savings_bonus end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def @timestamp end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id
35 36 37 |
# File 'lib/datagrout_conduit/types.rb', line 35 def transaction_id @transaction_id end |
Class Method Details
.from_hash(hash) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/datagrout_conduit/types.rb', line 43 def self.from_hash(hash) return nil if hash.nil? hash = hash.transform_keys(&:to_s) new( receipt_id: hash["receipt_id"], transaction_id: hash["transaction_id"], timestamp: hash["timestamp"], estimated_credits: hash["estimated_credits"]&.to_f, actual_credits: hash["actual_credits"]&.to_f, net_credits: hash["net_credits"]&.to_f, savings: (hash["savings"] || 0.0).to_f, savings_bonus: (hash["savings_bonus"] || 0.0).to_f, balance_before: hash["balance_before"]&.to_f, balance_after: hash["balance_after"]&.to_f, breakdown: hash["breakdown"] || {}, byok: Byok.from_hash(hash["byok"]) ) end |