Class: Sifterology::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/sifterology/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Request

Returns a new instance of Request.



11
12
13
# File 'lib/sifterology/request.rb', line 11

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

debug_output $stdout



9
10
11
# File 'lib/sifterology/request.rb', line 9

def resource
  @resource
end

#responseObject (readonly)

debug_output $stdout



9
10
11
# File 'lib/sifterology/request.rb', line 9

def response
  @response
end

Instance Method Details

#perform(*args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/sifterology/request.rb', line 15

def perform(*args)
  method, path, options = args.shift, args.shift, args.last
  url = File.join(resource.session., path)
  options ||= {}
  prepare_options(options)      
  process_response(self.class.send(method, url, options))
end