Class: IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel

Inherits:
Modules::Identity::V0::BasicActiveModel show all
Defined in:
lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed_response = nil) ⇒ TokenApiModel

Returns a new instance of TokenApiModel.



6
7
8
9
10
11
12
13
14
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 6

def initialize(parsed_response = nil)
	if !parsed_response.nil?
		@access_token = parsed_response["access_token"]
		@token_type = parsed_response["token_type"]
		@expires_in = parsed_response["expires_in"]
		@scope = parsed_response["scope"]
		@refresh_token = parsed_response["refresh_token"]
	end
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def access_token
  @access_token
end

#expires_inObject

Returns the value of attribute expires_in.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def expires_in
  @expires_in
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def message
  @message
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def refresh_token
  @refresh_token
end

#scopeObject

Returns the value of attribute scope.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def scope
  @scope
end

#token_typeObject

Returns the value of attribute token_type.



4
5
6
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 4

def token_type
  @token_type
end

Instance Method Details

#add_errors(json_response) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 36

def add_errors(json_response)
	json_response["errors"].each do |e|
		property_name = e['propertyName']
		msg = e['message']
		self.errors[property_name] << msg
	end
end

#add_messages(json_response) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 44

def add_messages(json_response)
	if json_response["message"].present?
		@message = json_response["message"]
	elsif json_response["error"].present?
		@message = json_response["error"]
	end

end

#as_json(options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 53

def as_json(options={})
	{
			scope: @scope,
			expires_in: @expires_in,
			token_type: @token_type,
			refresh_token: @refresh_token,
			access_token: @access_token,
	}
end

#getAccess_tokenObject



32
33
34
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 32

def getAccess_token()
		return @access_token
end

#getExpires_inObject



16
17
18
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 16

def getExpires_in()
		return @expires_in
end

#getRefresh_tokenObject



28
29
30
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 28

def getRefresh_token()
		return @refresh_token
end

#getScopeObject



20
21
22
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 20

def getScope()
		return @scope;
end

#getToken_typeObject



24
25
26
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 24

def getToken_type()
		return @token_type
end

#to_json(*options) ⇒ Object



63
64
65
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 63

def to_json(*options)
	as_json(*options).to_json(*options)
end

#to_sObject



67
68
69
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb', line 67

def to_s
	to_json
end