Class: Mediaflux::SchemaFetchRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/schema_fetch_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(namespace:, type:, session_token:) ⇒ SchemaFetchRequest

Returns a new instance of SchemaFetchRequest.



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

def initialize(namespace:, type:, session_token:)
  super(session_token: session_token)
  @namespace = namespace
  @type = type
end

Class Method Details

.serviceObject



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

def self.service
  "asset.doc.type.describe"
end

Instance Method Details

#fieldsObject



14
15
16
17
# File 'app/models/mediaflux/schema_fetch_request.rb', line 14

def fields
  elements = response_xml.xpath("/response/reply/result/type/definition/element")
  elements.map { |element| field_from_element(element) }
end