module TaskMapper::Provider::Bcx

Constants

VERSION

Attributes

account_id[RW]
api[RW]
password[RW]
username[RW]

Public Class Methods

new(auth = {}) click to toggle source
# File lib/provider/bcx.rb, line 8
def new(auth = {})
  TaskMapper.new(:bcx, auth)
end

Public Instance Methods

authorize(auth = {}) click to toggle source
# File lib/provider/bcx.rb, line 17
def authorize(auth = {})
  @authenticator ||= TaskMapper::Authenticator.new(auth)

  unless auth[:username] && auth[:password]
    message = "Please provide a username and password."
    raise TaskMapper::Exception.new message
  end

  unless auth[:account_id]
    message = "Please provide a Basecamp account_id"
    raise TaskMapper::Exception.new message
  end

  provider.username = auth[:username]
  provider.password = auth[:password]
  provider.account_id = auth[:account_id]
  configure auth
end
configure(auth) click to toggle source
# File lib/provider/bcx.rb, line 36
def configure(auth)
  provider.api = API.new auth[:account_id], auth[:username], auth[:password]
end
provider() click to toggle source
# File lib/provider/bcx.rb, line 13
def provider
  TaskMapper::Provider::Bcx
end
valid?() click to toggle source
# File lib/provider/bcx.rb, line 40
def valid?
  provider.api.authenticated?
end