Class: IqSMS::Response
- Inherits:
-
Object
- Object
- IqSMS::Response
- Defined in:
- lib/iqsms/response.rb,
lib/iqsms/response/status.rb,
lib/iqsms/response/balance.rb,
lib/iqsms/response/senders.rb,
lib/iqsms/response/send_sms.rb,
lib/iqsms/response/status_queue.rb
Defined Under Namespace
Classes: Balance, SendSms, Senders, Status, StatusQueue
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#original_response ⇒ Object
readonly
Returns the value of attribute original_response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(original_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(original_response) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/iqsms/response.rb', line 5 def initialize(original_response) @original_response = original_response @hash = if @original_response.body.present? JSON.parse(@original_response.body) else {} end @hash = IqSMS::Utils.deeply_with_indifferent_access(@hash) @status = RequestStatus.new(@hash[:status], @hash[:description]) end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
3 4 5 |
# File 'lib/iqsms/response.rb', line 3 def hash @hash end |
#original_response ⇒ Object (readonly)
Returns the value of attribute original_response.
3 4 5 |
# File 'lib/iqsms/response.rb', line 3 def original_response @original_response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/iqsms/response.rb', line 3 def status @status end |