Module: Sistrix::Base

Instance Method Summary collapse

Instance Method Details

#base_uriObject



19
20
21
# File 'lib/sistrix/base.rb', line 19

def base_uri
  'http://' + ::Sistrix::SERVICE_HOST + '/' + method_name
end

#fetch(options = {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/sistrix/base.rb', line 6

def fetch(options = {})
  @options.merge!(options)

  response = RestClient.get(base_uri, { :params => @options })
  Nokogiri::XML(response.to_s)
end

#method_nameObject



13
14
15
16
17
# File 'lib/sistrix/base.rb', line 13

def method_name
  # derive the method name from the class name
  #
  self.class.to_s.downcase.sub(/^.+?::/, '').gsub(/::/, '.')
end