class Couch::Server

Attributes

options[RW]

Public Class Methods

new(url, options) click to toggle source
# File lib/couch.rb, line 276
def initialize(url, options)
  if url.is_a? String
    url = URI(url)
  end
  @couch_url = url
  @options = options
  @options[:couch_url] = @couch_url
  @options[:use_ssl] ||= true
  @options[:max_array_length] ||= 250
  @options[:flush_size_mb] ||= 10
  @options[:open_timeout] ||= 5*30
  @options[:read_timeout] ||= 5*30
  @options[:fail_silent] ||= false
end

Public Instance Methods

delete(uri) click to toggle source
# File lib/couch.rb, line 291
def delete(uri)
  Request.new(Net::HTTP::Delete.new(uri), nil,
              @options
  ).perform
end
get(uri) click to toggle source
# File lib/couch.rb, line 311
def get(uri)
  Request.new(
      Net::HTTP::Get.new(uri), nil,
      @options
  ).perform
end
head(uri) click to toggle source
# File lib/couch.rb, line 301
def head(uri)
  Request.new(Net::HTTP::Head.new(uri), nil,
              @options
  ).perform
end
new_delete(uri) click to toggle source
# File lib/couch.rb, line 297
def new_delete(uri)
  Request.new(Net::HTTP::Delete.new(uri)).couch_url(@couch_url)
end
new_get(uri) click to toggle source
# File lib/couch.rb, line 318
def new_get(uri)
  Request.new(Net::HTTP::Get.new(uri)).couch_url(@couch_url)
end
new_head(uri) click to toggle source
# File lib/couch.rb, line 307
def new_head(uri)
  Request.new(Net::HTTP::Head.new(uri)).couch_url(@couch_url)
end
new_post(uri) click to toggle source
# File lib/couch.rb, line 338
def new_post(uri)
  Request.new(Net::HTTP::Post.new(uri)).couch_url(@couch_url)
end
new_put(uri) click to toggle source
# File lib/couch.rb, line 328
def new_put(uri)
  Request.new(Net::HTTP::Put.new(uri)).couch_url(@couch_url)
end
post(uri, json) click to toggle source
# File lib/couch.rb, line 332
def post(uri, json)
  Request.new(Net::HTTP::Post.new(uri), json,
              @options
  ).perform
end
put(uri, json) click to toggle source
# File lib/couch.rb, line 322
def put(uri, json)
  Request.new(Net::HTTP::Put.new(uri), json,
              @options
  ).perform
end