Class: Nexpose::Silo::Merchant
- Inherits:
-
Organization
- Object
- Organization
- Nexpose::Silo::Merchant
- Defined in:
- lib/nexpose/silo.rb
Instance Attribute Summary collapse
-
#acquirer_relationship ⇒ Object
Returns the value of attribute acquirer_relationship.
-
#agent_relationship ⇒ Object
Returns the value of attribute agent_relationship.
-
#dbas ⇒ Object
Returns the value of attribute dbas.
-
#ecommerce ⇒ Object
Returns the value of attribute ecommerce.
-
#grocery ⇒ Object
Returns the value of attribute grocery.
-
#industries ⇒ Object
Returns the value of attribute industries.
-
#mail_order ⇒ Object
Returns the value of attribute mail_order.
-
#payment_application ⇒ Object
Returns the value of attribute payment_application.
-
#payment_version ⇒ Object
Returns the value of attribute payment_version.
-
#petroleum ⇒ Object
Returns the value of attribute petroleum.
-
#qsa ⇒ Object
Returns the value of attribute qsa.
-
#retail ⇒ Object
Returns the value of attribute retail.
-
#telecommunication ⇒ Object
Returns the value of attribute telecommunication.
-
#travel ⇒ Object
Returns the value of attribute travel.
Attributes inherited from Organization
#address, #company, #email, #first_name, #last_name, #phone, #title, #url
Class Method Summary collapse
Instance Method Summary collapse
- #as_xml ⇒ Object
-
#initialize(&block) ⇒ Merchant
constructor
A new instance of Merchant.
Constructor Details
#initialize(&block) ⇒ Merchant
Returns a new instance of Merchant.
234 235 236 237 238 239 |
# File 'lib/nexpose/silo.rb', line 234 def initialize(&block) instance_eval(&block) if block_given? @dbas = Array(@dbas) @industries = Array(@industries) @qsa = Array(@qsa) end |
Instance Attribute Details
#acquirer_relationship ⇒ Object
Returns the value of attribute acquirer_relationship.
219 220 221 |
# File 'lib/nexpose/silo.rb', line 219 def acquirer_relationship @acquirer_relationship end |
#agent_relationship ⇒ Object
Returns the value of attribute agent_relationship.
220 221 222 |
# File 'lib/nexpose/silo.rb', line 220 def agent_relationship @agent_relationship end |
#dbas ⇒ Object
Returns the value of attribute dbas.
230 231 232 |
# File 'lib/nexpose/silo.rb', line 230 def dbas @dbas end |
#ecommerce ⇒ Object
Returns the value of attribute ecommerce.
221 222 223 |
# File 'lib/nexpose/silo.rb', line 221 def ecommerce @ecommerce end |
#grocery ⇒ Object
Returns the value of attribute grocery.
222 223 224 |
# File 'lib/nexpose/silo.rb', line 222 def grocery @grocery end |
#industries ⇒ Object
Returns the value of attribute industries.
231 232 233 |
# File 'lib/nexpose/silo.rb', line 231 def industries @industries end |
#mail_order ⇒ Object
Returns the value of attribute mail_order.
223 224 225 |
# File 'lib/nexpose/silo.rb', line 223 def mail_order @mail_order end |
#payment_application ⇒ Object
Returns the value of attribute payment_application.
224 225 226 |
# File 'lib/nexpose/silo.rb', line 224 def payment_application @payment_application end |
#payment_version ⇒ Object
Returns the value of attribute payment_version.
225 226 227 |
# File 'lib/nexpose/silo.rb', line 225 def payment_version @payment_version end |
#petroleum ⇒ Object
Returns the value of attribute petroleum.
226 227 228 |
# File 'lib/nexpose/silo.rb', line 226 def petroleum @petroleum end |
#qsa ⇒ Object
Returns the value of attribute qsa.
232 233 234 |
# File 'lib/nexpose/silo.rb', line 232 def qsa @qsa end |
#retail ⇒ Object
Returns the value of attribute retail.
227 228 229 |
# File 'lib/nexpose/silo.rb', line 227 def retail @retail end |
#telecommunication ⇒ Object
Returns the value of attribute telecommunication.
228 229 230 |
# File 'lib/nexpose/silo.rb', line 228 def telecommunication @telecommunication end |
#travel ⇒ Object
Returns the value of attribute travel.
229 230 231 |
# File 'lib/nexpose/silo.rb', line 229 def travel @travel end |
Class Method Details
.parse(xml) ⇒ Object
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/nexpose/silo.rb', line 241 def self.parse(xml) new do |merchant| merchant.acquirer_relationship = xml.attributes['acquirer-relationship'].to_s.chomp.eql?('true') merchant.agent_relationship = xml.attributes['agent-relationship'].to_s.chomp.eql?('true') merchant.ecommerce = xml.attributes['ecommerce'].to_s.chomp.eql?('true') merchant.grocery = xml.attributes['grocery'].to_s.chomp.eql?('true') merchant.mail_order = xml.attributes['mail-order'].to_s.chomp.eql?('true') merchant.payment_application = xml.attributes['payment-application'] merchant.payment_version = xml.attributes['payment-version'] merchant.petroleum = xml.attributes['petroleum'].to_s.chomp.eql?('true') merchant.retail = xml.attributes['retail'].to_s.chomp.eql?('true') merchant.telecommunication = xml.attributes['telecommunication'].to_s.chomp.eql?('true') merchant.travel = xml.attributes['travel'].to_s.chomp.eql?('true') merchant.company = xml.attributes['company'] merchant.first_name = xml.attributes['first-name'] merchant.last_name = xml.attributes['last-name'] merchant.phone = xml.attributes['phone-number'] merchant.email = xml.attributes['email'] merchant.title = xml.attributes['title'] merchant.url = xml.attributes['url'] xml.elements.each('Address') do |address| merchant.address = Address.parse(address) end merchant.dbas = [] xml.elements.each('DBAs/DBA') do |dba| merchant.dbas << dba.attributes['name'] end merchant.industries = [] xml.elements.each('OtherIndustries/Industry') do |industry| merchant.industries << industry.attributes['name'] end merchant.qsa = [] xml.elements.each('QSA') do |organization| merchant.qsa << Organization.parse(organization) end end end |
Instance Method Details
#as_xml ⇒ Object
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/nexpose/silo.rb', line 283 def as_xml xml = super xml.name = 'Merchant' xml.add_attributes({ 'acquirer-relationship' => @acquirer_relationship, 'agent-relationship' => @agent_relationship, 'ecommerce' => @ecommerce, 'grocery' => @grocery, 'mail-order' => @mail_order }) xml.add_attributes({ 'payment-application' => @payment_application, 'payment-version' => @payment_version, 'petroleum' => @petroleum, 'retail' => @retail, 'telecommunication' => @telecommunication, 'travel' => @travel }) unless dbas.empty? dbas = REXML::Element.new('DBAs') @dbas.each do |dba| dbas.add_element('DBA', { 'name' => dba }) end end unless @industries.empty? industries = REXML::Element.new('OtherIndustries') @industries.each do |industry| industries.add_element('Industry', { 'name' => industry }) end end xml.add(@qsa.as_xml) unless @qsa.empty? xml end |