Class: Cryptopay::ChannelPaymentCallback
- Inherits:
-
Object
- Object
- Cryptopay::ChannelPaymentCallback
- Defined in:
- lib/cryptopay/models/channel_payment_callback.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::ChannelPaymentCallback
Builds the object from hash.
Instance Method Summary collapse
- #data ⇒ Object
- #event ⇒ Object
-
#initialize(attributes = {}) ⇒ ChannelPaymentCallback
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
- #type ⇒ Object
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ChannelPaymentCallback
Initializes the object
34 35 36 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 34 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::ChannelPaymentCallback
Builds the object from hash
27 28 29 30 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 27 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#data ⇒ Object
46 47 48 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 46 def data @attributes[:data] end |
#event ⇒ Object
42 43 44 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 42 def event @attributes[:event] end |
#inspect ⇒ Object
84 85 86 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 84 def inspect "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash) end |
#invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 52 def invalid_properties properties = [] properties.push('invalid value for "type", type cannot be nil.') if type.nil? properties.push('invalid value for "event", event cannot be nil.') if event.nil? if !event.nil? && !%w[created on_hold completed refunded cancelled].include?(event) properties.push('invalid value for event, must be one of "created", "on_hold", "completed", "refunded", "cancelled"') end properties.push('invalid value for "data", data cannot be nil.') if data.nil? data&.invalid_properties&.each do |prop| properties.push("invalid value for \"data\": #{prop}") end properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
80 81 82 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 80 def to_hash ENCODER.to_hash(@attributes) end |
#type ⇒ Object
38 39 40 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 38 def type @attributes[:type] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
74 75 76 |
# File 'lib/cryptopay/models/channel_payment_callback.rb', line 74 def valid? invalid_properties.empty? end |