Class: ArchivesSpaceOAIServer
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- ArchivesSpaceOAIServer
- Defined in:
- oai/app/main.rb
Constant Summary collapse
- TIMEOUT =
600
Instance Method Summary collapse
Instance Method Details
#build_oai_url ⇒ Object
52 53 54 |
# File 'oai/app/main.rb', line 52 def build_oai_url URI.join(AppConfig[:backend_url], 'oai') end |
#prepare_headers(headers) ⇒ Object
56 57 58 59 60 |
# File 'oai/app/main.rb', line 56 def prepare_headers(headers) Hash[headers.map {|header, values| [header, values.join(' ')] }] end |
#send_get(query_string) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'oai/app/main.rb', line 40 def send_get(query_string) oai_url = build_oai_url oai_url.query = query_string ASHTTP.start_uri(oai_url, :open_timeout => TIMEOUT, :read_timeout => TIMEOUT) do |http| http_request = Net::HTTP::Get.new(oai_url.request_uri) response = http.request(http_request) [Integer(response.code), prepare_headers(response.to_hash), response.body] end end |