Class: EmailOctopus::Query

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

Overview

Runs a query on model data.

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Query


6
7
8
9
# File 'lib/email_octopus/query.rb', line 6

def initialize(model)
  @model = model
  @api = API.new(EmailOctopus.config.api_key)
end

Instance Method Details

#eachObject


21
22
23
# File 'lib/email_octopus/query.rb', line 21

def each
  results.each { |result| yield result }
end

#limit(num) ⇒ Object


11
12
13
14
# File 'lib/email_octopus/query.rb', line 11

def limit(num)
  @limit = num
  self
end

#page(num) ⇒ Object


16
17
18
19
# File 'lib/email_octopus/query.rb', line 16

def page(num)
  @page = num
  self
end