Class: FoundationApi::Service

Inherits:
Object
  • Object
show all
Includes:
Model::AttributeMethods, Request
Defined in:
lib/foundation_api/service.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model::AttributeMethods

#[], #[]=, #method_missing

Constructor Details

#initialize(attributes = {}) ⇒ Service

Returns a new instance of Service.



52
53
54
# File 'lib/foundation_api/service.rb', line 52

def initialize(attributes = {})
  @attributes = HashWithIndifferentAccess.new attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FoundationApi::Model::AttributeMethods

Class Method Details

.allObject



19
20
21
22
# File 'lib/foundation_api/service.rb', line 19

def all
  res = request_data(default_scope)
  res && instantiate_objects(res)
end

.where(options) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/foundation_api/service.rb', line 11

def where(options)
  if options.is_a? Hash
    options = {:conditions => options }
  end
  res = request_data(translate_options(options))
  res && instantiate_objects(res)
end