Sha256: 093734550860f808ad487210b7f7f56969e76c3f7844622321e0b3cf9b82c471
Contents?: true
Size: 949 Bytes
Versions: 3
Compression:
Stored size: 949 Bytes
Contents
# Author:: Erik Hetzner (mailto:erik.hetzner@ucop.edu) # Copyright:: Copyright (c) 2011, Regents of the University of California require 'rubygems' require 'rest-client' module Mrt module Ingest # A client for ingesting objects into a Merritt. class Client def initialize(base_uri, username = nil, password = nil) @base_uri = base_uri @username = username @password = password end # Send a request to the client. def ingest(ingest_req) Response.new(mk_rest_request(ingest_req).execute) end # :nodoc: def mk_rest_request(ingest_req) args = { method: :post, url: @base_uri, user: @username, password: @password, payload: ingest_req.mk_args, headers: { multipart: true } }.delete_if { |_k, v| (v.nil? || v == '') } RestClient::Request.new(args) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mrt-ingest-0.0.10 | lib/mrt/ingest/client.rb |
mrt-ingest-0.0.6 | lib/mrt/ingest/client.rb |
mrt-ingest-0.0.5 | lib/mrt/ingest/client.rb |