class Openplacos::Connection_password
Attributes
token[R]
Public Class Methods
new(url_, name_, scope_, id_, port_, username_, password_)
click to toggle source
# File lib/openplacos/libclient.rb, line 127 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
Private Instance Methods
get_token()
click to toggle source
# File lib/openplacos/libclient.rb, line 159 def get_token begin @token = @client.password.get_token(@username, @password, {:redirect_uri => @redirect_uri},{:mode=>:header, :header_format=>"OAuth %s", :param_name=>"oauth_token"}) rescue => e puts e retry end end