snapshot-ruby 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/snapshot.rb CHANGED
@@ -17,15 +17,15 @@ module Snapshot
17
17
  # ==== Examples
18
18
  #
19
19
  # # Using a String:
20
- # Snapshot.configure('http://access_key:secret_ket@subdomain.snapshothq.com/')
20
+ # Snapshot.configure('http://access_key:secret_ket@subdomain.snapshotapi.com/')
21
21
  #
22
22
  # # Using a Hash:
23
- # Snapshot.configure(:access_key => 'access_key', :domain => 'subdomain.snapshothq.com', :secret_key => 'secret_key')
23
+ # Snapshot.configure(:access_key => 'access_key', :container => 'subdomain', :secret_key => 'secret_key')
24
24
  #
25
25
  # # Using a block:
26
26
  # Snapshot.configure do |config|
27
27
  # config.access_key = 'access_key'
28
- # config.domain = 'subdomain.snapshothq.com'
28
+ # config.container = 'subdomain'
29
29
  # config.secret_key = 'secret_key
30
30
  # end
31
31
  #
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Snapshot
8
8
  class Connection
9
- attr_accessor :access_key, :domain, :secret_key
9
+ attr_accessor :access_key, :container, :secret_key
10
10
 
11
11
  # Creates a new Connection object.
12
12
  #
@@ -21,8 +21,8 @@ module Snapshot
21
21
  end
22
22
  else
23
23
  uri = URI.parse(opts)
24
- self.access_key, self.domain, self.secret_key = uri.user, uri.host, uri.password
25
- self.domain << ":#{uri.port}" unless uri.port == 80
24
+ self.container = uri.host.match(/(.+)\.snapshotapi\.com/)[1]
25
+ self.access_key, self.secret_key = uri.user, uri.password
26
26
  end
27
27
  end
28
28
 
@@ -41,7 +41,7 @@ module Snapshot
41
41
  # Returns a URL to Snapshot for the connection
42
42
  #
43
43
  def url
44
- "http://#{domain}"
44
+ "http://#{container}.snapshotapi.com"
45
45
  end
46
46
 
47
47
  private
@@ -15,5 +15,14 @@ module Snapshot
15
15
  def to_s
16
16
  token
17
17
  end
18
+
19
+ # Allow the Token object to be serialized by Rails.
20
+ if defined?(ActiveModel::Serialization)
21
+ include ActiveModel::Serialization
22
+
23
+ def attributes
24
+ { expires_in: expires_in, token: token }
25
+ end
26
+ end
18
27
  end
19
28
  end
@@ -1,3 +1,3 @@
1
1
  module Snapshot
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: