Class: AmazonDrs::Base
- Inherits:
-
Object
- Object
- AmazonDrs::Base
- Defined in:
- lib/amazon-drs/base.rb
Direct Known Subclasses
AccessToken, DeregistrateDevice, DeviceStatus, Error, Replenish, SlotStatus, SubscriptionInfo, TestOrders
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#error_description_url ⇒ Object
Returns the value of attribute error_description_url.
-
#error_type ⇒ Object
Returns the value of attribute error_type.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(response) ⇒ Base
constructor
A new instance of Base.
- #inspect ⇒ Object
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
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/amazon-drs/base.rb', line 5 def date @date end |
#error_description_url ⇒ Object
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_type ⇒ Object
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_id ⇒ Object
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_code ⇒ Object
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
#inspect ⇒ Object
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 |