Module: ChinaSMS

Extended by:
ChinaSMS
Included in:
ChinaSMS
Defined in:
lib/china_sms.rb,
lib/china_sms/version.rb,
lib/china_sms/service/emay.rb,
lib/china_sms/service/tui3.rb,
lib/china_sms/service/smsbao.rb,
lib/china_sms/service/chanyoo.rb,
lib/china_sms/service/yunpian.rb

Defined Under Namespace

Modules: Service

Constant Summary collapse

VERSION =
"0.0.6"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



11
12
13
# File 'lib/china_sms.rb', line 11

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



11
12
13
# File 'lib/china_sms.rb', line 11

def username
  @username
end

Instance Method Details

#clearObject



30
31
32
# File 'lib/china_sms.rb', line 30

def clear
  @service = @username = @password = nil
end

#get(options = {}) ⇒ Object



25
26
27
28
# File 'lib/china_sms.rb', line 25

def get(options = {})
  options = default_options.merge options
  @service.get options if @service
end

#to(receiver, content, options = {}) ⇒ Object



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

def to(receiver, content, options = {})
  options = default_options.merge options
  @service.to receiver, content.strip, options if @service
end

#use(service, options) ⇒ Object



13
14
15
16
17
18
# File 'lib/china_sms.rb', line 13

def use(service, options)
  @service = ChinaSMS::Service.const_get("#{service.to_s.capitalize}")
  @service.const_set("URL", options[:base_uri]) if options[:base_uri]
  @username = options[:username]
  @password = options[:password]
end