Browse files

Switch to container.

  • Loading branch information...
1 parent 2c8ae80 commit 602af18f9ca8ed0c04687dba25f33983c07ee750 @jeremyboles committed Jan 29, 2013
Showing with 7 additions and 7 deletions.
  1. +3 −3 lib/snapshot.rb
  2. +4 −4 lib/snapshot/connection.rb
View
6 lib/snapshot.rb
@@ -17,15 +17,15 @@ module Snapshot
# ==== Examples
#
# # Using a String:
- # Snapshot.configure('http://access_key:secret_ket@subdomain.snapshothq.com/')
+ # Snapshot.configure('http://access_key:secret_ket@subdomain.snapshotapi.com/')
#
# # Using a Hash:
- # Snapshot.configure(:access_key => 'access_key', :domain => 'subdomain.snapshothq.com', :secret_key => 'secret_key')
+ # Snapshot.configure(:access_key => 'access_key', :container => 'subdomain', :secret_key => 'secret_key')
#
# # Using a block:
# Snapshot.configure do |config|
# config.access_key = 'access_key'
- # config.domain = 'subdomain.snapshothq.com'
+ # config.container = 'subdomain'
# config.secret_key = 'secret_key
# end
#
View
8 lib/snapshot/connection.rb
@@ -6,7 +6,7 @@
module Snapshot
class Connection
- attr_accessor :access_key, :domain, :secret_key
+ attr_accessor :access_key, :container, :secret_key
# Creates a new Connection object.
#
@@ -21,8 +21,8 @@ def initialize(opts={})
end
else
uri = URI.parse(opts)
- self.access_key, self.domain, self.secret_key = uri.user, uri.host, uri.password
- self.domain << ":#{uri.port}" unless uri.port == 80
+ self.container = uri.host.match(/(.+)\.snapshotapi\.com/)[1]
+ self.access_key, self.secret_key = uri.user, uri.password
end
end
@@ -41,7 +41,7 @@ def post(path, payload={})
# Returns a URL to Snapshot for the connection
#
def url
- "http://#{domain}"
+ "http://#{container}.snapshotapi.com"
end
private

0 comments on commit 602af18

Please sign in to comment.