Class: Harvest::User
- Includes:
- HappyMapper
- Defined in:
- lib/harvest/user.rb
Overview
The model that contains information about a task
Fields
id
-
(READONLY) the id of the user
email
-
the email of the user
first_name
-
the first name for the user
last_name
-
the last name for the user
telephone
-
the telephone for the user
- +department
-
the department for the user
- password|password_confirmation
-
the password for the user (only used on create.)
has_access_to_all_future_projects
-
whether the user should be added to future projects by default
hourly_rate
-
what the default hourly rate for the user is
admin?
-
whether the user is an admin
contractor?
-
whether the user is a contractor
contractor?
-
whether the user is a contractor
timezone
-
the timezone for the user.
Instance Method Summary collapse
-
#timezone=(timezone) ⇒ Object
Sets the timezone for the user.
Methods inherited from BaseModel
#==, api_path, #attributes=, #initialize, #to_i, #to_xml
Constructor Details
This class inherits a constructor from Harvest::BaseModel
Instance Method Details
#timezone=(timezone) ⇒ Object
Sets the timezone for the user. This can be done in a variety of ways.
Examples
user.timezone = :cst # the easiest way. CST, EST, MST, and PST are supported
user.timezone = 'america/chicago' # a little more verbose
user.timezone = 'Central Time (US & Canada)' # the most explicit way
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/harvest/user.rb', line 50 def timezone=(timezone) tz = timezone.to_s.downcase case tz when 'cst', 'cdt' then self.timezone = 'america/chicago' when 'est', 'edt' then self.timezone = 'america/new_york' when 'mst', 'mdt' then self.timezone = 'america/denver' when 'pst', 'pdt' then self.timezone = 'america/los_angeles' else if Harvest::Timezones::MAPPING[tz] @timezone = Harvest::Timezones::MAPPING[tz] else @timezone = timezone end end end |