Class: Net::SMS::BulkSMS::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/net/sms/bulksms/response.rb

Overview

A response sent by the BulkSMS gateway

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, description, batch_id) ⇒ Response

Returns a new instance of Response.



9
10
11
12
13
# File 'lib/net/sms/bulksms/response.rb', line 9

def initialize(code, description, batch_id)
	@code = code
	@description = description
	@batch_id = batch_id
end

Instance Attribute Details

#batch_idObject (readonly)

Returns the value of attribute batch_id.



7
8
9
# File 'lib/net/sms/bulksms/response.rb', line 7

def batch_id
  @batch_id
end

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'lib/net/sms/bulksms/response.rb', line 7

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/net/sms/bulksms/response.rb', line 7

def description
  @description
end

Class Method Details

.parse(response_text) ⇒ Object



15
16
17
18
# File 'lib/net/sms/bulksms/response.rb', line 15

def self.parse(response_text)
	tokens = response_text.split('|')
	self.new tokens[0].to_i, tokens[1], tokens[2].to_i
end

Instance Method Details

#successful?Boolean

Was the original request successful?

Returns:

  • (Boolean)


21
22
23
# File 'lib/net/sms/bulksms/response.rb', line 21

def successful?
	(@code == 0) ? true : false
end