Class: Cryptopay::ChannelParams
- Inherits:
-
Object
- Object
- Cryptopay::ChannelParams
- Defined in:
- lib/cryptopay/models/channel_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::ChannelParams
Builds the object from hash.
Instance Method Summary collapse
-
#custom_id ⇒ Object
The payment reference ID in your system.
-
#customer_id ⇒ Object
The internal ID of your customer that the channel relates to.
-
#description ⇒ Object
Channel description.
-
#initialize(attributes = {}) ⇒ ChannelParams
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#name ⇒ Object
Channel name.
-
#network ⇒ Object
Cryptocurrency network.
-
#pay_currency ⇒ Object
The cryptocurrency which you want to accept.
-
#receiver_currency ⇒ Object
The currency which all incoming transactions will be converted to.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ChannelParams
Initializes the object
42 43 44 |
# File 'lib/cryptopay/models/channel_params.rb', line 42 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::ChannelParams
Builds the object from hash
35 36 37 38 |
# File 'lib/cryptopay/models/channel_params.rb', line 35 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#custom_id ⇒ Object
The payment reference ID in your system
72 73 74 |
# File 'lib/cryptopay/models/channel_params.rb', line 72 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The internal ID of your customer that the channel relates to
77 78 79 |
# File 'lib/cryptopay/models/channel_params.rb', line 77 def customer_id @attributes[:customer_id] end |
#description ⇒ Object
Channel description
52 53 54 |
# File 'lib/cryptopay/models/channel_params.rb', line 52 def description @attributes[:description] end |
#inspect ⇒ Object
109 110 111 |
# File 'lib/cryptopay/models/channel_params.rb', line 109 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?
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/cryptopay/models/channel_params.rb', line 83 def invalid_properties properties = [] properties.push('invalid value for "name", name cannot be nil.') if name.nil? properties.push('invalid value for "pay_currency", pay_currency cannot be nil.') if pay_currency.nil? if receiver_currency.nil? properties.push('invalid value for "receiver_currency", receiver_currency cannot be nil.') end properties end |
#name ⇒ Object
Channel name
47 48 49 |
# File 'lib/cryptopay/models/channel_params.rb', line 47 def name @attributes[:name] end |
#network ⇒ Object
Cryptocurrency network
62 63 64 |
# File 'lib/cryptopay/models/channel_params.rb', line 62 def network @attributes[:network] end |
#pay_currency ⇒ Object
The cryptocurrency which you want to accept
57 58 59 |
# File 'lib/cryptopay/models/channel_params.rb', line 57 def pay_currency @attributes[:pay_currency] end |
#receiver_currency ⇒ Object
The currency which all incoming transactions will be converted to
67 68 69 |
# File 'lib/cryptopay/models/channel_params.rb', line 67 def receiver_currency @attributes[:receiver_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
105 106 107 |
# File 'lib/cryptopay/models/channel_params.rb', line 105 def to_hash ENCODER.to_hash(@attributes) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
99 100 101 |
# File 'lib/cryptopay/models/channel_params.rb', line 99 def valid? invalid_properties.empty? end |