Class: Logan::ProjectTemplate

Inherits:
Object
  • Object
show all
Includes:
HashConstructed
Defined in:
lib/logan/project_template.rb

Instance Attribute Summary collapse

Attributes included from HashConstructed

#attributes, #json_raw

Instance Method Summary collapse

Methods included from HashConstructed

#initialize

Instance Attribute Details

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/logan/project_template.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/logan/project_template.rb', line 8

def name
  @name
end

Instance Method Details

#create_project(name, description = nil) ⇒ Logan::Project

create a project based on this project template via Basecamp API

Parameters:

  • name (String)

    name for the new project

  • description (String) (defaults to: nil)

    description for the new project

Returns:



16
17
18
19
20
21
22
23
24
# File 'lib/logan/project_template.rb', line 16

def create_project( name, description = nil)
  post_params = {
    :body => {name: name, description: description}.to_json,
    :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
  }

  response = Logan::Client.post "/project_templates/#{@id}/projects.json", post_params
  Logan::Project.new response
end