Class: Yade::Common::Model::Authentication

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Serializers::JSON, ActiveModel::Validations
Defined in:
lib/yade/common/model/authentication.rb

Overview

authentication

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def access_token
  @access_token
end

#auth_passwordObject

Returns the value of attribute auth_password.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def auth_password
  @auth_password
end

#auth_urlObject

Returns the value of attribute auth_url.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def auth_url
  @auth_url
end

#auth_usernameObject

Returns the value of attribute auth_username.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def auth_username
  @auth_username
end

#expiration_timeObject

Returns the value of attribute expiration_time.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def expiration_time
  @expiration_time
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



15
16
17
# File 'lib/yade/common/model/authentication.rb', line 15

def refresh_token
  @refresh_token
end

Instance Method Details

#attributesObject



21
22
23
# File 'lib/yade/common/model/authentication.rb', line 21

def attributes
  instance_values
end

#readObject

read



35
36
37
# File 'lib/yade/common/model/authentication.rb', line 35

def read
  from_json(File.read("#{ENV['HOME']}/.yade/authentication.json"))
end

#writeObject

write



26
27
28
29
30
31
32
# File 'lib/yade/common/model/authentication.rb', line 26

def write
  json = as_json.to_json

  File.open("#{ENV['HOME']}/.yade/authentication.json", 'w') do |f|
    f.write(json)
  end
end