Module: ConfirmationCode::Service::Lianzhong
- Extended by:
- Lianzhong
- Includes:
- ConfirmationCode
- Included in:
- Lianzhong
- Defined in:
- lib/confirmation_code/service/lianzhong.rb
Constant Summary collapse
- UPLOAD_URL =
'http://bbb4.hyslt.com/api.php?mod=php&act=upload'- ACCOUNT_URL =
'http://bbb4.hyslt.com/api.php?mod=php&act=point'- RECOGNITION_ERROR_URL =
'http://bbb4.hyslt.com/api.php?mod=php&act=error'
Constants included from ConfirmationCode
Instance Attribute Summary
Attributes included from ConfirmationCode
Instance Method Summary collapse
- #account(options = {}) ⇒ Object
- #client ⇒ Object
- #default_options ⇒ Object
- #recognition_error(options = {}) ⇒ Object
- #upload(image_url, options = {}) ⇒ Object
Methods included from ConfirmationCode
Instance Method Details
#account(options = {}) ⇒ Object
33 34 35 36 |
# File 'lib/confirmation_code/service/lianzhong.rb', line 33 def account( = {}) response = client.post(ACCOUNT_URL, ) JSON.parse(response.body) end |
#client ⇒ Object
17 18 19 |
# File 'lib/confirmation_code/service/lianzhong.rb', line 17 def client @client ||= HTTPClient.new end |
#default_options ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/confirmation_code/service/lianzhong.rb', line 43 def { yzm_minlen: '4', yzm_maxlen: '6', yzmtype_mark: '', zztool_token: '', } end |
#recognition_error(options = {}) ⇒ Object
38 39 40 41 |
# File 'lib/confirmation_code/service/lianzhong.rb', line 38 def recognition_error( = {}) response = client.post(RECOGNITION_ERROR_URL, ) JSON.parse(response.body) end |
#upload(image_url, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/confirmation_code/service/lianzhong.rb', line 21 def upload(image_url, = {}) File.open("code.jpeg", "wb") do |f| f.write open(image_url).read end = .merge File.open('code.jpeg') do |file| ['upload'] = file response = client.post(UPLOAD_URL, ) JSON.parse(response.body) end end |