Class: Mushikago::Mitsubachi::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/mushikago/mitsubachi/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, project_name, resource_name) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
13
# File 'lib/mushikago/mitsubachi/resource.rb', line 9

def initialize client, project_name, resource_name
  @client = client
  @project_name = project_name
  @resource_name = resource_name
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/mushikago/mitsubachi/resource.rb', line 5

def client
  @client
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



6
7
8
# File 'lib/mushikago/mitsubachi/resource.rb', line 6

def project_name
  @project_name
end

#resource_nameObject (readonly)

Returns the value of attribute resource_name.



7
8
9
# File 'lib/mushikago/mitsubachi/resource.rb', line 7

def resource_name
  @resource_name
end

Instance Method Details

#bodyObject



15
16
17
# File 'lib/mushikago/mitsubachi/resource.rb', line 15

def body
  client.resource_get(project_name, resource_name, :with_body => true)['body']
end

#push(url, script_name, file_key, options = {}) ⇒ Object



19
20
21
# File 'lib/mushikago/mitsubachi/resource.rb', line 19

def push url, script_name, file_key, options={}
  client.http_push(project_name, url, script_name, resource_name, file_key, options)
end

#to_sObject



23
24
25
# File 'lib/mushikago/mitsubachi/resource.rb', line 23

def to_s
  "#{project_name}:#{resource_name}"
end