Class: Asana::Resources::OrganizationExport

Inherits:
Resource
  • Object
show all
Defined in:
lib/asana/resources/organization_export.rb

Overview

An organization_export object represents a request to export the complete data of an Organization in JSON format.

To export an Organization using this API:

  • Create an ‘organization_export` [request](#create) and store the id that is returned.\

  • Request the ‘organization_export` every few minutes, until the `state` field contains ’finished’.\

  • Download the file located at the URL in the ‘download_url` field.

Exports can take a long time, from several minutes to a few hours for large Organizations.

Note: These endpoints are only available to [Service Accounts](/guide/help/premium/service-accounts) of an [Enterprise](/enterprise) Organization.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Resource

inherited, #initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s

Methods included from ResponseHelper

#parse

Constructor Details

This class inherits a constructor from Asana::Resources::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource

Instance Attribute Details

#created_atObject (readonly)



24
25
26
# File 'lib/asana/resources/organization_export.rb', line 24

def created_at
  @created_at
end

#download_urlObject (readonly)



26
27
28
# File 'lib/asana/resources/organization_export.rb', line 26

def download_url
  @download_url
end

#idObject (readonly)



22
23
24
# File 'lib/asana/resources/organization_export.rb', line 22

def id
  @id
end

#organizationObject (readonly)



30
31
32
# File 'lib/asana/resources/organization_export.rb', line 30

def organization
  @organization
end

#stateObject (readonly)



28
29
30
# File 'lib/asana/resources/organization_export.rb', line 28

def state
  @state
end

Class Method Details

.create(client, organization: required("organization"), options: {}, **data) ⇒ Object

This method creates a request to export an Organization. Asana will complete the export at some point after you create the request.

Parameters:

  • organization (Id) (defaults to: required("organization"))

    Globally unique identifier for the workspace or organization.

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

    the request I/O options.

  • data (Hash)

    the attributes to post.



55
56
57
58
# File 'lib/asana/resources/organization_export.rb', line 55

def create(client, organization: required("organization"), options: {}, **data)
  with_params = data.merge(organization: organization).reject { |_,v| v.nil? || Array(v).empty? }
  Resource.new(parse(client.post("/organization_exports", body: with_params, options: options)).first, client: client)
end

.find_by_id(client, id, options: {}) ⇒ Object

Returns details of a previously-requested Organization export.

Parameters:

  • id (Id)

    Globally unique identifier for the Organization export.

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

    the request I/O options.



43
44
45
46
# File 'lib/asana/resources/organization_export.rb', line 43

def find_by_id(client, id, options: {})

  self.new(parse(client.get("/organization_exports/#{id}", options: options)).first, client: client)
end

.plural_nameObject

Returns the plural name of the resource.



34
35
36
# File 'lib/asana/resources/organization_export.rb', line 34

def plural_name
  'organization_exports'
end