Class: Openplacos::Connection_auth_code
- Inherits:
-
Object
- Object
- Openplacos::Connection_auth_code
- Includes:
- Connection
- Defined in:
- lib/openplacos/libclient.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(url_, name_, scope_, id_, port_) ⇒ Connection_auth_code
constructor
Open a connection to openplacos server Please give: * opos url * an application name that identify the client oath2 talking * a scope, typically [“read”, “write”, “user”] * an optionnal id, to manage several clients * port of openplacos server.
Methods included from Connection
#create_client, #get_grant_url, #load_config, #recreate_token, #register, #save_config
Constructor Details
#initialize(url_, name_, scope_, id_, port_) ⇒ Connection_auth_code
Open a connection to openplacos server Please give:
-
opos url
-
an application name that identify the client oath2 talking
-
a scope, typically [“read”, “write”, “user”]
-
an optionnal id, to manage several clients
-
port of openplacos server
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/openplacos/libclient.rb', line 182 def initialize(url_, name_, scope_, id_, port_) @url = url_ @name = name_ @scope = scope_ @redirect_uri = "http://0.0.0.0:#{port_}" @port = port_ dir_config = "#{ENV['HOME']}/.openplacos" if !Dir.exists?(dir_config) Dir.mkdir(dir_config) end # config saved to avoir re-grant at each connection @file_config = "#{dir_config}/#{@name}-#{id_}.yaml" load_config if @token_params[@url].nil? #get token -- first time register create_client grant get_token save_config else # persistant mode create_client recreate_token end end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
173 174 175 |
# File 'lib/openplacos/libclient.rb', line 173 def token @token end |