class Cryptopay::Channel

Constants

ENCODER

Public Class Methods

build_from_hash(data) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Cryptopay::Channel] Returns the model itself

# File lib/cryptopay/models/channel.rb, line 141
def self.build_from_hash(data)
  attributes = ENCODER.build_from_hash(data)
  new(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/cryptopay/models/channel.rb, line 48
def initialize(attributes = {})
  @attributes = ENCODER.sanitize(attributes)
end

Public Instance Methods

address() click to toggle source
# File lib/cryptopay/models/channel.rb, line 76
def address
  @attributes[:address]
end
custom_id() click to toggle source
# File lib/cryptopay/models/channel.rb, line 84
def custom_id
  @attributes[:custom_id]
end
customer_id() click to toggle source
# File lib/cryptopay/models/channel.rb, line 88
def customer_id
  @attributes[:customer_id]
end
description() click to toggle source
# File lib/cryptopay/models/channel.rb, line 64
def description
  @attributes[:description]
end
hosted_page_url() click to toggle source
# File lib/cryptopay/models/channel.rb, line 96
def hosted_page_url
  @attributes[:hosted_page_url]
end
id() click to toggle source
# File lib/cryptopay/models/channel.rb, line 52
def id
  @attributes[:id]
end
inspect() click to toggle source
# File lib/cryptopay/models/channel.rb, line 152
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
end
invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/cryptopay/models/channel.rb, line 102
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 "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() click to toggle source
# File lib/cryptopay/models/channel.rb, line 60
def name
  @attributes[:name]
end
pay_currency() click to toggle source
# File lib/cryptopay/models/channel.rb, line 68
def pay_currency
  @attributes[:pay_currency]
end
project_id() click to toggle source
# File lib/cryptopay/models/channel.rb, line 80
def project_id
  @attributes[:project_id]
end
receiver_currency() click to toggle source
# File lib/cryptopay/models/channel.rb, line 72
def receiver_currency
  @attributes[:receiver_currency]
end
status() click to toggle source
# File lib/cryptopay/models/channel.rb, line 56
def status
  @attributes[:status]
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/cryptopay/models/channel.rb, line 148
def to_hash
  ENCODER.to_hash(@attributes)
end
uri() click to toggle source
# File lib/cryptopay/models/channel.rb, line 92
def uri
  @attributes[:uri]
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/cryptopay/models/channel.rb, line 134
def valid?
  invalid_properties.empty?
end