Class: ServiCraft::Query
- Inherits:
-
Object
- Object
- ServiCraft::Query
- Defined in:
- lib/servi_craft/query.rb
Overview
Query Record Service
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(base, page: 1, rows: nil) ⇒ Query
constructor
A new instance of Query.
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
#response ⇒ Object (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
#call ⇒ Object
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.}" puts e.backtrace.join("\n") end |