Skip to content

Commit

Permalink
Updated the gem requirements and added a server offset
Browse files Browse the repository at this point in the history
  • Loading branch information
threestage committed Oct 26, 2010
1 parent e3639f6 commit fe8e520
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
5 changes: 3 additions & 2 deletions lib/yourls/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ module Yourls
class Client
include HTTParty

def initialize(host, api_key)
def initialize(host, api_key, options = {})
@host, @api_key = host, api_key
@base_uri = File.join(host, 'yourls-api.php')
@server_offset = options[:offset] || 0.seconds
end

def stats(options = {})
Expand All @@ -24,7 +25,7 @@ def shorten(long_url, options = {})

def get(action, query = {})
# Prepare the signature
timestamp = Time.now.to_i
timestamp = (Time.now + @server_offset).to_i
signature = Digest::MD5.hexdigest(timestamp.to_s + @api_key)

query ||= {}
Expand Down
4 changes: 2 additions & 2 deletions lib/yourls/yourls.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Yourls
def self.new(host, api_key)
Yourls::Client.new(host, api_key)
def self.new(host, api_key, options = {})
Yourls::Client.new(host, api_key, options)
end
end

Expand Down
12 changes: 6 additions & 6 deletions yourls.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Gem::Specification.new do |s|
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<crack>, [">= 0.1.4"])
s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
s.add_runtime_dependency(%q<crack>, [">= 0.1.8"])
s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
else
s.add_dependency(%q<crack>, [">= 0.1.4"])
s.add_dependency(%q<httparty>, [">= 0.5.2"])
s.add_dependency(%q<crack>, [">= 0.1.8"])
s.add_dependency(%q<httparty>, [">= 0.6.1"])
end
else
s.add_dependency(%q<crack>, [">= 0.1.4"])
s.add_dependency(%q<httparty>, [">= 0.5.2"])
s.add_dependency(%q<crack>, [">= 0.1.8"])
s.add_dependency(%q<httparty>, [">= 0.6.1"])
end
end

0 comments on commit fe8e520

Please sign in to comment.