Class: M360::SMS::Globelabs

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/m360/sms/globelabs.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Globelabs

Returns a new instance of Globelabs.



14
15
16
17
18
19
20
# File 'lib/m360/sms/globelabs.rb', line 14

def initialize(options = {})
  @passphrase = options.fetch(:passphrase, ENV['M360_GLABS_PASSPHRASE'])
  @sender = options.fetch(:sender, ENV['M360_GLABS_SENDER'])
  @correlator = options[:correlator]
  @address = options.fetch(:address)
  @message = options.fetch(:message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



12
13
14
# File 'lib/m360/sms/globelabs.rb', line 12

def response
  @response
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



12
13
14
# File 'lib/m360/sms/globelabs.rb', line 12

def response_body
  @response_body
end

Class Method Details

.call(options = {}) ⇒ Object



22
23
24
# File 'lib/m360/sms/globelabs.rb', line 22

def self.call(options = {})
  new(options).call
end

Instance Method Details

#callObject



26
27
28
29
# File 'lib/m360/sms/globelabs.rb', line 26

def call
  @response = perform_request
  @response_body = JSON.parse(@response.body)
end

#success?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/m360/sms/globelabs.rb', line 31

def success?
  response.code == 201
end