class OmiseGO::Base
Attributes
attributes_list[RW]
client[RW]
original_payload[RW]
Public Class Methods
attributes(*attrs)
click to toggle source
# File lib/omisego/base.rb, line 6 def attributes(*attrs) attr_accessor(*attrs) @attributes_list = attrs.map(&:to_sym) end
global_client()
click to toggle source
# File lib/omisego/base.rb, line 11 def global_client Client.new end
new(attributes, client: nil)
click to toggle source
# File lib/omisego/base.rb, line 22 def initialize(attributes, client: nil) self.class.attributes_list ||= [] self.class.attributes_list.each do |name| instance_variable_set("@#{name}", attributes[name.to_sym] || attributes[name.to_s]) end self.original_payload = attributes @client = client || self.class.global_client end
request(client)
click to toggle source
# File lib/omisego/base.rb, line 15 def request(client) (client || global_client).request end
Public Instance Methods
error?()
click to toggle source
# File lib/omisego/base.rb, line 46 def error? false end
inspect()
click to toggle source
# File lib/omisego/base.rb, line 34 def inspect string = "#<#{self.class.name}:#{object_id} " fields = self.class.attributes_list.map do |field| "#{field}: #{send(field)}" end string << fields.join(', ') << '>' end
success?()
click to toggle source
# File lib/omisego/base.rb, line 42 def success? true end