Class: AmazonDrs::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon-drs/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
# File 'lib/amazon-drs/base.rb', line 7

def initialize(response)
  @response = response
  @status_code = response.code.to_i
  parse_header(response)
  parse_body(response.body)
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



5
6
7
# File 'lib/amazon-drs/base.rb', line 5

def date
  @date
end

#error_description_urlObject

Returns the value of attribute error_description_url.



5
6
7
# File 'lib/amazon-drs/base.rb', line 5

def error_description_url
  @error_description_url
end

#error_typeObject

Returns the value of attribute error_type.



5
6
7
# File 'lib/amazon-drs/base.rb', line 5

def error_type
  @error_type
end

#request_idObject

Returns the value of attribute request_id.



5
6
7
# File 'lib/amazon-drs/base.rb', line 5

def request_id
  @request_id
end

#status_codeObject

Returns the value of attribute status_code.



5
6
7
# File 'lib/amazon-drs/base.rb', line 5

def status_code
  @status_code
end

Instance Method Details

#inspectObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/amazon-drs/base.rb', line 40

def inspect
  if @status_code == 200
    self.class.name
  else
    resp = "ERROR #{@status_code} : "
    resp += @message if instance_variable_defined?(:@message) && @message
    resp += @error_description if instance_variable_defined?(:@error_description) && @error_description
    resp
  end
end