Class: Mediaflux::AssetCreateRequest

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

Direct Known Subclasses

ProjectCreateRequest

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:, namespace: nil, name:, xml_namespace: nil, xml_namespace_uri: nil, pid: nil) ⇒ AssetCreateRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • name (String)

    Name of the Asset

  • namespace (String) (defaults to: nil)

    Optional Parent namespace for the asset to be created in

  • pid (String) (defaults to: nil)

    Optional Parent collection id (use this or a namespace not both)

  • xml_namespace (String) (defaults to: nil)


12
13
14
15
16
17
18
19
# File 'app/models/mediaflux/asset_create_request.rb', line 12

def initialize(session_token:, namespace: nil, name:, xml_namespace: nil, xml_namespace_uri: nil, pid: nil)
  super(session_token: session_token)
  @namespace = namespace
  @asset_name = name
  @xml_namespace = xml_namespace || self.class.default_xml_namespace
  @xml_namespace_uri = xml_namespace_uri || self.class.default_xml_namespace_uri
  @pid = pid
end

Instance Attribute Details

#asset_nameObject (readonly)

Returns the value of attribute asset_name.



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

def asset_name
  @asset_name
end

#collectionObject (readonly)

Returns the value of attribute collection.



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

def collection
  @collection
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use when creating assets

Returns:

  • (String)


23
24
25
# File 'app/models/mediaflux/asset_create_request.rb', line 23

def self.service
  "asset.create"
end

Instance Method Details

#idObject



27
28
29
30
# File 'app/models/mediaflux/asset_create_request.rb', line 27

def id
  @id ||= response_xml.xpath("/response/reply/result/id").text
  @id
end