Class: Mediaflux::StoreListRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/store_list_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:) ⇒ StoreListRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • name (String)

    Name of the Asset

  • collection (Boolean)

    create a collection asset if true

  • namespace (String)

    Optional Parent namespace for the asset to be created in

  • pid (Integer)

    Optional Parent id for the asset to be created in



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

def initialize(session_token:)
  super(session_token: session_token)
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use when creating assets

Returns:

  • (String)


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

def self.service
  "asset.store.list"
end

Instance Method Details

#storesObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/mediaflux/store_list_request.rb', line 20

def stores
  @stores ||= begin
                xml = response_xml
                xml.xpath("/response/reply/result/store").map do |node|
                  {
                    id: node.xpath("@id").text,
                    type: node.xpath("./type").text,
                    name: node.xpath("./name").text,
                    tag: node.xpath("./tag").text
                  }
                end
              end
end