Class: Playsms::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/playsms.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
# File 'lib/playsms.rb', line 14

def initialize(options = {})
  @user = options.fetch(:user) { ENV.fetch('PLAYSMS_USER') }
  @secret = options.fetch(:secret) { ENV.fetch('PLAYSMS_SECRET') }
  @host = options.fetch(:host) { 'http://playsms.example.com' }
  @user_agent = "playsms-ruby/#{VERSION} ruby/#{RUBY_VERSION}"
end

Instance Attribute Details

#secretObject

Returns the value of attribute secret.



12
13
14
# File 'lib/playsms.rb', line 12

def secret
  @secret
end

#userObject

Returns the value of attribute user.



12
13
14
# File 'lib/playsms.rb', line 12

def user
  @user
end

Instance Method Details

#send_message(params) ⇒ Object



21
22
23
# File 'lib/playsms.rb', line 21

def send_message(params)
  post(@host, '/index.php?app=ws&op=pv&', params)
end