Class: InstantApi::Model::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/instant_api/model/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, params) ⇒ Resource

Returns a new instance of Resource.



5
6
7
8
# File 'lib/instant_api/model/resource.rb', line 5

def initialize(klass, params)
  @params = params
  @query_builder = InstantApi::Model::ActiveRecordQueryBuilder.new(klass)
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/instant_api/model/resource.rb', line 3

def params
  @params
end

#query_builderObject (readonly)

Returns the value of attribute query_builder.



3
4
5
# File 'lib/instant_api/model/resource.rb', line 3

def query_builder
  @query_builder
end

Instance Method Details

#findObject



10
11
12
# File 'lib/instant_api/model/resource.rb', line 10

def find
  query_builder.find_first(params)
end