Class: Blinksale::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



5
6
7
# File 'lib/clients.rb', line 5

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



5
6
7
# File 'lib/clients.rb', line 5

def address2
  @address2
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/clients.rb', line 5

def city
  @city
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/clients.rb', line 5

def country
  @country
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/clients.rb', line 5

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



5
6
7
# File 'lib/clients.rb', line 5

def phone
  @phone
end

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/clients.rb', line 5

def state
  @state
end

#zip_codeObject

Returns the value of attribute zip_code.



5
6
7
# File 'lib/clients.rb', line 5

def zip_code
  @zip_code
end

Class Method Details

.from_node(node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/clients.rb', line 7

def self.from_node(node)
  self.new.tap do |i|
    i.id = node.attributes["uri"].content[/\d+$/].to_i
    i.name = node.xpath('xmlns:name').first.content
    i.address1 = node.xpath("xmlns:address1").first.content.to_f
    i.address2 = node.xpath("xmlns:address2").first.content.to_f
    i.city = node.xpath("xmlns:city").first.content.to_f
    i.state = node.xpath("xmlns:state").first.content.to_f
    i.zip_code = node.xpath("xmlns:zip").first.content.to_f
    i.country = node.xpath("xmlns:country").first.content.to_f
    i.phone = node.xpath("xmlns:phone").first.content.to_f
  end
end