Module: Spire::API::Requestable::InstanceMethods

Defined in:
lib/spire/api/requestable.rb

Instance Method Summary collapse

Instance Method Details

#prepare_request(name, *args) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/spire/api/requestable.rb', line 36

def prepare_request(name, *args)
  if block = self.class.get_request(name)
    options = self.instance_exec(*args, &block)
    Request.new(@client, options)
  else
    raise ArgumentError, "No request has been defined for #{name.inspect}"
  end
end

#request(name, *args) ⇒ Object



45
46
47
# File 'lib/spire/api/requestable.rb', line 45

def request(name, *args)
  prepare_request(name, *args).exec
end