Module: Smslist::Client::State

Included in:
Smslist::Client
Defined in:
lib/smslist/client/state.rb

Constant Summary collapse

STATE_ERRORS =
{
  1 => 'The subscriber is absent or out of a coverage',
  2 => 'Call barred service activated',
  3 => 'Unknown subscriber',
  4 => 'Memory capacity exceeded',
  5 => 'Equipment protocol error',
  6 => 'Teleservice not provisioned',
  7 => 'Facility not supported',
  8 => 'Subscriber is busy',
  9 => 'Roaming restrictions',
  10 => 'Timeout',
  11 => 'SS7 routing error',
  12 => 'Internal system failure',
  13 => 'SMSC failure'
}.freeze

Instance Method Summary collapse

Instance Method Details

#state(message_ids = []) ⇒ Hash

Get state for a list of message ids

Examples:

Get state for a list of message ids

client = Smslist.new(token: 'secret')

message_ids = %w(10001 10002 10003)
client.state(message_ids)

Parameters:

  • message_ids (Array) (defaults to: [])

    Array of message ids

Returns:

  • (Hash)

    Hash with state, time or error for each message



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/smslist/client/state.rb', line 29

def state(message_ids = [])
  body = build_xml_body do |xml|
    xml.get_state {
      message_ids.each do |id|
        xml.id_sms id
      end
    }
  end

  response = parse_xml(post body.to_xml, :state)
  parse_state_response(response)
end