Module: Auth

Defined in:
lib/dapi/products/Auth.rb

Instance Method Summary collapse

Instance Method Details

#checkLogin(appSecret, userSecret, sync, addresses) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dapi/products/Auth.rb', line 18

def checkLogin(appSecret, userSecret, sync, addresses)
    payload = { 
        appSecret: appSecret,
        userSecret: userSecret,
        sync: sync
    }
    headers = { 
        "Content-Type": "application/json"
    }

    response = HTTParty.post( "https://api.dapi.co/v1/auth/login/check", {body: payload.to_json, headers: headers})
end

#delinkUser(appSecret, accessCode, token) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dapi/products/Auth.rb', line 31

def delinkUser(appSecret, accessCode, token)
    payload = { 
        appSecret: appSecret,
        accessCode: accessCode
    }
    headers = { 
        "Content-Type": "application/json",
         Authorization: "Bearer #{token}"
    }

    response = HTTParty.post( "https://api.dapi.co/v1/Users/DelinkUser", {body: payload.to_json, headers: headers} )
end

#exchangeToken(appSecret, accessCode, connectionID) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dapi/products/Auth.rb', line 5

def exchangeToken(appSecret, accessCode, connectionID)
    payload = { 
        appSecret: appSecret,
        accessCode: accessCode,
        connectionID: connectionID
    }
    headers = { 
        "Content-Type": "application/json"
    }

    response = HTTParty.post( "http://localhost:80/v1/auth/ExchangeToken", {body: payload.to_json, headers: headers} )
end

#refreshAccessToken(appSecret, accessToken) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dapi/products/Auth.rb', line 44

def refreshAccessToken(appSecret, accessToken)
    payload = { 
        appSecret: appSecret,
        accessToken: accessToken
    }
    headers = { 
        "Content-Type": "application/json",
         Authorization: "Bearer #{token}"
    }

    response = HTTParty.post( "https://api.dapi.co/v1/Users/DelinkUser", {body: payload.to_json, headers: headers} )
end