Class: Mockolate::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mockolate/response.rb

Constant Summary collapse

@@object_class =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_endpoint!(mtd, &block) ⇒ Object



6
7
8
# File 'lib/mockolate/response.rb', line 6

def self.define_endpoint!(mtd, &block)
  method(:define_method).call(mtd, &block)
end

.object_from(request_class) ⇒ Object

Raises:

  • (Exception)


14
15
16
17
# File 'lib/mockolate/response.rb', line 14

def self.object_from(request_class)
  raise Exception unless request_class.new.is_a? Mockolate::Request
  @@object_class = request_class.new 
end

Instance Method Details

#objectObject



10
11
12
# File 'lib/mockolate/response.rb', line 10

def object
  @@object_class.generate_hash!
end