Class: Ketchup::Project

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

Overview

Represents a project, which meetings can be grouped under.

Projects cannot be created manually - just create meetings with project names, and the corresponding projects will be created if they don’t already exist.

You can, however, change the name of a project.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, params = {}) ⇒ Project

Set up a new Project object - although there’s not much point calling this yourself, as it’s only useful when populating with data from the server.

Parameters:

  • api (Ketchup::API)

    An established API connection.

  • params (Hash) (defaults to: {})

    The project details



18
19
20
21
22
# File 'lib/ketchup/project.rb', line 18

def initialize(api, params = {})
  @api = api
  
  overwrite params
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/ketchup/project.rb', line 10

def created_at
  @created_at
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#shortcode_urlObject (readonly)

Returns the value of attribute shortcode_url.



10
11
12
# File 'lib/ketchup/project.rb', line 10

def shortcode_url
  @shortcode_url
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



10
11
12
# File 'lib/ketchup/project.rb', line 10

def updated_at
  @updated_at
end

Instance Method Details

#meetingsArray

Gets all the meetings tied to this particular project. This is not a special array, so it’s best to create new meetings for a given project via the profile’s meetings collection object instead.

Returns:

  • (Array)

    Meetings associated with this project.



36
37
38
39
40
41
# File 'lib/ketchup/project.rb', line 36

def meetings
  @meetings ||= @api.get("/projects/#{shortcode_url}/meetings.json").
    collect { |hash|
      Ketchup::Meeting.new @api, hash
    }
end

#saveObject

Saves any changes to the project’s name.



26
27
28
# File 'lib/ketchup/project.rb', line 26

def save
  overwrite @api.put("/projects/#{shortcode_url}.json", 'name' => name)
end