Class: Zcloudjp::Metadata
- Inherits:
-
Object
- Object
- Zcloudjp::Metadata
- Includes:
- Utils
- Defined in:
- lib/zcloudjp/metadata.rb
Instance Attribute Summary collapse
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
-
#create(params = {}) ⇒ Object
PUT /machines/:id/metadata.:format.
-
#delete(params = {}) ⇒ Object
DELETE /machines/:id/metadata/:key.:format.
-
#index ⇒ Object
(also: #list)
GET /machines/:id/metadata.:format.
-
#initialize(machine) ⇒ Metadata
constructor
TODO Should be hybrid: executable when a machine object is given or not.
-
#show(params = {}) ⇒ Object
(also: #find_by)
GET /machines/:id/metadata/:key.:format.
-
#update(params = {}) ⇒ Object
PUT /machines/:id/metadata/:key.:format.
Methods included from Utils
Constructor Details
#initialize(machine) ⇒ Metadata
TODO Should be hybrid: executable when a machine object is given or not.
13 14 15 |
# File 'lib/zcloudjp/metadata.rb', line 13 def initialize(machine) @machine = machine end |
Instance Attribute Details
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
8 9 10 |
# File 'lib/zcloudjp/metadata.rb', line 8 def machine @machine end |
Instance Method Details
#create(params = {}) ⇒ Object
PUT /machines/:id/metadata.:format
31 32 33 34 35 |
# File 'lib/zcloudjp/metadata.rb', line 31 def create(params={}) key = params.delete(:key) machine. = machine..merge(body: parse_params(params, :metadata).to_json) Zcloudjp::Client.put("/machines/#{machine.id}/metadata/#{key}", machine.) end |
#delete(params = {}) ⇒ Object
DELETE /machines/:id/metadata/:key.:format
44 45 46 47 |
# File 'lib/zcloudjp/metadata.rb', line 44 def delete(params={}) key = params.delete(:key) Zcloudjp::Client.delete("/machines/#{machine.id}/metadata/#{key}", machine.) end |
#index ⇒ Object Also known as: list
GET /machines/:id/metadata.:format
18 19 20 |
# File 'lib/zcloudjp/metadata.rb', line 18 def index Zcloudjp::Client.get("/machines/#{machine.id}/metadata", machine.) end |