Class: Aliyun::Odps::Projects

Inherits:
ServiceObject show all
Defined in:
lib/aliyun/odps/model/projects.rb

Overview

Methods for Projects

Instance Attribute Summary

Attributes inherited from ServiceObject

#master

Instance Method Summary collapse

Methods inherited from ServiceObject

build, #client, #initialize, #project, service_pool

Constructor Details

This class inherits a constructor from Aliyun::Odps::ServiceObject

Instance Method Details

#get(name) ⇒ Project

Get Project Information

Parameters:

  • name

    specify the project name

Returns:

See Also:

[View source]

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

#list(options = {}) ⇒ List

Parameters:

  • options (Hash) (defaults to: {})

    options

Options Hash (options):

  • :owner (String)

    specify the project owner

  • :marker (String)

    specify marker for paginate

  • :maxitems (String) — default: 1000

    specify maxitems in this request

Returns:

See Also:

[View source]

17
18
19
20
21
22
23
24
25
26
# File 'lib/aliyun/odps/model/projects.rb', line 17

def list(options = {})
  Utils.stringify_keys!(options)
  query = Utils.hash_slice(options, '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

#update(name, options = {}) ⇒ Object

Update Project Information

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :comment (String)

    Comment of the project

Returns:

  • true

See Also:

[View source]

50
51
52
53
54
55
56
57
58
# File 'lib/aliyun/odps/model/projects.rb', line 50

def update(name, options = {})
  Utils.stringify_keys!(options)
  project = Project.new(
    name: name,
    comment: options['comment'],
    client: client
  )
  !!client.put("/projects/#{name}", body: build_update_body(project))
end