SlideShare une entreprise Scribd logo
1  sur  4
require 'net/http'
require 'uri'
require 'rexml/document'

# REQUIRED PARAMETERS.
 USERNAME = 'administrator@estateportal.co.za'
 PASSWORD = 'secretstory'
 URL_NAME = quot;http://www.graphicmail.co.za/api.aspx?
Username=#{USERNAME}&Password=#{PASSWORD}quot;
 URL_NAME_POST = quot;http://www.graphicmail.co.za/api.aspx?quot;


class GraphicMail
 # Connect to GraphicMail using HTTP post/get.
 class Connector
   def self.setup_http_get(func)
    xml_data = Net::HTTP.get(URI.parse(quot;#{URL_NAME}&Function=#{func}quot;))
   end

  def self.setup_http_post(form)
   res = Net::HTTP.post_form(URI.parse(quot;#{URL_NAME_POST}quot;), form)
  end
 end

 ##*** MANAGE MAILING LIST ****##
 # Get mailinglists.
 def self.get_mailinglists
  xml_data = Connector.setup_http_get('get_mailinglists')

  ref = XmlSimple.xml_in(xml_data)
  data_array = ref[quot;mailinglistquot;]
  return data_array
 end

 # Get mailinglists.
 def self.get_mailinglist(id = '17836')
  xml_data = Connector.setup_http_get(quot;get_mailinglist&MailinglistID=#{id}quot;)

  ref = XmlSimple.xml_in(xml_data)
  data_array = ref[quot;emailquot;]
  return data_array
 end

 # Create mailinglists.
 def self.post_create_mailinglist(new_mailinglist = 'my mailing list')
  # create a hash for a new mailing list.
  form = Hash.new

  form.merge!({:Username => USERNAME,
          :Password => PASSWORD,
          :Function => 'post_create_mailinglist',
          :NewMailinglist => new_mailinglist
        })

  xml_data = Connector.setup_http_post(form)
  xml_data.msg
end

    # Delete Mailinglists.
    def self.post_delete_mailinglist(mailinglist_id = 123456)
     # create a hash for a new mailing list.
     form = Hash.new

     form.merge!({:Username => USERNAME,
             :Password => PASSWORD,
             :Function => 'post_delete_mailinglist',
             :MailinglistID => mailinglist_id
           })

     xml_data = Connector.setup_http_post(form)
     xml_data.msg
    end

    # Delete Mailinglists.
    def self.post_rename_mailinglist(mailinglist_id = 123456, new_name = 'MyName')
     # create a hash for a new mailing list.
     form = Hash.new

     form.merge!({:Username => USERNAME,
             :Password => PASSWORD,
             :Function => 'post_rename_mailinglist',
             :MailinglistID => mailinglist_id,
             :NewName => new_name
           })

     xml_data = Connector.setup_http_post(form)
     xml_data.msg
    end

    ##*** END MANAGE MAILING LIST ****##

 ##*** MANAGE NEWS LETTER ****##
 # Get mailinglists.
 def self.get_newsletter(id = '87341')
  xml_data =
Connector.setup_http_get(quot;get_newsletter&NewsletterID=#{id}&TextVersion=falsequot;)

#     ref = XmlSimple.xml_in(xml_data)
     xml_data = xml_data.split(quot;rnquot;).join(quot;quot;)
     xml_data = xml_data.gsub(/quot;/,''')

     return xml_data
    end

    def self.get_newsletters()
     xml_data = Connector.setup_http_get(quot;get_newslettersquot;)
#
     ref = XmlSimple.xml_in(xml_data)
     data_array = ref[quot;newsletterquot;]
     raise data_array.inspect

     return data_array
end

# Delete Newsletter.
def self.post_delete_newsletter(newsletter_id = 123456)
 # create a hash for a new mailing list.
 form = Hash.new

 form.merge!({:Username => USERNAME,
         :Password => PASSWORD,
         :Function => 'post_delete_newsletter',
         :NewsletterID => newsletter_id
       })

 xml_data = Connector.setup_http_post(form)
 xml_data.msg
end

# Create Newsletter.
def self.post_import_newsletter(letter_name)
 html_url = 'https://www.estateportal.co.za/about/index'
 # create a hash for a new mailing list.
 form = Hash.new

 form.merge!({:Username => USERNAME,
         :Password => PASSWORD,
         :Function => 'post_import_newsletter',
         :HtmlURL => html_url,
         :NewExisting => 'New',
         :NewsletterName => letter_name,
         :NewsletterID => ' '
       })

 xml_data = Connector.setup_http_post(form)
 xml_data.body
end

# Create Newsletter.
def self.post_update_newsletter(letter_name)
 html_url = 'https://www.estateportal.co.za/about/index'
 # create a hash for a new mailing list.
 form = Hash.new

 form.merge!({:Username => USERNAME,
         :Password => PASSWORD,
         :Function => 'post_import_newsletter',
         :HtmlURL => html_url,
         :NewExisting => 'Existing',
         :ReplaceLinks => true,
         :NewsletterName => letter_name,
         :NewsletterID => quot;quot;,
         :ReplaceImages => true,
         :ReplaceLinks => false,
         :TextURL => quot;Noquot;
       })

 xml_data = Connector.setup_http_post(form)
xml_data.body
 end
 ##*** END MANAGE NEWS LETTER ****##


end

Contenu connexe

Similaire à dfhdf

The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageLovely Professional University
 
The Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsThe Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsVincent Chien
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivityMouli Chandira
 
Library Website
Library WebsiteLibrary Website
Library Websitegholtron
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Scriptccherubino
 
javaScriptForms.pptx
javaScriptForms.pptxjavaScriptForms.pptx
javaScriptForms.pptxMattMarino13
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
Form demoinplaywithmysql
Form demoinplaywithmysqlForm demoinplaywithmysql
Form demoinplaywithmysqlKnoldus Inc.
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”apostlion
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From IusethisMarcus Ramberg
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 
Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008Rob
 
Sending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHPSending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHPManuel Lemos
 
Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonSiddhi
 

Similaire à dfhdf (20)

Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
 
The Django Book - Chapter 7 forms
The Django Book - Chapter 7 formsThe Django Book - Chapter 7 forms
The Django Book - Chapter 7 forms
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
 
Framework
FrameworkFramework
Framework
 
Intro to sencha touch
Intro to sencha touchIntro to sencha touch
Intro to sencha touch
 
Library Website
Library WebsiteLibrary Website
Library Website
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Script
 
Opensocial Codelab
Opensocial CodelabOpensocial Codelab
Opensocial Codelab
 
javaScriptForms.pptx
javaScriptForms.pptxjavaScriptForms.pptx
javaScriptForms.pptx
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Form demoinplaywithmysql
Form demoinplaywithmysqlForm demoinplaywithmysql
Form demoinplaywithmysql
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008
 
Sending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHPSending E-mail that reaches the destination using PHP
Sending E-mail that reaches the destination using PHP
 
Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in Python
 
Sencha Touch Intro
Sencha Touch IntroSencha Touch Intro
Sencha Touch Intro
 

Dernier

Madhugiri Boucher Managed Farmland (knx)
Madhugiri Boucher Managed Farmland (knx)Madhugiri Boucher Managed Farmland (knx)
Madhugiri Boucher Managed Farmland (knx)knoxdigital1
 
Prestige Sancoale Goa Residneces Brochure.pdf
Prestige Sancoale Goa Residneces Brochure.pdfPrestige Sancoale Goa Residneces Brochure.pdf
Prestige Sancoale Goa Residneces Brochure.pdfkishor21012022
 
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...asmaqueen5
 
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait City
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait CityMtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait City
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait Cityahmedjiabur940
 
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...asmaqueen5
 
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)delhi24hrs1
 
Dynamic Grandeur Undri Pune | A Space For You To Find Your Space
Dynamic Grandeur Undri Pune | A Space For You To Find Your SpaceDynamic Grandeur Undri Pune | A Space For You To Find Your Space
Dynamic Grandeur Undri Pune | A Space For You To Find Your Spaceaidasheikh47
 
Housing Price Regulation Thesis Defense by Slidesgo.pptx
Housing Price Regulation Thesis Defense by Slidesgo.pptxHousing Price Regulation Thesis Defense by Slidesgo.pptx
Housing Price Regulation Thesis Defense by Slidesgo.pptxcosmo-soil
 
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...asmaqueen5
 
Eldeco Dwarka Project In Delhi-brochure.pdf.pdf
Eldeco Dwarka Project In Delhi-brochure.pdf.pdfEldeco Dwarka Project In Delhi-brochure.pdf.pdf
Eldeco Dwarka Project In Delhi-brochure.pdf.pdfkratirudram
 
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...asmaqueen5
 
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WI
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WIRetail Space for Lease - 1221 W. Main St., Sun Prairie, WI
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WILee & Associates of Madison, WI
 
Yashwin Enchante Uppar Kharadi Pune E-Brochue.pdf
Yashwin Enchante Uppar Kharadi Pune  E-Brochue.pdfYashwin Enchante Uppar Kharadi Pune  E-Brochue.pdf
Yashwin Enchante Uppar Kharadi Pune E-Brochue.pdfManishSaxena95
 
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)delhi24hrs1
 
Best Interior Design Services in Haldwani
Best Interior Design Services in HaldwaniBest Interior Design Services in Haldwani
Best Interior Design Services in HaldwaniGeomatrix
 
Ganga Platinum Kharadi Pune brochure.pdf
Ganga Platinum Kharadi Pune brochure.pdfGanga Platinum Kharadi Pune brochure.pdf
Ganga Platinum Kharadi Pune brochure.pdfsabhyara24
 
construction material procurement in India
construction material procurement in Indiaconstruction material procurement in India
construction material procurement in Indiarohanindosup
 
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...asmaqueen5
 
Kohinoor Courtyard One Wakad Pune | Elegant Living Spaces
Kohinoor Courtyard One Wakad Pune | Elegant Living SpacesKohinoor Courtyard One Wakad Pune | Elegant Living Spaces
Kohinoor Courtyard One Wakad Pune | Elegant Living Spacesaidasheikh47
 
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...asmaqueen5
 

Dernier (20)

Madhugiri Boucher Managed Farmland (knx)
Madhugiri Boucher Managed Farmland (knx)Madhugiri Boucher Managed Farmland (knx)
Madhugiri Boucher Managed Farmland (knx)
 
Prestige Sancoale Goa Residneces Brochure.pdf
Prestige Sancoale Goa Residneces Brochure.pdfPrestige Sancoale Goa Residneces Brochure.pdf
Prestige Sancoale Goa Residneces Brochure.pdf
 
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...
Call Girls In Sarai Rohilla ☎️8447779280{Sarai Rohilla Escort Service In Delh...
 
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait City
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait CityMtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait City
Mtp kit Available in Kuwait City +919101817206)) Get Mifty kit in Kuwait City
 
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...
Low Rate Call girls in Sant Nagar{Delhi }8447779280} Service Escorts In South...
 
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)
Low Rate ✨➥9711108085▻✨Call Girls In East Of Kailash (E.K) (Delhi)
 
Dynamic Grandeur Undri Pune | A Space For You To Find Your Space
Dynamic Grandeur Undri Pune | A Space For You To Find Your SpaceDynamic Grandeur Undri Pune | A Space For You To Find Your Space
Dynamic Grandeur Undri Pune | A Space For You To Find Your Space
 
Housing Price Regulation Thesis Defense by Slidesgo.pptx
Housing Price Regulation Thesis Defense by Slidesgo.pptxHousing Price Regulation Thesis Defense by Slidesgo.pptx
Housing Price Regulation Thesis Defense by Slidesgo.pptx
 
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...
Escort—>Call GiRls In Mori Gate Delhi —>8447779280—Service Escorts In South D...
 
Eldeco Dwarka Project In Delhi-brochure.pdf.pdf
Eldeco Dwarka Project In Delhi-brochure.pdf.pdfEldeco Dwarka Project In Delhi-brochure.pdf.pdf
Eldeco Dwarka Project In Delhi-brochure.pdf.pdf
 
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...
Call Girls in Maurice Nagar (Delhi) ꧁8447779280꧂ Female Escorts Service in De...
 
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WI
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WIRetail Space for Lease - 1221 W. Main St., Sun Prairie, WI
Retail Space for Lease - 1221 W. Main St., Sun Prairie, WI
 
Yashwin Enchante Uppar Kharadi Pune E-Brochue.pdf
Yashwin Enchante Uppar Kharadi Pune  E-Brochue.pdfYashwin Enchante Uppar Kharadi Pune  E-Brochue.pdf
Yashwin Enchante Uppar Kharadi Pune E-Brochue.pdf
 
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)
Low Rate ✨➥9582086666▻✨Call Girls In Gurgaon Sector 23 (Gurgaon)
 
Best Interior Design Services in Haldwani
Best Interior Design Services in HaldwaniBest Interior Design Services in Haldwani
Best Interior Design Services in Haldwani
 
Ganga Platinum Kharadi Pune brochure.pdf
Ganga Platinum Kharadi Pune brochure.pdfGanga Platinum Kharadi Pune brochure.pdf
Ganga Platinum Kharadi Pune brochure.pdf
 
construction material procurement in India
construction material procurement in Indiaconstruction material procurement in India
construction material procurement in India
 
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...
Low rate ↬Call girls in Sabzi Mandi Delhi | 8447779280}Escort Service In All ...
 
Kohinoor Courtyard One Wakad Pune | Elegant Living Spaces
Kohinoor Courtyard One Wakad Pune | Elegant Living SpacesKohinoor Courtyard One Wakad Pune | Elegant Living Spaces
Kohinoor Courtyard One Wakad Pune | Elegant Living Spaces
 
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...
Call girls in Shakti Nagar Delhi~8447779280°/=@/ Short 1500 Night 6000}ESCORT...
 

dfhdf

  • 1. require 'net/http' require 'uri' require 'rexml/document' # REQUIRED PARAMETERS. USERNAME = 'administrator@estateportal.co.za' PASSWORD = 'secretstory' URL_NAME = quot;http://www.graphicmail.co.za/api.aspx? Username=#{USERNAME}&Password=#{PASSWORD}quot; URL_NAME_POST = quot;http://www.graphicmail.co.za/api.aspx?quot; class GraphicMail # Connect to GraphicMail using HTTP post/get. class Connector def self.setup_http_get(func) xml_data = Net::HTTP.get(URI.parse(quot;#{URL_NAME}&Function=#{func}quot;)) end def self.setup_http_post(form) res = Net::HTTP.post_form(URI.parse(quot;#{URL_NAME_POST}quot;), form) end end ##*** MANAGE MAILING LIST ****## # Get mailinglists. def self.get_mailinglists xml_data = Connector.setup_http_get('get_mailinglists') ref = XmlSimple.xml_in(xml_data) data_array = ref[quot;mailinglistquot;] return data_array end # Get mailinglists. def self.get_mailinglist(id = '17836') xml_data = Connector.setup_http_get(quot;get_mailinglist&MailinglistID=#{id}quot;) ref = XmlSimple.xml_in(xml_data) data_array = ref[quot;emailquot;] return data_array end # Create mailinglists. def self.post_create_mailinglist(new_mailinglist = 'my mailing list') # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_create_mailinglist', :NewMailinglist => new_mailinglist }) xml_data = Connector.setup_http_post(form) xml_data.msg
  • 2. end # Delete Mailinglists. def self.post_delete_mailinglist(mailinglist_id = 123456) # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_delete_mailinglist', :MailinglistID => mailinglist_id }) xml_data = Connector.setup_http_post(form) xml_data.msg end # Delete Mailinglists. def self.post_rename_mailinglist(mailinglist_id = 123456, new_name = 'MyName') # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_rename_mailinglist', :MailinglistID => mailinglist_id, :NewName => new_name }) xml_data = Connector.setup_http_post(form) xml_data.msg end ##*** END MANAGE MAILING LIST ****## ##*** MANAGE NEWS LETTER ****## # Get mailinglists. def self.get_newsletter(id = '87341') xml_data = Connector.setup_http_get(quot;get_newsletter&NewsletterID=#{id}&TextVersion=falsequot;) # ref = XmlSimple.xml_in(xml_data) xml_data = xml_data.split(quot;rnquot;).join(quot;quot;) xml_data = xml_data.gsub(/quot;/,''') return xml_data end def self.get_newsletters() xml_data = Connector.setup_http_get(quot;get_newslettersquot;) # ref = XmlSimple.xml_in(xml_data) data_array = ref[quot;newsletterquot;] raise data_array.inspect return data_array
  • 3. end # Delete Newsletter. def self.post_delete_newsletter(newsletter_id = 123456) # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_delete_newsletter', :NewsletterID => newsletter_id }) xml_data = Connector.setup_http_post(form) xml_data.msg end # Create Newsletter. def self.post_import_newsletter(letter_name) html_url = 'https://www.estateportal.co.za/about/index' # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_import_newsletter', :HtmlURL => html_url, :NewExisting => 'New', :NewsletterName => letter_name, :NewsletterID => ' ' }) xml_data = Connector.setup_http_post(form) xml_data.body end # Create Newsletter. def self.post_update_newsletter(letter_name) html_url = 'https://www.estateportal.co.za/about/index' # create a hash for a new mailing list. form = Hash.new form.merge!({:Username => USERNAME, :Password => PASSWORD, :Function => 'post_import_newsletter', :HtmlURL => html_url, :NewExisting => 'Existing', :ReplaceLinks => true, :NewsletterName => letter_name, :NewsletterID => quot;quot;, :ReplaceImages => true, :ReplaceLinks => false, :TextURL => quot;Noquot; }) xml_data = Connector.setup_http_post(form)
  • 4. xml_data.body end ##*** END MANAGE NEWS LETTER ****## end