Class: MobilyApiResponse
- Inherits:
-
Object
- Object
- MobilyApiResponse
- Defined in:
- lib/mobily/mobily_api_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#response_status ⇒ Object
Returns the value of attribute response_status.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_data(key, value) ⇒ Object
- #eql?(other) ⇒ Boolean
- #get(key) ⇒ Object
-
#initialize(status, response_status) ⇒ MobilyApiResponse
constructor
A new instance of MobilyApiResponse.
Constructor Details
#initialize(status, response_status) ⇒ MobilyApiResponse
Returns a new instance of MobilyApiResponse.
4 5 6 7 8 |
# File 'lib/mobily/mobily_api_response.rb', line 4 def initialize(status, response_status) @status = status @response_status = response_status.downcase @data = {} end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'lib/mobily/mobily_api_response.rb', line 2 def data @data end |
#response_status ⇒ Object
Returns the value of attribute response_status.
2 3 4 |
# File 'lib/mobily/mobily_api_response.rb', line 2 def response_status @response_status end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'lib/mobily/mobily_api_response.rb', line 2 def status @status end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/mobily/mobily_api_response.rb', line 18 def == other eql?(other) end |
#add_data(key, value) ⇒ Object
10 11 12 |
# File 'lib/mobily/mobily_api_response.rb', line 10 def add_data(key, value) @data.merge!({key => value}) end |
#eql?(other) ⇒ Boolean
22 23 24 |
# File 'lib/mobily/mobily_api_response.rb', line 22 def eql? other [@status, @response_status, @data].eql?([other.status, other.response_status, other.data]) end |
#get(key) ⇒ Object
14 15 16 |
# File 'lib/mobily/mobily_api_response.rb', line 14 def get(key) @data.has_key?(key) ? @data[key] : nil end |