Class: TeamworkScrapeClient::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/teamwork_scrape_client/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Project

Returns a new instance of Project.



5
6
7
# File 'lib/teamwork_scrape_client/project.rb', line 5

def initialize(attributes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/teamwork_scrape_client/project.rb', line 3

def attributes
  @attributes
end

Instance Method Details

#[](key) ⇒ Object



9
10
11
# File 'lib/teamwork_scrape_client/project.rb', line 9

def [](key)
  attributes[key]
end

#days_offsetObject

Returns the date offset needed when using this project as a template



18
19
20
# File 'lib/teamwork_scrape_client/project.rb', line 18

def days_offset
  (Date.today - start_date).to_i
end

#start_dateObject



13
14
15
# File 'lib/teamwork_scrape_client/project.rb', line 13

def start_date
  Date.parse(attributes['startDate'])
end