Class: Mushikago::Mitsubachi::Resources
- Inherits:
-
Object
- Object
- Mushikago::Mitsubachi::Resources
- Defined in:
- lib/mushikago/mitsubachi/resources.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
Instance Method Summary collapse
- #[](resource_name) ⇒ Object
- #each ⇒ Object
-
#initialize(client, project_name) ⇒ Resources
constructor
A new instance of Resources.
- #list(options = {}) ⇒ Object
- #store(resource_file, options = {}) ⇒ Object
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
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/mushikago/mitsubachi/resources.rb', line 5 def client @client end |
#project_name ⇒ Object (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 |
#each ⇒ Object
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 ={} client.resource_list(project_name, )['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, ={} client.resource_store(project_name, resource_file, ) end |