This file contains hidden or 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
# Method to send a message using Esendex's new RESTful | |
# API. | |
# | |
# Most people would think to use Builder to build | |
# the XML for this request. However, Builder seems to | |
# escape the XML in a way that Esendex doesn't under- | |
# stand. I will be asking them more about this | |
# later! | |
# | |
def send_using_esendex |
This file contains hidden or 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 'active_resource' | |
class TextMessage < ActiveResource::Base | |
self.site = "http://api.esendex.com/" | |
self.user = "[email protected]" | |
self.password = "XXX" | |
ESENDEX_API_REFERENCE = "XXX" | |
class << self |
This file contains hidden or 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
if registration? | |
if supports_automatic_registrations? | |
if contact_information_valid? | |
if registration_complete? | |
toggle!(:processed) | |
else | |
return false | |
end | |
else | |
... |
This file contains hidden or 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
raise ArgumentError, "Registration type is not 'registration'" unless registration? | |
raise ArgumentError, "TLD does not support automatic registrations" unless supports_automatic_registrations? | |
raise ArgumentError, "Contact information is invalid" unless contact_information_valid? | |
if registration_complete? | |
toggle!(:processed) | |
else | |
return false | |
end |
This file contains hidden or 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
raise ArgumentError, "Registration type is not 'registration'" unless registration? | |
raise ArgumentError, "TLD does not support automatic registrations" unless supports_automatic_registrations? | |
raise ArgumentError, "Contact information is invalid" unless contact_information_valid? | |
if registration_complete? | |
toggle!(:processed) | |
else | |
return false | |
end |
This file contains hidden or 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
# Changes the default date and time string formatters in Rails. See http://j.mp/2nZ022 and http://j.mp/1BRFSf for more info | |
# | |
# >> Time.now.to_s | |
# => "3rd Nov, 2009 10:54 PM GMT" | |
# >> Date.today.to_s | |
# => "3rd Nov, 2009" | |
Time::DATE_FORMATS[:default] = lambda { |time| time.strftime("#{time.day.ordinalize} %b, %Y %I:%M %p %Z") } | |
Date::DATE_FORMATS[:default] = lambda { |date| date.strftime("#{date.day.ordinalize} %b, %Y") } |
This file contains hidden or 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
@driver = SOAP::WSDLDriverFactory.new("http://www.webservice.com/services/order.wsdl").create_rpc_driver |
This file contains hidden or 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
@driver.GSDVOrder(:RequestID => 1) |
This file contains hidden or 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
@driver.return_response_as_xml = true | |
response = @driver.GSDVOrder(:RequestID => 1) | |
parsed_response = Hpricot::XML(response) |
This file contains hidden or 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
ActionController::Base.asset_host = Proc.new do |source| | |
# This will give you asset1-asset8.example.com | |
"http://assets#{rand(8) + 1}.example.com" | |
end |
OlderNewer