Class: Akamai::Connection
- Inherits:
-
Object
- Object
- Akamai::Connection
- Defined in:
- lib/akamai/connection.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #driver ⇒ Object
-
#initialize(args = {}) ⇒ Connection
constructor
A new instance of Connection.
- #purge(*urls) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Connection
Returns a new instance of Connection.
7 8 9 |
# File 'lib/akamai/connection.rb', line 7 def initialize(args = {}) @config = args.kind_of?(Configuration) ? args : Configuration.new(args) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/akamai/connection.rb', line 5 def config @config end |
Instance Method Details
#driver ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/akamai/connection.rb', line 11 def driver return @driver if @driver @driver = SOAP::WSDLDriverFactory.new(config.wsdl_url).create_rpc_driver @driver.['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE @driver.["protocol.http.basic_auth"] << [config.wsdl_url, config.cachecontrol_username, config.cachecontrol_password] @driver end |
#purge(*urls) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/akamai/connection.rb', line 20 def purge(*urls) opts = ["domain=#{config.cachecontrol_domain}", "action=#{config.cachecontrol_purge_action}"] opts << "email-notification=#{config.cachecontrol_email_notification}" if config.cachecontrol_email_notification result = driver.purgeRequest(config.cachecontrol_username, config.cachecontrol_password, '', opts, urls) raise PurgeError, result.inspect unless result.resultCode == '100' true end |