Module: TaskMapper::Provider::Bcx

Includes:
Base
Defined in:
lib/provider/version.rb,
lib/provider/api/auth.rb,
lib/provider/api/todos.rb,
lib/provider/api/comments.rb,
lib/provider/api/projects.rb,
lib/provider/project.rb,
lib/provider/comment.rb,
lib/provider/ticket.rb,
lib/provider/bcx.rb,
lib/provider/api.rb

Defined Under Namespace

Classes: API, Comment, Project, Ticket

Constant Summary collapse

VERSION =
"0.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.account_idObject

Returns the value of attribute account_id.



6
7
8
# File 'lib/provider/bcx.rb', line 6

def 
  @account_id
end

.apiObject

Returns the value of attribute api.



6
7
8
# File 'lib/provider/bcx.rb', line 6

def api
  @api
end

.passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/provider/bcx.rb', line 6

def password
  @password
end

.usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/provider/bcx.rb', line 6

def username
  @username
end

Class Method Details

.new(auth = {}) ⇒ Object



8
9
10
# File 'lib/provider/bcx.rb', line 8

def new(auth = {})
  TaskMapper.new(:bcx, auth)
end

Instance Method Details

#authorize(auth = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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. = auth[:account_id]
  configure auth
end

#configure(auth) ⇒ Object



36
37
38
# File 'lib/provider/bcx.rb', line 36

def configure(auth)
  provider.api = API.new auth[:account_id], auth[:username], auth[:password]
end

#providerObject



13
14
15
# File 'lib/provider/bcx.rb', line 13

def provider
  TaskMapper::Provider::Bcx
end

#valid?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/provider/bcx.rb', line 40

def valid?
  provider.api.authenticated?
end