Class: RESTRack::Splitter

Inherits:
Object
  • Object
show all
Defined in:
lib/restrack-splitter.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri_list, format = :JSON) ⇒ Splitter

Returns a new instance of Splitter.



7
8
9
10
11
12
# File 'lib/restrack-splitter.rb', line 7

def initialize(uri_list, format=:JSON)
  @clients = uri_list.collect do |uri|
    RESTRack::Client.new(uri, format)
  end
  @path = ''
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(resource_name, *args) ⇒ Object



14
15
16
17
# File 'lib/restrack-splitter.rb', line 14

def method_missing(resource_name, *args)
  execute {|client| client.__send__(resource_name.to_sym, *args) }
  self
end

Instance Method Details

#deleteObject



23
24
25
# File 'lib/restrack-splitter.rb', line 23

def delete
  execute {|client| client.delete }
end

#getObject



19
20
21
# File 'lib/restrack-splitter.rb', line 19

def get
  execute {|client| client.get }
end

#post(data = nil) ⇒ Object



27
28
29
# File 'lib/restrack-splitter.rb', line 27

def post(data=nil)
  execute {|client| client.post(data) }
end

#put(data = nil) ⇒ Object



31
32
33
# File 'lib/restrack-splitter.rb', line 31

def put(data=nil)
  execute {|client| client.put(data) }
end