Class: Mediaflux::ProjectQuotaRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/project_quota_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#session_token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

build_post_request, default_xml_namespace, default_xml_namespace_uri, #error?, find_or_create_http_client, format_date_for_mediaflux, request_path, #resolve, #resolved?, #response_body, #response_error, #response_xml, uri, #xml_payload, #xtoshell_xml

Constructor Details

#initialize(session_token:, asset_id:) ⇒ ProjectQuotaRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • asset_id (Int)

    The Mediaflux asset ID for the project



9
10
11
12
# File 'app/models/mediaflux/project_quota_request.rb', line 9

def initialize(session_token:, asset_id:)
  super(session_token: session_token)
  @asset_id = asset_id
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



4
5
6
# File 'app/models/mediaflux/project_quota_request.rb', line 4

def document
  @document
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



4
5
6
# File 'app/models/mediaflux/project_quota_request.rb', line 4

def service_name
  @service_name
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'app/models/mediaflux/project_quota_request.rb', line 4

def token
  @token
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use

Returns:

  • (String)


16
17
18
# File 'app/models/mediaflux/project_quota_request.rb', line 16

def self.service
  "tigerdata.project.quota.get"
end

Instance Method Details

#quotaObject

Returns the quota information for collection in Mediaflux



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/mediaflux/project_quota_request.rb', line 21

def quota
  result = response_xml.xpath("response/reply/result")
  {
    quota_allocation: result.xpath("quota-allocation").text.to_i,
    quota_allocation_human: result.xpath("quota-allocation/@h").text,
    quota_used: result.xpath("quota-used").text.to_i,
    quota_used_human: result.xpath("quota-used/@h").text,
    project_files: result.xpath("project-files").text.to_i,
    project_files_human: result.xpath("project-files/@h").text,
    recycle_bin: result.xpath("recycle-bin").text.to_i,
    recycle_bin_human: result.xpath("recycle-bin/@h").text,
    old_versions: result.xpath("old-versions").text.to_i,
    old_versions_human: result.xpath("old-versions/@h").text
  }
end