Class: Openplacos::Connection_password

Inherits:
Object
  • Object
show all
Includes:
Connection
Defined in:
lib/openplacos/libclient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Connection

#create_client, #get_grant_url, #load_config, #recreate_token, #register, #save_config

Constructor Details

#initialize(url_, name_, scope_, id_, port_, username_, password_) ⇒ Connection_password

Returns a new instance of Connection_password.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/openplacos/libclient.rb', line 128

def initialize(url_, name_, scope_, id_, port_, username_, password_)
  @url          = url_
  @name         = name_
  @scope        = scope_
  @id           = id_
  @redirect_uri = "http://0.0.0.0:#{port_}"
  @port         = port_
  @username     = username_
  @password     = password_
  
  
  dir_config = "#{ENV['HOME']}/.openplacos"
  if !Dir.exists?(dir_config)
    Dir.mkdir(dir_config)
  end

  @file_config = "#{dir_config}/#{@name}-#{id_}.yaml"
  
  load_config
  if @token_params[@url].nil? #create -- first time
    register 
    create_client
    save_config
  else        # persistant mode
    create_client
  end
  get_token 

end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



127
128
129
# File 'lib/openplacos/libclient.rb', line 127

def token
  @token
end