Class: Nexpose::Silo::Organization

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/silo.rb

Direct Known Subclasses

Merchant

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Organization

Returns a new instance of Organization.



190
191
192
# File 'lib/nexpose/silo.rb', line 190

def initialize(&block)
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



185
186
187
# File 'lib/nexpose/silo.rb', line 185

def address
  @address
end

#companyObject

Returns the value of attribute company.



181
182
183
# File 'lib/nexpose/silo.rb', line 181

def company
  @company
end

#emailObject

Returns the value of attribute email.



186
187
188
# File 'lib/nexpose/silo.rb', line 186

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



182
183
184
# File 'lib/nexpose/silo.rb', line 182

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



183
184
185
# File 'lib/nexpose/silo.rb', line 183

def last_name
  @last_name
end

#phoneObject

Returns the value of attribute phone.



184
185
186
# File 'lib/nexpose/silo.rb', line 184

def phone
  @phone
end

#titleObject

Returns the value of attribute title.



187
188
189
# File 'lib/nexpose/silo.rb', line 187

def title
  @title
end

#urlObject

Returns the value of attribute url.



188
189
190
# File 'lib/nexpose/silo.rb', line 188

def url
  @url
end

Class Method Details

.parse(xml) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/nexpose/silo.rb', line 202

def self.parse(xml)
  new do |organization|
    organization.company    = xml.attributes['company']
    organization.first_name = xml.attributes['first-name']
    organization.last_name  = xml.attributes['last-name']
    organization.phone      = xml.attributes['phone-number']
    xml.elements.each('Address') do |address|
      organization.address = Address.parse(address)
    end
    organization.email = xml.attributes['email']
    organization.title = xml.attributes['title']
    organization.url   = xml.attributes['url']
  end
end

Instance Method Details

#as_xmlObject



194
195
196
197
198
199
200
# File 'lib/nexpose/silo.rb', line 194

def as_xml
  xml = REXML::Element.new('Organization')
  xml.add_attributes({ 'company' => @company, 'email-address' => @email, 'first-name' => @first_name,
                       'last-name' => @last_name, 'phone-number' => @phone, 'title' => @title, 'url' => @url })
  xml.add(@address.as_xml)
  xml
end