Class: IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityApi
Instance Attribute Summary collapse
#apiContext, #host, #moduleName, #remoteApi, #remoteApiClass, #sw
Instance Method Summary
collapse
#get, #getHost, #getModuleName, #getOkHttpClient, #getRemoteApi, #getRemoteApiClass, #getRetrofitClient, #getSw, #newRequest, #post, #put, #setApiContext, #setHost, #setModuleName, #setRemoteApiClass, #setSw
Constructor Details
Returns a new instance of IdentityApi.
11
12
13
14
15
16
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 11
def initialize()
super()
setModuleName("identity")
setRemoteApiClass(IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityRemoteApi)
@remoteApiObj = getRemoteApiClass().new
end
|
Instance Attribute Details
#remoteApiObj ⇒ Object
Returns the value of attribute remoteApiObj.
9
10
11
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 9
def remoteApiObj
@remoteApiObj
end
|
Instance Method Details
#authorize(authorizeService, code, state, callback) ⇒ Object
96
97
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 96
def authorize(authorizeService, code, state, callback)
end
|
#connect(oauth_details, connectService) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 73
def connect(oauth_details, connectService)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getClientToken.getAccess_token()
map = @apiContext.getClientCredentials()
clientId = map["client_id"]
response = remoteApi.connect(authorization, oauth_details, connectService, clientId)
if response.code == 200
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(response.parsed_response)
@apiContext.setUserToken('identity', memberApiModel.token.getAccess_token)
{ status: 200, data: memberApiModel}
elsif response.code == 400
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new
memberApiModel.add_errors(response.parsed_response)
{ status: 400, data: memberApiModel}
else
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new
memberApiModel.add_messages(response.parsed_response)
{ status: response.code, data: memberApiModel}
end
end
|
#getClientToken(scope = nil) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 18
def getClientToken(scope = nil)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
map = @apiContext.getClientCredentials()
clientId = map["client_id"]
secret = map["client_secret"]
response = remoteApi.getToken(clientId, secret, "client_credentials", scope)
if response.code == 200
tokenApiModel = IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel.new(response.parsed_response)
@apiContext.setClientToken(tokenApiModel)
return tokenApiModel
else
return response.parsed_response
end
end
|
#getMemberDetails(uuid) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 99
def getMemberDetails(uuid)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getUserToken('identity')
response = remoteApi.getMemberDetails(authorization, uuid)
if response.code == 200
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(response.parsed_response, false)
{status: 200, data: memberApiModel}
else
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(nil, false)
memberApiModel.add_messages(response.parsed_response)
{ status: response.code, data: memberApiModel}
end
end
|
#login(loginModel) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 34
def login(loginModel)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getClientToken.getAccess_token()
response = remoteApi.login(authorization, loginModel)
if response.code == 200
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(response.parsed_response)
@apiContext.setUserToken('identity', memberApiModel.token.getAccess_token)
{ status: 200, data: memberApiModel}
elsif response.code == 400
loginModel.add_errors(response.parsed_response)
{ status: 400, data: loginModel}
else
loginModel.add_messages(response.parsed_response)
{ status: response.code, data: loginModel}
end
end
|
#logout ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 149
def logout
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getUserToken('identity')
response = remoteApi.logout(authorization)
loginModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::LoginModel.new
if response.code == 200
@apiContext.setUserToken('identity', nil)
loginModel.add_messages(response.parsed_response)
{status: 200, data: loginModel}
else
loginModel.add_messages(response.parsed_response)
{status: response.code, data: loginModel}
end
end
|
#resetCredentials(resetPasswordModel, callback) ⇒ Object
145
146
147
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 145
def resetCredentials(resetPasswordModel, callback)
end
|
#signup(memberSignupModel) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 52
def signup(memberSignupModel)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getClientToken.getAccess_token()
response = remoteApi.signup(authorization, memberSignupModel)
if response.code == 200
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(response.parsed_response)
@apiContext.setUserToken('identity', memberApiModel.token.getAccess_token)
{status: 200, data: memberApiModel}
elsif response.code == 400
memberSignupModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberSignupModel.new
memberSignupModel.add_errors(response.parsed_response)
{status: response.code, data: memberSignupModel}
else
memberSignupModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberSignupModel.new
memberSignupModel.add_messages(response.parsed_response)
{status: response.code, data: memberApiModel}
end
end
|
#socialWebViewLogin(connectService, callback) ⇒ Object
165
166
167
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 165
def socialWebViewLogin(connectService, callback)
end
|
#tokenVerify(authorization, tokenToVerify, module_key) ⇒ Object
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 169
def tokenVerify(authorization, tokenToVerify, module_key)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
response = remoteApi.tokenVerify(authorization, tokenToVerify, module_key)
if response.code == 200
moduleTokenApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::ModuleTokenApiModel.new(response.parsed_response)
{status: 200, data: moduleTokenApiModel}
else
moduleTokenApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::ModuleTokenApiModel.new
moduleTokenApiModel.add_messages(response.parsed_response)
{status: response.code, data: moduleTokenApiModel}
end
end
|
#updateCredentials(updatePasswordApiModel) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 130
def updateCredentials(updatePasswordApiModel)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getUserToken('identity')
response = remoteApi.updateCredentials(authorization, updatePasswordApiModel)
if response.code == 400
updatePasswordApiModel.add_errors(response.parsed_response)
{ status: 400, data: updatePasswordApiModel}
else
updatePasswordApiModel.add_messages(response.parsed_response)
{ status: response.code, data: updatePasswordApiModel}
end
end
|
#updateMemberDetails(uuid, memberApiModel) ⇒ Object
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb', line 115
def updateMemberDetails(uuid, memberApiModel)
remoteApi = @remoteApiObj
@remoteApiObj.host_url = @apiContext.getHost('identity')
authorization = @apiContext.getUserToken('identity')
response = remoteApi.updateMemberDetails(authorization, uuid, memberApiModel)
if response.code == 200
memberApiModel = IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel.new(response.parsed_response, false)
{status: 200, data: memberApiModel}
elsif response.code == 400
memberApiModel.add_errors(api_response.parsed_response)
{status: 400, data: memberApiModel}
end
end
|