Class: Caren::Store::Address

Inherits:
Base
  • Object
show all
Defined in:
lib/caren/store/address.rb

Overview

This class is just an intermediate for representing potential event occurences.

Instance Attribute Summary

Attributes inherited from Base

#attributes, #original_xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

from_xml, hash_from_image, init_dependent_objects, #initialize, resource_location, #resource_url, resource_url, search_url, #to_xml, to_xml

Constructor Details

This class inherits a constructor from Caren::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Caren::Base

Class Method Details

.array_rootObject



16
17
18
# File 'lib/caren/store/address.rb', line 16

def self.array_root
 :addresses
end

.keysObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/caren/store/address.rb', line 4

def self.keys
  [ :full_name,                 # String
    :address_line_1,            # String
    :address_line_2,            # String
    :city,                      # String
    :state_province_or_region,  # String
    :zip,                       # String
    :country,                   # String
    :purpose,                   # String (shipping or billing)
  ]
end

.node_rootObject



43
44
45
# File 'lib/caren/store/address.rb', line 43

def self.node_root
 :address
end

Instance Method Details

#as_xmlObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/caren/store/address.rb', line 20

def as_xml
  {
    :full_name => self.full_name,
    :address_line_1 => self.address_line_1,
    :address_line_2 => self.address_line_2,
    :city => self.city,
    :state_province_or_region => self.state_province_or_region,
    :zip => self.zip,
    :country => self.country
  }
end

#node_rootObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/caren/store/address.rb', line 32

def node_root
  case self.purpose
  when "shipping"
    :shipping_address
  when "billing"
    :billing_address
  else
    self.class.node_root
  end
end