Class: PicturePath::Request

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

Constant Summary collapse

VERSION =
5.0
COUNTRY_US =
"US"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def city
  @city
end

#countryObject

Returns the value of attribute country.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def country
  @country
end

#customer_numberObject

Returns the value of attribute customer_number.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def customer_number
  @customer_number
end

#mls_idObject

Returns the value of attribute mls_id.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def mls_id
  @mls_id
end

#order_numberObject

Returns the value of attribute order_number.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def order_number
  @order_number
end

#product_lineObject

Returns the value of attribute product_line.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def product_line
  @product_line
end

#site_realtorObject

Returns the value of attribute site_realtor.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def site_realtor
  @site_realtor
end

#stateObject

Returns the value of attribute state.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def state
  @state
end

#street1Object

Returns the value of attribute street1.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def street1
  @street1
end

#street2Object

Returns the value of attribute street2.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def street2
  @street2
end

#tour_urlObject

Returns the value of attribute tour_url.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def tour_url
  @tour_url
end

#zip_codeObject

Returns the value of attribute zip_code.



9
10
11
# File 'lib/picturepath/request.rb', line 9

def zip_code
  @zip_code
end

Instance Method Details

#to_xmlObject

Create a valide XML request from the properties set on the request. Note: the PicturePath AUI requires capitalized tags



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/picturepath/request.rb', line 14

def to_xml
  output = ""
  x = Builder::XmlMarkup.new(:target => output, :indent => 1)
  x.instruct!
  x.AUI_SUBMISSION(:VERSION => VERSION) {
    x.TOUR {
      x.CUSTREFNUM customer_number
      (order_number != nil) && (x.ORDERNUM order_number)
      x.PRODUCT_LINE product_line
      x.ADDRESS {
        x.STREET1 street1
        x.STREET2 street2
        x.CITY city
        x.STATE state
        x.COUNTRY(:CODE => (country || COUNTRY_US))
        x.ZIP zip_code
      }
      x.IDENTIFIERS {
        x.ID1(:VALUE => mls_id, :TYPE => "MLSID")
      }
      x.DISTRIBUTION {
        if site_realtor.class == Array
          site_realtor.each do |site|
            x.SITE site
          end
        else
          x.SITE site_realtor
        end
      }
      x.TOUR_URL tour_url
    }
  }
  return output
end