Exception: Counterparty::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/counterparty_ruby.rb

Overview

This exception comes from an error relating to a proper request, but an inability to complete the request via the counterpartyd api

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ResponseError

Returns a new instance of ResponseError.



37
38
39
40
41
42
43
44
45
# File 'lib/counterparty_ruby.rb', line 37

def initialize(json)
  @message_class, @code = json['message'], json['code']

  json['data'].each_pair do |(k,v)|
    instance_variable_set '@data_%s' % k, v
  end if json.has_key? 'data'

  super
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



34
35
36
# File 'lib/counterparty_ruby.rb', line 34

def code
  @code
end

#data_argsObject (readonly)

Returns the value of attribute data_args.



32
33
34
# File 'lib/counterparty_ruby.rb', line 32

def data_args
  @data_args
end

#data_messageObject (readonly)

Returns the value of attribute data_message.



33
34
35
# File 'lib/counterparty_ruby.rb', line 33

def data_message
  @data_message
end

#data_typeObject (readonly)

Returns the value of attribute data_type.



31
32
33
# File 'lib/counterparty_ruby.rb', line 31

def data_type
  @data_type
end

#message_classObject (readonly)

Returns the value of attribute message_class.



35
36
37
# File 'lib/counterparty_ruby.rb', line 35

def message_class
  @message_class
end

Instance Method Details

#messageObject



47
48
49
# File 'lib/counterparty_ruby.rb', line 47

def message
  '%s: %s' % [@message_class,@data_message]
end