Class: IqSMS::Response

Inherits:
Object
  • Object
show all
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

Direct Known Subclasses

Balance, SendSms, Senders

Defined Under Namespace

Classes: Balance, SendSms, Senders, Status, StatusQueue

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hashObject (readonly)

Returns the value of attribute hash.



3
4
5
# File 'lib/iqsms/response.rb', line 3

def hash
  @hash
end

#original_responseObject (readonly)

Returns the value of attribute original_response.



3
4
5
# File 'lib/iqsms/response.rb', line 3

def original_response
  @original_response
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/iqsms/response.rb', line 3

def status
  @status
end