Module: Templates

Included in:
WindowsLiveAdmin
Defined in:
lib/windows_live_admin/templates.rb

Overview

This module contains various template methods which return the XML request that needs to be sent to the server to perform corresponding tasks. This module is mixed into the WindowsLiveAdmin class. Hence all the methods defined here can be invoked directly on the objects of WindowsLiveAdmin class

Instance Method Summary collapse

Instance Method Details

#create_member_xml(member_name, password, reset_password, first_name, last_name, lcid) ⇒ String

Generates the XML required by the create_member method. This is a helper function.

Parameters:

  • member_name (String)

    member’s complete email id

  • password (String)

    member’s desired password

  • reset_password (Boolean)

    a true/false value whether we want member to be forced to change her password on first login.

  • first_name (String)

    first name of member

  • last_name (String)

    last name of member

  • lcid (Sting)

    member’s locale ID. Can be blank or nil

Returns:

  • (String)

    Complete XML with member details filled in



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/windows_live_admin/templates.rb', line 60

def create_member_xml(member_name, password, reset_password, first_name, last_name, lcid)
  str = <<-eos
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ManageDomain2Authorization xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
      <authorizationType>PassportTicket</authorizationType>
      <authorizationData>#{@auth_data}</authorizationData>
    </ManageDomain2Authorization>
  </soap:Header>
  <soap:Body>
    <CreateMember xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
      <memberNameIn>#{member_name}</memberNameIn>
      <password>#{password}</password>
      <resetPassword>#{reset_password}</resetPassword>
      <firstName>#{first_name}</firstName>
      <lastName>#{last_name}</lastName>
      <lcid>#{lcid}</lcid>
    </CreateMember>
  </soap:Body>
</soap:Envelope>
  eos
end

#delete_member_xml(member_name) ⇒ String

Generates the XML required by the delete_member method. This is a helper function.

Parameters:

  • member_name (String)

    email id of the member who is to be deleted

Returns:

  • (String)

    Complete XML with auth_data and member details filled in



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/windows_live_admin/templates.rb', line 88

def delete_member_xml(member_name)
  str = <<-eos
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
  <ManageDomain2Authorization xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
    <authorizationType>PassportTicket</authorizationType>
    <authorizationData>#{@auth_data}</authorizationData>
  </ManageDomain2Authorization>
</soap:Header>
<soap:Body>
  <DeleteMember xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
    <memberNameIn>#{member_name}</memberNameIn>
  </DeleteMember>
</soap:Body>
</soap:Envelope>
  eos
end

#get_login_data_template_xmlString

Generates the XML required by the get_login_data_template method.

Returns:

  • (String)

    XML required to be sent to the server



24
25
26
27
28
29
30
31
32
33
# File 'lib/windows_live_admin/templates.rb', line 24

def 
  str = <<-eos
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetLoginDataTemplate xmlns="http://domains.live.com/Service/ManageDomain/V1.0" />
  </soap:Body>
</soap:Envelope>
  eos
end

#get_login_url_xmlString

Generates the XML required by the get_login_url method.

Returns:

  • (String)

    Complete XML with username filled in



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/windows_live_admin/templates.rb', line 9

def 
  str = <<-eos
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
  <GetLoginUrl xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
    <memberNameIn>#{@username}</memberNameIn>
  </GetLoginUrl>
</soap:Body>
</soap:Envelope>
  eos
end

#verify_auth_data_xmlString

Generates the XML required by the verify_auth_data method.

Returns:

  • (String)

    Complete XML with auth_data filled in



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/windows_live_admin/templates.rb', line 37

def verify_auth_data_xml
  str = <<-eos
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <VerifyAuthData xmlns="http://domains.live.com/Service/ManageDomain/V1.0">
      <authData>#{@auth_data}</authData>
    </VerifyAuthData>
  </soap:Body>
</soap:Envelope>
  eos
end