Class: IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityRemoteApi
- Inherits:
-
Object
- Object
- IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityRemoteApi
- Includes:
- HTTMultiParty
- Defined in:
- lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb
Constant Summary collapse
- FACEBOOK_LOGIN_URI =
Api Server Social Authentication End Point URIs
"/api/identity/v0/auth/social/facebook/connect"
- GOOGLE_LOGIN_URI =
"/api/identity/v0/auth/social/googlePlus/connect"
- TWITER_LOGIN_URI =
"/api/identity/v0/auth/social/twitter/connect"
- GITHUB_LOGIN_URI =
"/api/identity/v0/auth/social/gitHub/connect"
- LINKEDIN_LOGIN_URI =
"/api/identity/v0/auth/social/linkedIn/connect"
- INSTAGRAM_LOGIN_URI =
"/api/identity/v0/auth/social/instagram/connect"
- INVALID_SOCIAL_URI =
"/api/identity/v0/auth/social/invalid/connect"
Instance Attribute Summary collapse
-
#authorizeUrl ⇒ Object
Returns the value of attribute authorizeUrl.
-
#baseIdentityUrl ⇒ Object
Returns the value of attribute baseIdentityUrl.
-
#changeUrl ⇒ Object
Returns the value of attribute changeUrl.
-
#connectUrl ⇒ Object
Returns the value of attribute connectUrl.
-
#forgotUrl ⇒ Object
Returns the value of attribute forgotUrl.
-
#host_url ⇒ Object
Returns the value of attribute host_url.
-
#loginUrl ⇒ Object
Returns the value of attribute loginUrl.
-
#logoutUrl ⇒ Object
Returns the value of attribute logoutUrl.
-
#profileUrl ⇒ Object
Returns the value of attribute profileUrl.
-
#signupUrl ⇒ Object
Returns the value of attribute signupUrl.
-
#socialLoginUrl ⇒ Object
Returns the value of attribute socialLoginUrl.
-
#tokenUrl ⇒ Object
Returns the value of attribute tokenUrl.
Instance Method Summary collapse
- #authorize ⇒ Object
- #connect(authorization, oauth_details, connectService, clientId) ⇒ Object
-
#get_social_login_uri(provider) ⇒ Object
Method to return end point URI for specific social login.
- #getMemberDetails(authorization, uuid) ⇒ Object
- #getToken(clientId, clientSecret, grantType, scope = nil) ⇒ Object
-
#initialize ⇒ IdentityRemoteApi
constructor
A new instance of IdentityRemoteApi.
- #login(authorization, loginModel) ⇒ Object
- #logout(authorization) ⇒ Object
- #refreshAccessToken ⇒ Object
- #resetCredentials ⇒ Object
- #signup(authorization, memberSignupModel) ⇒ Object
- #socialWebViewLogin ⇒ Object
- #tokenVerify(authorization, tokenToVerify, module_key) ⇒ Object
- #updateCredentials(authorization, updatePasswordApiModel) ⇒ Object
- #updateMemberDetails(authorization, uuid, memberApiModel) ⇒ Object
Constructor Details
#initialize ⇒ IdentityRemoteApi
Returns a new instance of IdentityRemoteApi.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 30 def initialize() @baseIdentityUrl = "/api/identity/v0" @tokenUrl = "/oauth/token" @tokenVerifyUrl = "/api/oauth/v0/tokens" @loginUrl = @baseIdentityUrl + "/auth/login" @signupUrl = @baseIdentityUrl + "/users/signup" @profileUrl = @baseIdentityUrl + "/users" @forgotUrl = @baseIdentityUrl + "/auth/forgotPassword" @changeUrl = @baseIdentityUrl + "/auth/changePassword" @logoutUrl = @baseIdentityUrl + "/auth/logout" @connectUrl = @baseIdentityUrl + "/auth/social/{connectService}/connect" @authorizeUrl = @baseIdentityUrl + "/auth/social/{authorizeService}/authorize" @socialLoginUrl = @baseIdentityUrl + "/auth/social/{loginService}/login" end |
Instance Attribute Details
#authorizeUrl ⇒ Object
Returns the value of attribute authorizeUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def @authorizeUrl end |
#baseIdentityUrl ⇒ Object
Returns the value of attribute baseIdentityUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def baseIdentityUrl @baseIdentityUrl end |
#changeUrl ⇒ Object
Returns the value of attribute changeUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def changeUrl @changeUrl end |
#connectUrl ⇒ Object
Returns the value of attribute connectUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def connectUrl @connectUrl end |
#forgotUrl ⇒ Object
Returns the value of attribute forgotUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def forgotUrl @forgotUrl end |
#host_url ⇒ Object
Returns the value of attribute host_url.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def host_url @host_url end |
#loginUrl ⇒ Object
Returns the value of attribute loginUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def loginUrl @loginUrl end |
#logoutUrl ⇒ Object
Returns the value of attribute logoutUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def logoutUrl @logoutUrl end |
#profileUrl ⇒ Object
Returns the value of attribute profileUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def profileUrl @profileUrl end |
#signupUrl ⇒ Object
Returns the value of attribute signupUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def signupUrl @signupUrl end |
#socialLoginUrl ⇒ Object
Returns the value of attribute socialLoginUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def @socialLoginUrl end |
#tokenUrl ⇒ Object
Returns the value of attribute tokenUrl.
11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 11 def tokenUrl @tokenUrl end |
Instance Method Details
#authorize ⇒ Object
83 84 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 83 def end |
#connect(authorization, oauth_details, connectService, clientId) ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 86 def connect(, oauth_details, connectService, clientId) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? @connect_service = (connectService) body = { :clientId => clientId, :accessToken => oauth_details[:credentials][:token], :expiresIn => "#{oauth_details[:credentials][:expires_at]}" } response = self.class.send("post", @host_url+@connect_service, :body => body.to_json, :headers => {"Authorization" => "Bearer " + }) return response end |
#get_social_login_uri(provider) ⇒ Object
Method to return end point URI for specific social login
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 117 def (provider) case provider when "facebook" FACEBOOK_LOGIN_URI when "google_oauth2" GOOGLE_LOGIN_URI when "twitter" TWITER_LOGIN_URI when "github" GITHUB_LOGIN_URI when "linkedin" LINKEDIN_LOGIN_URI when "instagram" INSTAGRAM_LOGIN_URI else INVALID_SOCIAL_URI end end |
#getMemberDetails(authorization, uuid) ⇒ Object
103 104 105 106 107 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 103 def getMemberDetails(, uuid) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? response = self.class.send("get", @host_url+@profileUrl+"/#{uuid}", :headers => {"Authorization" => "Bearer " + }) return response end |
#getToken(clientId, clientSecret, grantType, scope = nil) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 45 def getToken(clientId, clientSecret, grantType, scope = nil) scope = scope.nil? ? [] : scope body = {:client_id => clientId, :client_secret => clientSecret, :grant_type => grantType, :scope => scope} @host_url = "http://api.qa1.nbos.io" if @host_url.nil? response = self.class.send("post", @host_url+@tokenUrl, :body => body, :headers => {"Accept" => "application/json"}) return response end |
#login(authorization, loginModel) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 56 def login(, loginModel) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? body = loginModel.to_s response = self.class.send("post", @host_url+@loginUrl, :body => body, :headers => {"Authorization" => "Bearer " + }) return response end |
#logout(authorization) ⇒ Object
97 98 99 100 101 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 97 def logout() @host_url = "http://api.qa1.nbos.io" if @host_url.nil? #response= HTTParty.post(@host_url+@loginUrl,{:body => body, :headers => { "Authorization" => "Bearer #{authorization}"}}) response = self.class.send("get", @host_url+@logoutUrl, :headers => {"Authorization" => "Bearer " + }) return response end |
#refreshAccessToken ⇒ Object
53 54 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 53 def refreshAccessToken end |
#resetCredentials ⇒ Object
70 71 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 70 def resetCredentials end |
#signup(authorization, memberSignupModel) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 63 def signup(, memberSignupModel) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? body = memberSignupModel.to_s response = self.class.send("post", @host_url+@signupUrl, :body => body, :headers => {"Authorization" => "Bearer " + }) return response end |
#socialWebViewLogin ⇒ Object
80 81 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 80 def end |
#tokenVerify(authorization, tokenToVerify, module_key) ⇒ Object
136 137 138 139 140 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 136 def tokenVerify(, tokenToVerify, module_key) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? response = self.class.send("get", @host_url+@tokenVerifyUrl+"/#{tokenToVerify}", :headers => {"Authorization" => "Bearer " + , "X-N-ModuleKey" => module_key}) return response end |
#updateCredentials(authorization, updatePasswordApiModel) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 73 def updateCredentials(,updatePasswordApiModel) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? body = updatePasswordApiModel.to_s response = self.class.send("post", @host_url+@changeUrl, :body => body, :headers => {"Authorization" => "Bearer " + }) return response end |
#updateMemberDetails(authorization, uuid, memberApiModel) ⇒ Object
109 110 111 112 113 114 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb', line 109 def updateMemberDetails(, uuid, memberApiModel) @host_url = "http://api.qa1.nbos.io" if @host_url.nil? body = memberApiModel.to_s response = self.class.send("put", @host_url+@profileUrl+"/#{uuid}", :body => body, :headers => {"Authorization" => "Bearer " + }) return response end |