Class: Cryptopay::Channel
- Inherits:
-
Object
- Object
- Cryptopay::Channel
- Defined in:
- lib/cryptopay/models/channel.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::Channel
Builds the object from hash.
Instance Method Summary collapse
-
#address ⇒ Object
Channel description.
-
#custom_id ⇒ Object
The channel reference ID in your system.
-
#customer_id ⇒ Object
The reference ID of your customer.
-
#description ⇒ Object
Channel description.
-
#hosted_page_url ⇒ Object
Channel hosted page that renders channel details.
-
#id ⇒ Object
Channel ID.
-
#initialize(attributes = {}) ⇒ Channel
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.
-
#project_id ⇒ Object
Project ID.
-
#receiver_currency ⇒ Object
The currency which all incoming transactions will be converted to.
- #status ⇒ Object
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#uri ⇒ Object
Channel URI.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Channel
Initializes the object
58 59 60 |
# File 'lib/cryptopay/models/channel.rb', line 58 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::Channel
Builds the object from hash
51 52 53 54 |
# File 'lib/cryptopay/models/channel.rb', line 51 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#address ⇒ Object
Channel description
92 93 94 |
# File 'lib/cryptopay/models/channel.rb', line 92 def address @attributes[:address] end |
#custom_id ⇒ Object
The channel reference ID in your system
107 108 109 |
# File 'lib/cryptopay/models/channel.rb', line 107 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The reference ID of your customer
112 113 114 |
# File 'lib/cryptopay/models/channel.rb', line 112 def customer_id @attributes[:customer_id] end |
#description ⇒ Object
Channel description
77 78 79 |
# File 'lib/cryptopay/models/channel.rb', line 77 def description @attributes[:description] end |
#hosted_page_url ⇒ Object
Channel hosted page that renders channel details
122 123 124 |
# File 'lib/cryptopay/models/channel.rb', line 122 def hosted_page_url @attributes[:hosted_page_url] end |
#id ⇒ Object
Channel ID
63 64 65 |
# File 'lib/cryptopay/models/channel.rb', line 63 def id @attributes[:id] end |
#inspect ⇒ Object
172 173 174 |
# File 'lib/cryptopay/models/channel.rb', line 172 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?
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/cryptopay/models/channel.rb', line 128 def invalid_properties properties = [] properties.push('invalid value for "id", id cannot be nil.') if id.nil? properties.push('invalid value for "status", status cannot be nil.') if status.nil? if !status.nil? && !%w[enabled disabled].include?(status) properties.push('invalid value for status, must be one of "enabled", "disabled"') end 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.push('invalid value for "address", address cannot be nil.') if address.nil? properties.push('invalid value for "network", network cannot be nil.') if network.nil? properties.push('invalid value for "project_id", project_id cannot be nil.') if project_id.nil? properties.push('invalid value for "uri", uri cannot be nil.') if uri.nil? properties.push('invalid value for "hosted_page_url", hosted_page_url cannot be nil.') if hosted_page_url.nil? properties end |
#name ⇒ Object
Channel name
72 73 74 |
# File 'lib/cryptopay/models/channel.rb', line 72 def name @attributes[:name] end |
#network ⇒ Object
Cryptocurrency network
97 98 99 |
# File 'lib/cryptopay/models/channel.rb', line 97 def network @attributes[:network] end |
#pay_currency ⇒ Object
The cryptocurrency which you want to accept
82 83 84 |
# File 'lib/cryptopay/models/channel.rb', line 82 def pay_currency @attributes[:pay_currency] end |
#project_id ⇒ Object
Project ID
102 103 104 |
# File 'lib/cryptopay/models/channel.rb', line 102 def project_id @attributes[:project_id] end |
#receiver_currency ⇒ Object
The currency which all incoming transactions will be converted to
87 88 89 |
# File 'lib/cryptopay/models/channel.rb', line 87 def receiver_currency @attributes[:receiver_currency] end |
#status ⇒ Object
67 68 69 |
# File 'lib/cryptopay/models/channel.rb', line 67 def status @attributes[:status] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
168 169 170 |
# File 'lib/cryptopay/models/channel.rb', line 168 def to_hash ENCODER.to_hash(@attributes) end |
#uri ⇒ Object
Channel URI. May be used for generating a QR code
117 118 119 |
# File 'lib/cryptopay/models/channel.rb', line 117 def uri @attributes[:uri] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
162 163 164 |
# File 'lib/cryptopay/models/channel.rb', line 162 def valid? invalid_properties.empty? end |