Class: Todoist::Project
- Inherits:
-
Struct
- Object
- Struct
- Todoist::Project
- Includes:
- StructCleanup
- Defined in:
- lib/todoist/project.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#can_assign_tasks ⇒ Object
Returns the value of attribute can_assign_tasks.
-
#child_order ⇒ Object
(also: #order)
Returns the value of attribute child_order.
-
#color ⇒ Object
Returns the value of attribute color.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#creator_uid ⇒ Object
Returns the value of attribute creator_uid.
-
#default_order ⇒ Object
Returns the value of attribute default_order.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#inbox_project ⇒ Object
Returns the value of attribute inbox_project.
-
#is_archived ⇒ Object
Returns the value of attribute is_archived.
-
#is_collapsed ⇒ Object
Returns the value of attribute is_collapsed.
-
#is_deleted ⇒ Object
Returns the value of attribute is_deleted.
-
#is_favorite ⇒ Object
Returns the value of attribute is_favorite.
-
#is_frozen ⇒ Object
Returns the value of attribute is_frozen.
-
#is_shared ⇒ Object
Returns the value of attribute is_shared.
-
#jsw_ignored_keys ⇒ Object
Returns the value of attribute jsw_ignored_keys.
-
#name ⇒ Object
Returns the value of attribute name.
-
#p_num ⇒ Object
Returns the value of attribute p_num.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#public_access ⇒ Object
Returns the value of attribute public_access.
-
#role ⇒ Object
Returns the value of attribute role.
-
#root_name ⇒ Object
Returns the value of attribute root_name.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#view_style ⇒ Object
Returns the value of attribute view_style.
Instance Method Summary collapse
- #archived? ⇒ Boolean
- #collapsed ⇒ Object
- #deleted? ⇒ Boolean
- #favorite? ⇒ Boolean
- #frozen? ⇒ Boolean
- #get_root_name(args) ⇒ Object
- #inbox? ⇒ Boolean
-
#initialize(*arg_hashes) ⇒ Project
constructor
A new instance of Project.
- #inspect(short_view: true) ⇒ Object
- #rules(td_client) ⇒ Object
- #shared? ⇒ Boolean
- #url ⇒ Object
Methods included from StructCleanup
#fields_to_date_time, #ignore_undefined_keys, #properties_to_desc, #replace_keys
Constructor Details
#initialize(*arg_hashes) ⇒ Project
Returns a new instance of Project.
33 34 35 36 37 38 39 |
# File 'lib/todoist/project.rb', line 33 def initialize(*arg_hashes) args = arg_hashes.first fields_to_date_time(args, %w[created_at updated_at]) ignore_undefined_keys(args) get_root_name(args) super end |
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def access @access end |
#can_assign_tasks ⇒ Object
Returns the value of attribute can_assign_tasks
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def can_assign_tasks @can_assign_tasks end |
#child_order ⇒ Object Also known as: order
Returns the value of attribute child_order
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def child_order @child_order end |
#color ⇒ Object
Returns the value of attribute color
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def color @color end |
#created_at ⇒ Object
Returns the value of attribute created_at
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def created_at @created_at end |
#creator_uid ⇒ Object
Returns the value of attribute creator_uid
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def creator_uid @creator_uid end |
#default_order ⇒ Object
Returns the value of attribute default_order
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def default_order @default_order end |
#description ⇒ Object
Returns the value of attribute description
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def description @description end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def id @id end |
#inbox_project ⇒ Object
Returns the value of attribute inbox_project
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def inbox_project @inbox_project end |
#is_archived ⇒ Object
Returns the value of attribute is_archived
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_archived @is_archived end |
#is_collapsed ⇒ Object
Returns the value of attribute is_collapsed
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_collapsed @is_collapsed end |
#is_deleted ⇒ Object
Returns the value of attribute is_deleted
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_deleted @is_deleted end |
#is_favorite ⇒ Object
Returns the value of attribute is_favorite
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_favorite @is_favorite end |
#is_frozen ⇒ Object
Returns the value of attribute is_frozen
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_frozen @is_frozen end |
#is_shared ⇒ Object
Returns the value of attribute is_shared
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def is_shared @is_shared end |
#jsw_ignored_keys ⇒ Object
Returns the value of attribute jsw_ignored_keys
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def jsw_ignored_keys @jsw_ignored_keys end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def name @name end |
#p_num ⇒ Object
Returns the value of attribute p_num
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def p_num @p_num end |
#parent_id ⇒ Object
Returns the value of attribute parent_id
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def parent_id @parent_id end |
#public_access ⇒ Object
Returns the value of attribute public_access
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def public_access @public_access end |
#role ⇒ Object
Returns the value of attribute role
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def role @role end |
#root_name ⇒ Object
Returns the value of attribute root_name
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def root_name @root_name end |
#updated_at ⇒ Object
Returns the value of attribute updated_at
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def updated_at @updated_at end |
#view_style ⇒ Object
Returns the value of attribute view_style
2 3 4 |
# File 'lib/todoist/project.rb', line 2 def view_style @view_style end |
Instance Method Details
#archived? ⇒ Boolean
71 72 73 |
# File 'lib/todoist/project.rb', line 71 def archived? is_archived.present? end |
#collapsed ⇒ Object
75 76 77 |
# File 'lib/todoist/project.rb', line 75 def collapsed is_collapsed.present? end |
#deleted? ⇒ Boolean
79 80 81 |
# File 'lib/todoist/project.rb', line 79 def deleted? is_deleted.present? end |
#favorite? ⇒ Boolean
83 84 85 |
# File 'lib/todoist/project.rb', line 83 def favorite? is_favorite.present? end |
#frozen? ⇒ Boolean
87 88 89 |
# File 'lib/todoist/project.rb', line 87 def frozen? is_frozen.present? end |
#get_root_name(args) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/todoist/project.rb', line 41 def get_root_name(args) if (m = args["name"].match(/(?<root>.*?)\s*(?<num>\d)*\s*$/)) args[:root_name] = m[:root].downcase args[:p_num] = [m[:num].to_i, 1].max else args[:root_name] = args["name"] args[:p_num] = 1 end end |
#inbox? ⇒ Boolean
91 92 93 |
# File 'lib/todoist/project.rb', line 91 def inbox? inbox_project.present? end |
#inspect(short_view: true) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/todoist/project.rb', line 51 def inspect(short_view: true) if short_view {name: name, id: id, root_name: root_name, p_num: p_num} else super() end end |
#rules(td_client) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/todoist/project.rb', line 61 def rules(td_client) r = td_client.tasks.find { |t| t.project_id == id && t.content == "PROJECT RULES" } return if r.nil? begin JSON.parse(r.description) rescue nil end end |
#shared? ⇒ Boolean
95 96 97 |
# File 'lib/todoist/project.rb', line 95 def shared? is_shared.present? end |
#url ⇒ Object
99 100 101 |
# File 'lib/todoist/project.rb', line 99 def url "https://todoist.com/showProject?id=#{id}" end |