Class: ThePlatform::Identity

Inherits:
Object
  • Object
show all
Extended by:
Configuration
Includes:
HTTParty
Defined in:
lib/theplatform/identity.rb

Overview

Class to RESTfully interface with thePlatform’s Identity API

ThePlatform::Identity#

Instance Attribute Summary

Attributes included from Configuration

#_duration, #_idleTimeout, #form, #password, #schema, #token, #username

Class Method Summary collapse

Methods included from Configuration

configure, parameters, parameters?

Class Method Details

.count(options = {}) ⇒ Object

Return the number of tokens in an account.

ThePlatform::Identity.count(username:‘USERNAME’, password:‘PASSWORD’,schema:‘1.0’, form:‘(json|xml)’)



38
39
40
41
# File 'lib/theplatform/identity.rb', line 38

def count(options = {})
  base_uri IDENTITY
  get("/getTokenCount", query: extras.merge(options))
end

.invalidate!(tokens, options = {}) ⇒ Object

Invalidate a given Token

ThePlatform::Identity.invalidate!(token, schema:‘1.0’, form:‘(json|xml)’)



30
31
32
33
# File 'lib/theplatform/identity.rb', line 30

def invalidate!(tokens, options = {})
  base_uri IDENTITY
  get("/signOut?_token=#{tokens}", query: extras.merge(options))
end

.keysObject

Set the different available params to configure



13
14
15
# File 'lib/theplatform/identity.rb', line 13

def keys
  @keys ||= [:schema, :form, :username, :password, :_duration, :_idleTimeout]
end

.token(options = {}) ⇒ Object

Return ALL THE TOKEN!

ThePlatform::Identity.token(username:‘USERNAME’, password:‘PASSWORD’, schema:‘1.0’, form:‘(json|xml)’)

_duration: and _idleTimeout: are optional. Resorts to thePlatform defaults if not defined



22
23
24
25
# File 'lib/theplatform/identity.rb', line 22

def token(options = {})
  base_uri IDENTITY
  get("/signIn", query: extras.merge(options))
end