Class: CloudAlign::Project

Inherits:
BaseEntity show all
Defined in:
lib/cloudalign/project.rb

Instance Attribute Summary collapse

Attributes inherited from BaseEntity

#created_at, #id, #updated_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseEntity

#initialize

Constructor Details

This class inherits a constructor from CloudAlign::BaseEntity

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/cloudalign/project.rb', line 3

def description
  @description
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/cloudalign/project.rb', line 3

def name
  @name
end

Class Method Details

.find(id) ⇒ Object



5
6
7
# File 'lib/cloudalign/project.rb', line 5

def self.find(id)
  Project.new(Client.get_json("/projects/#{id}"))
end

.find_allObject



9
10
11
12
13
# File 'lib/cloudalign/project.rb', line 9

def self.find_all
  Client.get_json("/projects").map do |row|
    Project.new(row)
  end
end

Instance Method Details

#membershipsObject



23
24
25
# File 'lib/cloudalign/project.rb', line 23

def memberships
  CloudAlign::Membership.find_memberships(id)
end

#upload_file(path) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cloudalign/project.rb', line 15

def upload_file(path)
  post_data = Client.get_json("/projects/#{@id}/upload_file")
  upload_url = post_data.delete("url")
  post_data[:file] = ::File.new(path, 'rb')

  Client.post_for_upload(upload_url, post_data)
end