Class: DfpApi::FilterStatement
- Inherits:
-
Object
- Object
- DfpApi::FilterStatement
- Defined in:
- lib/dfp_api/dfp_api_statement.rb
Overview
A statement object for PQL and get*ByStatement queries.
Instance Attribute Summary collapse
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#offset ⇒ Object
Returns the value of attribute offset.
Instance Method Summary collapse
-
#initialize(query_statement = '', values = [], limit = SUGGESTED_PAGE_LIMIT, offset = 0) ⇒ FilterStatement
constructor
Constructor for a Filter Statement.
- #toStatement ⇒ Object
- #toStatementForAction ⇒ Object
- #toStatementWithoutOffset ⇒ Object
Constructor Details
#initialize(query_statement = '', values = [], limit = SUGGESTED_PAGE_LIMIT, offset = 0) ⇒ FilterStatement
Constructor for a Filter Statement.
28 29 30 31 32 33 34 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 28 def initialize(query_statement='', values=[], limit=SUGGESTED_PAGE_LIMIT, offset=0) @query_statement = query_statement.dup() @values = values @limit = limit @offset = offset end |
Instance Attribute Details
#limit ⇒ Object
Returns the value of attribute limit.
36 37 38 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 36 def limit @limit end |
#offset ⇒ Object
Returns the value of attribute offset.
37 38 39 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 37 def offset @offset end |
Instance Method Details
#toStatement ⇒ Object
39 40 41 42 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 39 def toStatement() statement = @query_statement + ' LIMIT %d OFFSET %d' % [@limit, @offset] return {:query => statement, :values => @values} end |
#toStatementForAction ⇒ Object
44 45 46 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 44 def toStatementForAction() return {:query => @query_statement.dup(), :values => @values} end |
#toStatementWithoutOffset ⇒ Object
48 49 50 51 |
# File 'lib/dfp_api/dfp_api_statement.rb', line 48 def toStatementWithoutOffset() statement = @query_statement + ' LIMIT %d' % [@limit] return {:query => statement, :values => @values} end |