Class: Laximo::Query
- Inherits:
-
Object
- Object
- Laximo::Query
- Defined in:
- lib/laximo/query.rb
Instance Method Summary collapse
-
#all(v = nil) ⇒ Object
quick_group_id.
-
#brand(v = nil) ⇒ Object
options.
-
#call(request) ⇒ Object
all.
-
#catalog(v = nil) ⇒ Object
ssd.
-
#category_id(v = nil) ⇒ Object
vehicle_id.
-
#detail_id(v = nil) ⇒ Object
oem.
-
#filter(v = nil) ⇒ Object
unit_id.
-
#frame(v = nil) ⇒ Object
vin.
-
#frame_no(v = nil) ⇒ Object
frame.
-
#initialize(func_name) ⇒ Query
constructor
A new instance of Query.
-
#locale(v = nil) ⇒ Object
initialize.
-
#localized(v = false) ⇒ Object
param.
-
#manufacturer_id(v = nil) ⇒ Object
detail_id.
-
#oem(v = nil) ⇒ Object
brand.
-
#operation(v = nil) ⇒ Object
catalog.
-
#options(args = []) ⇒ Object
value_id.
-
#param(v = nil) ⇒ Object
operation.
-
#quick_group_id(v = nil) ⇒ Object
filter.
-
#ssd(v = nil) ⇒ Object
locale.
-
#to_s ⇒ Object
(also: #to_str)
call.
-
#unit_id(v = nil) ⇒ Object
category_id.
-
#value_id(v = nil) ⇒ Object
wizard_id.
-
#vehicle_id(v = nil) ⇒ Object
frame_no.
-
#vin(v = nil) ⇒ Object
manufacturer_id.
-
#wizard_id(v = nil) ⇒ Object
localized.
Constructor Details
#initialize(func_name) ⇒ Query
Returns a new instance of Query.
6 7 8 9 10 11 |
# File 'lib/laximo/query.rb', line 6 def initialize(func_name) @func_name = func_name @query = {} end |
Instance Method Details
#all(v = nil) ⇒ Object
quick_group_id
183 184 185 186 187 188 189 |
# File 'lib/laximo/query.rb', line 183 def all(v = nil) @str = nil @query[:All] = (v === true || v == 1 || v == '1' ? 1 : 0) self end |
#brand(v = nil) ⇒ Object
options
87 88 89 90 91 92 93 |
# File 'lib/laximo/query.rb', line 87 def brand(v = nil) @str = nil @query[:Brand] = escape(v) self end |
#call(request) ⇒ Object
all
191 192 193 |
# File 'lib/laximo/query.rb', line 191 def call(request) request.call(self.to_s) end |
#catalog(v = nil) ⇒ Object
ssd
29 30 31 32 33 34 35 |
# File 'lib/laximo/query.rb', line 29 def catalog(v = nil) @str = nil @query[:Catalog] = escape(v) self end |
#category_id(v = nil) ⇒ Object
vehicle_id
151 152 153 154 155 156 157 |
# File 'lib/laximo/query.rb', line 151 def category_id(v = nil) @str = nil @query[:CategoryId] = escape(v) self end |
#detail_id(v = nil) ⇒ Object
oem
103 104 105 106 107 108 109 |
# File 'lib/laximo/query.rb', line 103 def detail_id(v = nil) @str = nil @query[:DetailId] = escape(v) self end |
#filter(v = nil) ⇒ Object
unit_id
167 168 169 170 171 172 173 |
# File 'lib/laximo/query.rb', line 167 def filter(v = nil) @str = nil @query[:Filter] = escape(v) self end |
#frame(v = nil) ⇒ Object
vin
127 128 129 130 131 132 133 |
# File 'lib/laximo/query.rb', line 127 def frame(v = nil) @str = nil @query[:Frame] = escape(v) self end |
#frame_no(v = nil) ⇒ Object
frame
135 136 137 138 139 140 141 |
# File 'lib/laximo/query.rb', line 135 def frame_no(v = nil) @str = nil @query[:FrameNo] = escape(v) self end |
#locale(v = nil) ⇒ Object
initialize
13 14 15 16 17 18 19 |
# File 'lib/laximo/query.rb', line 13 def locale(v = nil) @str = nil @query[:Locale] = escape(v) self end |
#localized(v = false) ⇒ Object
param
55 56 57 58 59 60 61 |
# File 'lib/laximo/query.rb', line 55 def localized(v = false) @str = nil @query[:Localized] = (v === true) self end |
#manufacturer_id(v = nil) ⇒ Object
detail_id
111 112 113 114 115 116 117 |
# File 'lib/laximo/query.rb', line 111 def manufacturer_id(v = nil) @str = nil @query[:ManufacturerId] = escape(v) self end |
#oem(v = nil) ⇒ Object
brand
95 96 97 98 99 100 101 |
# File 'lib/laximo/query.rb', line 95 def oem(v = nil) @str = nil @query[:OEM] = escape(v) self end |
#operation(v = nil) ⇒ Object
catalog
37 38 39 40 41 42 43 |
# File 'lib/laximo/query.rb', line 37 def operation(v = nil) @str = nil @query[:operation] = escape(v) self end |
#options(args = []) ⇒ Object
value_id
79 80 81 82 83 84 85 |
# File 'lib/laximo/query.rb', line 79 def (args = []) @str = nil @query[:Options] = args.empty? ? nil : args.join(',') self end |
#param(v = nil) ⇒ Object
operation
45 46 47 48 49 50 51 52 53 |
# File 'lib/laximo/query.rb', line 45 def param(v = nil) @str = nil if v.is_a?(Hash) && !v.empty? @query[v.keys.first] = escape(v.values.first) end self end |
#quick_group_id(v = nil) ⇒ Object
filter
175 176 177 178 179 180 181 |
# File 'lib/laximo/query.rb', line 175 def quick_group_id(v = nil) @str = nil @query[:QuickGroupId] = escape(v) self end |
#ssd(v = nil) ⇒ Object
locale
21 22 23 24 25 26 27 |
# File 'lib/laximo/query.rb', line 21 def ssd(v = nil) @str = nil @query[:ssd] = escape(v) self end |
#to_s ⇒ Object Also known as: to_str
call
195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/laximo/query.rb', line 195 def to_s return @str unless @str.nil? @str = '' @query.each { |key, value| @str << "|#{key}=#{value}" } @str[0] = '' @str = "#{@func_name}:#{@str}" end |
#unit_id(v = nil) ⇒ Object
category_id
159 160 161 162 163 164 165 |
# File 'lib/laximo/query.rb', line 159 def unit_id(v = nil) @str = nil @query[:UnitId] = escape(v) self end |
#value_id(v = nil) ⇒ Object
wizard_id
71 72 73 74 75 76 77 |
# File 'lib/laximo/query.rb', line 71 def value_id(v = nil) @str = nil @query[:ValueId] = escape(v) self end |
#vehicle_id(v = nil) ⇒ Object
frame_no
143 144 145 146 147 148 149 |
# File 'lib/laximo/query.rb', line 143 def vehicle_id(v = nil) @str = nil @query[:VehicleId] = escape(v) self end |
#vin(v = nil) ⇒ Object
manufacturer_id
119 120 121 122 123 124 125 |
# File 'lib/laximo/query.rb', line 119 def vin(v = nil) @str = nil @query[:VIN] = escape(v) self end |
#wizard_id(v = nil) ⇒ Object
localized
63 64 65 66 67 68 69 |
# File 'lib/laximo/query.rb', line 63 def wizard_id(v = nil) @str = nil @query[:WizardId] = escape(v) self end |