Class: Mushikago::Mitsubachi::Resources

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, project_name) ⇒ Resources

Returns a new instance of Resources.



8
9
10
11
# File 'lib/mushikago/mitsubachi/resources.rb', line 8

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

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



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

def project_name
  @project_name
end

Instance Method Details

#[](resource_name) ⇒ Object



13
14
15
# File 'lib/mushikago/mitsubachi/resources.rb', line 13

def [] resource_name
  Mitsubachi::Resource.new(client, project_name, resource_name)
end

#eachObject



25
26
27
# File 'lib/mushikago/mitsubachi/resources.rb', line 25

def each
  list.each
end

#list(options = {}) ⇒ Object



21
22
23
# File 'lib/mushikago/mitsubachi/resources.rb', line 21

def list options={}
  client.resource_list(project_name, options)['files'].map{|p| self[p['name']]}
end

#store(resource_file, options = {}) ⇒ Object



17
18
19
# File 'lib/mushikago/mitsubachi/resources.rb', line 17

def store resource_file, options={}
  client.resource_store(project_name, resource_file, options)
end