Class: GatherContent::Api::Templates

Inherits:
Base
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gather_content/api/templates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#fetch, #get, #post, #post_json, #reset

Constructor Details

#initialize(project_id) ⇒ Templates

Returns a new instance of Templates.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/gather_content/api/templates.rb', line 7

def initialize(project_id)
  raise ArgumentError, "project_id is required!" if project_id.nil?
  @project_id = project_id
end

Instance Attribute Details

#project_idObject

Returns the value of attribute project_id.



4
5
6
# File 'lib/gather_content/api/templates.rb', line 4

def project_id
  @project_id
end

Instance Method Details

#each(&block) ⇒ Object



12
13
14
15
16
# File 'lib/gather_content/api/templates.rb', line 12

def each(&block)
  fetch.each do |template|
    yield GatherContent::Api::Template.new(template['id'], template)
  end
end