module Box
Constants
- API_URL
- ISO_8601_TEST
- UPLOAD_URL
- VERSION
Public Class Methods
client(config = {})
click to toggle source
# File lib/box.rb, line 20 def client(config = {}) # Accounts for both string and Symbol keyed hashes. # This is basically stringify_keys, just less efficient config = Hashie::Mash.new(config) # You can either pass in the config, or set it from the environment variables config = { access_token: config['access_token'] || ENV['BOX_ACCESS_TOKEN'], refresh_token: config['refresh_token'] || ENV['BOX_REFRESH_TOKEN'], client_id: config['client_id'] || ENV['BOX_CLIENT_ID'], client_secret: config['client_secret'] || ENV['BOX_CLIENT_SECRET'], username: config['username'] || ENV['BOX_USERNAME'], password: config['password'] || ENV['BOX_PASSWORD'] } # Box::Authorization.authorize client_id, client_secret session = create_session(config) Box::Client.new(session) end
create_session(config = {})
click to toggle source
memoize :client
# File lib/box.rb, line 41 def create_session(config = {}) Box::Session.new config end
log(message)
click to toggle source
# File lib/box.rb, line 45 def log(message) puts "[Box.com] #{message}".colorize(:color => :magenta, :background => :black) end