Class: ServiCraft::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/servi_craft/query.rb

Overview

Query Record Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, page: 1, rows: nil) ⇒ Query

Returns a new instance of Query.



10
11
12
13
14
15
# File 'lib/servi_craft/query.rb', line 10

def initialize(base, page: 1, rows: nil)
  @base = base
  @page = page.to_i
  @rows = rows
  @response = ::EchoCraft::ServiceObjects::Query.new(query: @base, page: @page, rows: @rows)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/servi_craft/query.rb', line 8

def response
  @response
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
# File 'lib/servi_craft/query.rb', line 17

def call
  @response.list(paginate(@base))
  @response
rescue StandardError => e
  puts "#{e.class}: #{e.message}"
  puts e.backtrace.join("\n")
end