Class: Quickeebooks::Shared::Service::Filter
- Inherits:
-
Object
- Object
- Quickeebooks::Shared::Service::Filter
- Defined in:
- lib/quickeebooks/shared/service/filter.rb
Direct Known Subclasses
Constant Summary collapse
- DATE_FORMAT =
'%Y-%m-%d'
- DATE_TIME_FORMAT =
'%Y-%m-%dT%H:%M:%S%Z'
Instance Attribute Summary collapse
-
#after ⇒ Object
For Date/Time filtering.
-
#before ⇒ Object
For Date/Time filtering.
-
#eq ⇒ Object
For number comparisons.
-
#field ⇒ Object
Returns the value of attribute field.
-
#gt ⇒ Object
For number comparisons.
-
#lt ⇒ Object
For number comparisons.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type, *args) ⇒ Filter
constructor
A new instance of Filter.
- #to_s ⇒ Object
Constructor Details
#initialize(type, *args) ⇒ Filter
Returns a new instance of Filter.
18 19 20 21 22 23 24 25 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 18 def initialize(type, *args) @type = type if args.first.is_a?(Hash) args.first.each_pair do |key, value| instance_variable_set("@#{key}", value) end end end |
Instance Attribute Details
#after ⇒ Object
For Date/Time filtering
13 14 15 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 13 def after @after end |
#before ⇒ Object
For Date/Time filtering
13 14 15 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 13 def before @before end |
#eq ⇒ Object
For number comparisons
16 17 18 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 16 def eq @eq end |
#field ⇒ Object
Returns the value of attribute field.
10 11 12 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 10 def field @field end |
#gt ⇒ Object
For number comparisons
16 17 18 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 16 def gt @gt end |
#lt ⇒ Object
For number comparisons
16 17 18 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 16 def lt @lt end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 9 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
10 11 12 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 10 def value @value end |
Instance Method Details
#to_s ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/quickeebooks/shared/service/filter.rb', line 27 def to_s case @type.to_sym when :date, :datetime date_time_to_s when :text text_to_s when :boolean boolean_to_s when :number number_to_s else raise ArgumentError, "Don't know how to generate a Filter for type #{@type}" end end |