Sha256: 0bcba57615989d9f8668e1cf9205821c68540f7f9faa7977c19382983904fcae
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
require "uri" require "net/http" require "delegate" require_relative "api" require_relative "response" module Ezid # # A request to the EZID service. # class Request < SimpleDelegator EZID_HOST = "ezid.cdlib.org" CHARSET = "UTF-8" CONTENT_TYPE = "text/plain" def self.build(op, *args) http_method, path, query = Api.send(op, *args) uri = URI::HTTPS.build(host: EZID_HOST, path: path, query: query) http_request = Net::HTTP.const_get(http_method).new(uri) Request.new(http_request) end def execute http_response = Net::HTTP.start(uri.host, use_ssl: true) do |http| set_content_type(CONTENT_TYPE, charset: CHARSET) http.request(__getobj__) end Response.build(http_response) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ezid-client-0.1.0 | lib/ezid/request.rb |