Class: Mediaflux::ProjectListRequest
- Defined in:
 - app/models/mediaflux/project_list_request.rb
 
Instance Attribute Summary collapse
- 
  
    
      #action  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute action.
 - 
  
    
      #aql_query  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute aql_query.
 - 
  
    
      #collection  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute collection.
 - 
  
    
      #deep_search  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute deep_search.
 - 
  
    
      #iterator  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute iterator.
 - 
  
    
      #size  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute size.
 
Attributes inherited from Request
Class Method Summary collapse
- 
  
    
      .service  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Specifies the Mediaflux service to use when running a query.
 
Instance Method Summary collapse
- 
  
    
      #initialize(session_token:, aql_query: nil, action: "get-meta", deep_search: true)  ⇒ ProjectListRequest 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Constructor.
 - 
  
    
      #results  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the iterator that could be used to fetch the data.
 
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:, aql_query: nil, action: "get-meta", deep_search: true) ⇒ ProjectListRequest
Constructor
      14 15 16 17 18 19 20 21 22 23 24  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 14 def initialize(session_token:, aql_query: nil, action: "get-meta", deep_search: true) super(session_token: session_token) @aql_query = aql_query @collection = collection @action = action @deep_search = deep_search # For now we hard-code the size to infinity since only Administrators will fetch a large # number of projects and they should get them all. At some point in the future we might # want to implement pagination for this list but not now.. @size = "infinity" end  | 
  
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def action @action end  | 
  
#aql_query ⇒ Object (readonly)
Returns the value of attribute aql_query.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def aql_query @aql_query end  | 
  
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def collection @collection end  | 
  
#deep_search ⇒ Object (readonly)
Returns the value of attribute deep_search.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def deep_search @deep_search end  | 
  
#iterator ⇒ Object (readonly)
Returns the value of attribute iterator.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def iterator @iterator end  | 
  
#size ⇒ Object (readonly)
Returns the value of attribute size.
      4 5 6  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 4 def size @size end  | 
  
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use when running a query
      28 29 30  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 28 def self.service "asset.query" end  | 
  
Instance Method Details
#results ⇒ Object
Returns the iterator that could be used to fetch the data
      33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | 
    
      # File 'app/models/mediaflux/project_list_request.rb', line 33 def results xml = response_xml assets = xml.xpath("/response/reply/result/asset") assets.map do |asset| = asset.xpath("./meta//tigerdata:project", "tigerdata" => "tigerdata") { mediaflux_id: asset.xpath("@id").first.value, title: .xpath("./Title").text, description: .xpath("./Description").text, project_purpose: .xpath("./ProjectPurpose").text, data_sponsor: .xpath("./DataSponsor").text, data_manager: .xpath("./DataManager").text, data_users: data_users_from_string(.xpath("./DataUser").text), directory: .xpath("./ProjectDirectory").text } end end  |