class IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityRemoteApi

Constants

FACEBOOK_LOGIN_URI

Api Server Social Authentication End Point URIs

GITHUB_LOGIN_URI
GOOGLE_LOGIN_URI
INSTAGRAM_LOGIN_URI
INVALID_SOCIAL_URI
LINKEDIN_LOGIN_URI
TWITER_LOGIN_URI

Attributes

authorizeUrl[RW]
baseIdentityUrl[RW]
changeUrl[RW]
connectUrl[RW]
forgotUrl[RW]
host_url[RW]
loginUrl[RW]
logoutUrl[RW]
profileUrl[RW]
signupUrl[RW]
socialLoginUrl[RW]
tokenUrl[RW]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

authorize() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 83
def authorize
end
connect(authorization, oauth_details, connectService, clientId) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 86
def connect(authorization, oauth_details, connectService, clientId)
        @host_url = "http://api.qa1.nbos.io" if @host_url.nil?
        @connect_service = get_social_login_uri(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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end
getMemberDetails(authorization, uuid) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 103
def getMemberDetails(authorization, uuid)
        @host_url = "http://api.qa1.nbos.io" if @host_url.nil?
        response = self.class.send("get", @host_url+@profileUrl+"/#{uuid}", :headers => {"Authorization" => "Bearer " + authorization, 'Content-Type' => 'application/json'})
        return response
end
getToken(clientId, clientSecret, grantType, scope = nil) click to toggle source
# 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 => {'Content-Type' => 'application/x-www-form-urlencoded'})
        return response
end
get_social_login_uri(provider) click to toggle source

Method to return end point URI for specific social login

# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 117
def get_social_login_uri(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
login(authorization, loginModel) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 56
def login(authorization, 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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end
logout(authorization) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 97
def logout(authorization)
        @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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end
refreshAccessToken() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 53
def refreshAccessToken
end
resetCredentials() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 70
def resetCredentials
end
signup(authorization, memberSignupModel) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 63
def signup(authorization, 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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end
socialWebViewLogin() click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 80
def socialWebViewLogin
end
tokenVerify(authorization, tokenToVerify, module_key) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 136
def tokenVerify(authorization, 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 " + authorization, "X-N-ModuleKey" => module_key, 'Content-Type' => 'application/json'})
        return response
end
updateCredentials(authorization,updatePasswordApiModel) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 73
def updateCredentials(authorization,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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end
updateMemberDetails(authorization, uuid, memberApiModel) click to toggle source
# File lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb, line 109
def updateMemberDetails(authorization, 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 " + authorization, 'Content-Type' => 'application/json'})
        return response
end