Method: OSDNClient::ApiError#initialize

Defined in:
lib/osdn-client/api_error.rb

#initialize(arg = nil) ⇒ ApiError

Usage examples:

ApiError.new
ApiError.new("message")
ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
ApiError.new(:code => 404, :message => "Not Found")
[View source]

33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/osdn-client/api_error.rb', line 33

def initialize(arg = nil)
  if arg.is_a? Hash
    arg.each do |k, v|
      if k.to_s == 'message'
        super v
      else
        instance_variable_set "@#{k}", v
      end
    end
  else
    super arg
  end
end