class SharefileConnect::Connection
Attributes
config[R]
token[R]
Public Class Methods
new(config)
click to toggle source
base_uri “#{ENV[‘API_ENDPOINT_DOMAIN’]}.sf-api.com”
# File lib/sharefile_connect/connection.rb, line 7 def initialize(config) @config = config # || SharefileConnect::Config.new(ENV['SHAREFILE_KEY'], ENV['SHAREFILE_SECRET'], ENV['SHAREFILE_USER_NAME'], ENV['SHAREFILE_USER_PASS'], ENV['API_ENDPOINT_DOMAIN']) response = HTTParty.post(authentication_uri, authentication_content) @token = JSON.parse response.body end
Public Instance Methods
authentication_content()
click to toggle source
# File lib/sharefile_connect/connection.rb, line 22 def authentication_content { :body => { "grant_type" => "password", "client_id" => config.sharefile_key, "client_secret" => config.sharefile_secret, "username" => config.sharefile_user, "password" => config.sharefile_user_pass }, :headers => { "Content-Type" => "application/x-www-form-urlencoded" } } end
authentication_uri()
click to toggle source
# File lib/sharefile_connect/connection.rb, line 17 def authentication_uri "https://#{hostname}/oauth/token" # "/oauth/token" end
hostname()
click to toggle source
# File lib/sharefile_connect/connection.rb, line 13 def hostname "#{config.domain}.sf-api.com" end