-
-
Save railsfactory-kumaresan/8011a4128d311a31578d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
class Webservice | |
CANDIDATE = <<XML | |
<Candidate xmlns="com.mysite/2010/10/10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> | |
<FirstName>%s</FirstName> | |
<LastName>%s</LastName> | |
<Email>%s</Email> | |
<Gender>%s</Gender> | |
</Candidate> | |
XML | |
include HTTParty | |
format :xml | |
base_uri 'mysite.com' | |
default_params :authorization => 'xxxxxxx' | |
def self.add_candidate(first_name,last_name,email,gender) | |
body = CANDIDATE % [first_name, last_name, email, gender] | |
post('/test.xml', :body => body) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment