Class: QuickeyRubySdk::App

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil) ⇒ App

Returns a new instance of App.



9
10
11
12
# File 'lib/quickey_ruby_sdk/app.rb', line 9

def initialize(api_key: nil)
    @api_key = api_key
    @api_base = QuickeyRubySdk::API_BASE
end

Instance Attribute Details

#api_baseObject (readonly)

Returns the value of attribute api_base.



6
7
8
# File 'lib/quickey_ruby_sdk/app.rb', line 6

def api_base
  @api_base
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



7
8
9
# File 'lib/quickey_ruby_sdk/app.rb', line 7

def api_key
  @api_key
end

Instance Method Details

#getMetaDataObject



14
15
16
# File 'lib/quickey_ruby_sdk/app.rb', line 14

def 
   JSON.parse HTTParty.post(@api_base+"/auth/apiKey", body: { "apiKey": @api_key }).body
end

#sendOTP(phone, provider) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/quickey_ruby_sdk/app.rb', line 18

def sendOTP(phone, provider)
    response = JSON.parse HTTParty.post(@api_base+"/otp/sendToUserPhone",
        body: {
            "phone": phone,
            "provider": provider
        },
        headers: {
            "Authorization": @api_key
        }).body
    response
end