Class: ROM::Firebase::ResponseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/firebase/response_handler.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, dataset) ⇒ ResponseHandler

Returns a new instance of ResponseHandler.



8
9
10
11
# File 'lib/rom/firebase/response_handler.rb', line 8

def initialize(response, dataset)
  @response = response
  @dataset = dataset
end

Class Method Details

.call(response, dataset) ⇒ Object



4
5
6
# File 'lib/rom/firebase/response_handler.rb', line 4

def self.call(response, dataset)
  new(response, dataset).call
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'lib/rom/firebase/response_handler.rb', line 13

def call
  return create_response if options[:request_method] == :post
  return [path_response] unless path.nil? || path.empty?
  return [] if options[:request_method] == :delete # delete always succeeds

  collection_response
end