Sha256: 4d8be2547568d0070dc88eb1e2878131a9d4097aac39ec0a4107e6dfdb3b389e
Contents?: true
Size: 621 Bytes
Versions: 8
Compression:
Stored size: 621 Bytes
Contents
module Medie module OpenSearch class Descriptor def use(content_type) uri = urls.find do |url| url["type"]==content_type end return nil if uri.nil? base_uri, params_pattern = extract_uri(uri) Restfulie.at(base_uri).accepts(content_type).open_search.with_pattern(params_pattern) end private def extract_uri(uri) uri = uri["template"] interrogation = uri.index("?") params = uri[interrogation+1..uri.size] base_uri = uri[0..interrogation-1] [base_uri, params] end end end end
Version data entries
8 entries across 8 versions & 2 rubygems