Class: Redex::Response::BaseResponse
- Inherits:
-
Object
- Object
- Redex::Response::BaseResponse
- Defined in:
- lib/redex/response/base_response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#sequential_id ⇒ Object
readonly
Returns the value of attribute sequential_id.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #clear(httpi_result) ⇒ Object
- #datetime_sanitize(raw_date, raw_time) ⇒ Object
-
#initialize(raw_response) ⇒ BaseResponse
constructor
A new instance of BaseResponse.
Constructor Details
#initialize(raw_response) ⇒ BaseResponse
Returns a new instance of BaseResponse.
6 7 8 |
# File 'lib/redex/response/base_response.rb', line 6 def initialize(raw_response) @raw = clear(raw_response) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/redex/response/base_response.rb', line 4 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/redex/response/base_response.rb', line 4 def @message end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
4 5 6 |
# File 'lib/redex/response/base_response.rb', line 4 def raw @raw end |
#sequential_id ⇒ Object (readonly)
Returns the value of attribute sequential_id.
4 5 6 |
# File 'lib/redex/response/base_response.rb', line 4 def sequential_id @sequential_id end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
4 5 6 |
# File 'lib/redex/response/base_response.rb', line 4 def transaction_id @transaction_id end |
Instance Method Details
#clear(httpi_result) ⇒ Object
10 11 12 13 14 |
# File 'lib/redex/response/base_response.rb', line 10 def clear(httpi_result) httpi_result = Hash[httpi_result.map { |k, v| [k.to_sym, v] }] httpi_result.select! {|k,v| v != [{"i:nil"=>"true"}]} httpi_result.each { |k, v| httpi_result[k] = v.first } end |
#datetime_sanitize(raw_date, raw_time) ⇒ Object
32 33 34 35 36 |
# File 'lib/redex/response/base_response.rb', line 32 def datetime_sanitize(raw_date, raw_time) if raw_date && raw_time DateTime.strptime(raw_date + raw_time + '-03:00', '%Y%m%d%H:%M:%S%z') end end |