Sha256: a180ea650f488279f8a7d686ebb4a10c4d7d3bfa352a086a67345c50bccfe843

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module Sifterology
  
  class ProjectFactory < Resource
    
    def entity_base
      '/api/projects'
    end
    
    def find_all
      [].tap do |arr|
        get("#{ entity_base }/?all=true")['projects'].each do |project_attrs|
          arr << build(project_attrs)
        end
      end
    end
    
    def build(attributes)
      Project.new(session, self).tap do |p|
        p.attributes = attributes
      end
    end
    
    def new_from_url(url)
      Project.new(session, self).tap do |p|
        p.api_url = url
      end
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sifterology-0.1.1 lib/sifterology/factories/project_factory.rb