Class: EchoCraft::ServiceObjects::Query

Inherits:
EchoCraft::ServiceObject show all
Defined in:
lib/echo_craft/service_objects/query.rb

Overview

Basic Response to Create a Record on ServiceObject

Instance Attribute Summary collapse

Attributes inherited from EchoCraft::ServiceObject

#record, #successful

Attributes inherited from Response

#data, #message, #status

Instance Method Summary collapse

Methods inherited from EchoCraft::ServiceObject

#set_service_successful, #unprocessabled

Methods inherited from Response

#change_status

Constructor Details

#initialize(query: [], page: 1, rows: nil) ⇒ Query

Returns a new instance of Query.



11
12
13
14
15
16
# File 'lib/echo_craft/service_objects/query.rb', line 11

def initialize(query: [], page: 1, rows: nil)
  super()
  @query = query
  @page = page
  @rows = rows
end

Instance Attribute Details

#pageObject

Returns the value of attribute page.



9
10
11
# File 'lib/echo_craft/service_objects/query.rb', line 9

def page
  @page
end

#queryObject

Returns the value of attribute query.



9
10
11
# File 'lib/echo_craft/service_objects/query.rb', line 9

def query
  @query
end

#rowsObject

Returns the value of attribute rows.



9
10
11
# File 'lib/echo_craft/service_objects/query.rb', line 9

def rows
  @rows
end

Instance Method Details

#list(query) ⇒ Object



18
19
20
21
22
# File 'lib/echo_craft/service_objects/query.rb', line 18

def list(query)
  @query = query
  set_service_successful
  change_status(:ok)
end