class Forecast::Base
Attributes
credentials[R]
request[R]
Public Class Methods
new(ops={})
click to toggle source
@see Forecast.client
@see Forecast.hardy_client
def initialize({forecast_api_id: nil, access_token: nil})
# File lib/forecast/base.rb, line 8 def initialize(ops={}) @credentials = if ops[:forecast_account_id] and ops[:access_token] # # httparty stops the party (haha) if the access_token is not a String # string_ops = { forecast_account_id: ops[:forecast_account_id].to_s, access_token: ops[:access_token], } OAuthCredentials.new(string_ops) else fail 'You must provide either :forecast_account_id and :access_token' end end
Public Instance Methods
aggregates()
click to toggle source
def milestones
@milestones ||= Forecast::API::Milestones.new(credentials)
end
# File lib/forecast/base.rb, line 107 def aggregates @aggregates ||= Forecast::API::Aggregates.new(credentials) end
assignments()
click to toggle source
All API
Actions surrounding Assignments
Examples¶ ↑
forecast.projects.all() # Returns all projects in the system forecast.projects.all({start_date: '2016-11-28', end_date: '2017-01-01', state: 'active'}) forecast.projects.find(100) # Returns the project with id = 100
@see Forecast::Behavior::Crud
@return [Forecast::API::Projects]
# File lib/forecast/base.rb, line 99 def assignments @assignments ||= Forecast::API::Assignments.new(credentials) end
projects()
click to toggle source
All API
Actions surrounding Projects
Examples¶ ↑
forecast.projects.all() # Returns all projects in the system harvest.projects.find(100) # Returns the project with id = 100 project = Harvest::Project.new(:name => 'SuprGlu' :client_id => 10) saved_project = harvest.projects.create(project) # returns a saved version of Harvest::Project project = harvest.projects.find(205) project.name = 'SuprSticky' updated_project = harvest.projects.update(project) # returns an updated version of Harvest::Project project = harvest.project.find(205) harvest.projects.delete(project) # returns 205 project = harvest.projects.find(301) deactivated_project = harvest.projects.deactivate(project) # returns an updated deactivated project activated_project = harvest.projects.activate(project) # returns an updated activated project project = harvest.projects.find(401) harvest.projects.create_task(project, 'Bottling Glue') # creates and assigns a task to the project
@see Harvest::Behavior::Crud @see Harvest::Behavior::Activatable @return [Harvest::API::Projects]
# File lib/forecast/base.rb, line 84 def projects @projects ||= Forecast::API::Projects.new(credentials) end