Class: Mediaflux::ScriptUploadRequest

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

Instance Attribute Summary

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:, name:, url:, session_user: nil) ⇒ ScriptUploadRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • namespace (String)

    namespace where the script will be saved

  • name (String)

    name of the script

  • url (String)

    URL where the content of the script will be fetched from



9
10
11
12
13
14
# File 'app/models/mediaflux/script_upload_request.rb', line 9

def initialize(session_token:, namespace:, name:, url:, session_user: nil)
  super(session_token: session_token, session_user: session_user)
  @namespace = namespace
  @name = name
  @url = url
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use

Returns:

  • (String)


18
19
20
# File 'app/models/mediaflux/script_upload_request.rb', line 18

def self.service
  "asset.create"
end

Instance Method Details

#resultObject

Returns the id of the asset created



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

def result
  response_xml.xpath("/response/reply/result/id").text.to_i
end