Class: NeteaseSms::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_key_id, access_key_secret) ⇒ Client

Returns a new instance of Client.



17
18
19
20
# File 'lib/netease_sms.rb', line 17

def initialize(access_key_id, access_key_secret)
  @access_key_id = access_key_id
  @access_key_secret = access_key_secret
end

Instance Attribute Details

#access_key_idObject (readonly)

Returns the value of attribute access_key_id.



15
16
17
# File 'lib/netease_sms.rb', line 15

def access_key_id
  @access_key_id
end

#access_key_secretObject (readonly)

Returns the value of attribute access_key_secret.



15
16
17
# File 'lib/netease_sms.rb', line 15

def access_key_secret
  @access_key_secret
end

Instance Method Details

#check_status(sendid) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/netease_sms.rb', line 32

def check_status(sendid)
  host = 'https://api.netease.im/sms/querystatus.action'

  http_post(host, {
    sendid: sendid
  })
end

#send_sms(template_id, cellphones, params) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/netease_sms.rb', line 22

def send_sms(template_id, cellphones, params)
  host = 'https://api.netease.im/sms/sendtemplate.action'

  http_post(host, {
    templateid: template_id, 
    mobiles: cellphones.to_json, 
    params: params.to_json
  })
end