Class: Kinu::Resource

Inherits:
ResourceBase show all
Defined in:
lib/kinu/resource.rb

Instance Attribute Summary

Attributes inherited from ResourceBase

#id, #name

Instance Method Summary collapse

Methods inherited from ResourceBase

#initialize, #path, #uri

Constructor Details

This class inherits a constructor from Kinu::ResourceBase

Instance Method Details

#attach_from_sandbox(sandbox_id) ⇒ Object



20
21
22
# File 'lib/kinu/resource.rb', line 20

def attach_from_sandbox(sandbox_id)
  Sandbox.attach(@name, @id, sandbox_id)
end

#upload(file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/kinu/resource.rb', line 7

def upload(file)
  Kinu::HttpClient.multipart_post(
    Kinu.base_upload_uri,
    '/upload',
    {
      name: @name,
      id:   @id,
      image: Kinu::HttpClient::UploadFile.new(file),
    },
  )
  nil
end