class Authentication
Attributes
client_id[RW]
client_secret[RW]
grant_type[RW]
password[RW]
refresh_token[RW]
token[RW]
username[RW]
Public Class Methods
get_payload(auth_data)
click to toggle source
# File lib/domain/authentication.rb, line 43 def self.get_payload(auth_data) return auth_data.to_json end
json_create(o)
click to toggle source
# File lib/domain/authentication.rb, line 31 def self.json_create(o) b_from_json = new b_from_json.grant_type = o['grant_type'] b_from_json.client_id = o['client_id'] b_from_json.client_secret = o['client_secret'] b_from_json.username = o['username'] b_from_json.password = o['password'] b_from_json.token = o['token'] b_from_json.refresh_token = o['refresh_token'] b_from_json end
new(grant_type: nil, client_id: nil, client_secret: nil, username: nil, password: nil, token:nil, refresh_token:nil)
click to toggle source
# File lib/domain/authentication.rb, line 11 def initialize grant_type: nil, client_id: nil, client_secret: nil, username: nil, password: nil, token:nil, refresh_token:nil self.grant_type, self.client_id, self.client_secret, self.username, self.password, self.token, self.refresh_token = grant_type, client_id, client_secret, username, password, token, refresh_token end
Public Instance Methods
to_json(*a)
click to toggle source
# File lib/domain/authentication.rb, line 17 def to_json(*a) hash = { grant_type: @grant_type, client_id: @client_id, client_secret: @client_secret, username: @username, password: @password, token: @token, refresh_token: @refresh_token } hash.delete_if { |k, v| v.nil? || v.empty? } hash.to_json(*a) end