Class: Streambird::Api::Otp::Sms
- Inherits:
-
Struct
- Object
- Struct
- Streambird::Api::Otp::Sms
- Defined in:
- lib/streambird/api/otp.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #login_or_create(phone_number:, expires_in: nil, requires_verification: nil, device_fingerprint: {}) ⇒ Object
- #send(phone_number:, expires_in: nil, device_fingerprint: {}) ⇒ Object
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client
71 72 73 |
# File 'lib/streambird/api/otp.rb', line 71 def client @client end |
Instance Method Details
#login_or_create(phone_number:, expires_in: nil, requires_verification: nil, device_fingerprint: {}) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/streambird/api/otp.rb', line 73 def login_or_create(phone_number:, expires_in: nil, requires_verification: nil, device_fingerprint: {} ) req = { 'phone_number': phone_number, } req['expires_in'] = expires_in if !expires_in.nil? req['requires_verification'] = requires_verification if !requires_verification.nil? req['device_fingerprint'] = device_fingerprint if device_fingerprint != {} response = client.post('auth/otps/sms/login_or_create', req) json_body = JSON.parse(response.body, symbolize_names: true) return json_body end |
#send(phone_number:, expires_in: nil, device_fingerprint: {}) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/streambird/api/otp.rb', line 92 def send(phone_number:, expires_in: nil, device_fingerprint: {} ) req = { 'phone_number': phone_number, } req['expires_in'] = expires_in if !expires_in.nil? req['device_fingerprint'] = device_fingerprint if device_fingerprint != {} response = client.post('auth/otps/sms/send', req) json_body = JSON.parse(response.body, symbolize_names: true) return json_body end |