Module: Mite

Defined in:
lib/mite-rb.rb,
lib/mite/version.rb

Overview

The official ruby library for interacting with the RESTful API of mite, a sleek time tracking webapp.

Defined Under Namespace

Modules: ResourceWithActiveArchived, ResourceWithoutWriteAccess Classes: Account, Base, Customer, MethodNotAvaible, Myself, Project, Service, SingletonBase, TimeEntry, TimeEntryGroup, Tracker, User

Constant Summary collapse

VERSION =
"0.5.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.accountObject

Returns the value of attribute account.



13
14
15
# File 'lib/mite-rb.rb', line 13

def 
  @account
end

.domain_formatObject

Returns the value of attribute domain_format.



12
13
14
# File 'lib/mite-rb.rb', line 12

def domain_format
  @domain_format
end

.emailObject

Returns the value of attribute email.



12
13
14
# File 'lib/mite-rb.rb', line 12

def email
  @email
end

.host_formatObject

Returns the value of attribute host_format.



12
13
14
# File 'lib/mite-rb.rb', line 12

def host_format
  @host_format
end

.keyObject

Returns the value of attribute key.



13
14
15
# File 'lib/mite-rb.rb', line 13

def key
  @key
end

.passwordObject

Returns the value of attribute password.



12
13
14
# File 'lib/mite-rb.rb', line 12

def password
  @password
end

.portObject

Returns the value of attribute port.



12
13
14
# File 'lib/mite-rb.rb', line 12

def port
  @port
end

.protocolObject

Returns the value of attribute protocol.



13
14
15
# File 'lib/mite-rb.rb', line 13

def protocol
  @protocol
end

.user_agentObject

Returns the value of attribute user_agent.



13
14
15
# File 'lib/mite-rb.rb', line 13

def user_agent
  @user_agent
end

Class Method Details

.authenticate(user, password) ⇒ Object

Sets up basic authentication credentials for all resources.



24
25
26
27
28
29
30
31
32
# File 'lib/mite-rb.rb', line 24

def authenticate(user, password)
  resources.each do |klass|
    klass.user = user
    klass.password = password
  end
  @user     = user
  @password = password
  true
end

.resourcesObject



54
55
56
# File 'lib/mite-rb.rb', line 54

def resources
  @resources ||= []
end

.validateObject

Validates connection returns true when valid false when not



60
61
62
# File 'lib/mite-rb.rb', line 60

def validate
  validate! rescue false
end

.validate!Object

Same as validate_connection but raises http-error when connection is invalid



66
67
68
# File 'lib/mite-rb.rb', line 66

def validate!
  !!Mite::Account.find
end

.versionObject



70
71
72
# File 'lib/mite-rb.rb', line 70

def version
  Mite::VERSION
end