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.



192
193
194
# File 'lib/nexpose/silo.rb', line 192

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

Instance Attribute Details

#addressObject

Returns the value of attribute address.



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

def address
  @address
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#phoneObject

Returns the value of attribute phone.



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

def phone
  @phone
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.parse(xml) ⇒ Object



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

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



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

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