class OrangeLib::Rest

Attributes

request[R]
response[R]

Public Class Methods

new() click to toggle source
# File lib/orange_lib/rest.rb, line 15
def initialize()
end

Public Instance Methods

Host() click to toggle source
# File lib/orange_lib/rest.rb, line 80
def Host
  self.class.base_uri
end
debugErr(opts={}) click to toggle source
# File lib/orange_lib/rest.rb, line 95
def debugErr(opts={})
  raise ArgumentError, 'opts param must an object which responds to #to_hash' unless opts.respond_to?(:to_hash)
  self.class.default_options[:debug_output] = $stderr
  opts = ModuleInheritableAttributes.hash_deep_dup(self.class.default_options).merge(opts.to_hash)
  opts
end
debugPass(opts={}) click to toggle source
# File lib/orange_lib/rest.rb, line 88
def debugPass(opts={})
  raise ArgumentError, 'opts param must an object which responds to #to_hash' unless opts.respond_to?(:to_hash)
  self.class.default_options[:debug_output] = $stdout
  opts = ModuleInheritableAttributes.hash_deep_dup(self.class.default_options).merge(opts.to_hash)
  opts
end
headers(h = {}) click to toggle source
# File lib/orange_lib/rest.rb, line 69
def headers(h = {})
  raise ArgumentError, 'Headers must an object which responds to #to_hash' unless h.respond_to?(:to_hash)
  self.class.default_options[:headers] ||= {}
  self.class.default_options[:headers].merge!(h.to_hash)
end
mergeOpt(opts={}) click to toggle source
# File lib/orange_lib/rest.rb, line 22
def mergeOpt(opts={})
  self.class.default_options = self.class.default_options.merge(opts.to_hash)
  puts self.class.default_options
end
process_headers(options) click to toggle source
# File lib/orange_lib/rest.rb, line 57
def process_headers(options)
  if options[:headers] && headers.any?
    options[:headers] = headers.merge(options[:headers])
  end
end
setFollowRedirect(flag) click to toggle source
# File lib/orange_lib/rest.rb, line 84
def setFollowRedirect(flag)
  self.class.follow_redirects flag
end
setHost(host) click to toggle source
# File lib/orange_lib/rest.rb, line 75
def setHost(host)
  raise OrangeLib::Error.new('host param is null') if host.nil?
  self.class.base_uri host
end