Class: Aliyun::Odps::Projects
- Inherits:
-
ServiceObject
- Object
- ServiceObject
- Aliyun::Odps::Projects
- Defined in:
- lib/aliyun/odps/model/projects.rb
Overview
Methods for Projects
Instance Attribute Summary
Attributes inherited from ServiceObject
Instance Method Summary collapse
-
#get(name) ⇒ Project
Get Project Information.
-
#list(options = {}) ⇒ List
List all projects.
-
#update(name, options = {}) ⇒ Object
Update Project Information.
Methods inherited from ServiceObject
build, #client, #initialize, #project, service_pool
Constructor Details
This class inherits a constructor from Aliyun::Odps::ServiceObject
Instance Method Details
permalink #get(name) ⇒ Project
Get Project Information
35 36 37 38 39 |
# File 'lib/aliyun/odps/model/projects.rb', line 35 def get(name) result = client.get("/projects/#{name}").parsed_response hash = Utils.dig_value(result, 'Project') Project.new(hash.merge(client: client)) end |
permalink #list(options = {}) ⇒ List
List all projects
TODO: git.oschina.net/newell_zlx/aliyun-odps-ruby-sdk/issues/2
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aliyun/odps/model/projects.rb', line 17 def list( = {}) Utils.stringify_keys!() query = Utils.hash_slice(, 'owner', 'marker', 'maxitems') resp = client.get('/projects', query: query) result = resp.parsed_response Aliyun::Odps::List.build(result, %w(Projects Project)) do |hash| Project.new(hash.merge(client: client)) end end |
permalink #update(name, options = {}) ⇒ Object
Update Project Information
50 51 52 53 54 55 56 57 58 |
# File 'lib/aliyun/odps/model/projects.rb', line 50 def update(name, = {}) Utils.stringify_keys!() project = Project.new( name: name, comment: ['comment'], client: client ) !!client.put("/projects/#{name}", body: build_update_body(project)) end |