cloud_cache 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/cloud_cache.rb +12 -11
  2. metadata +1 -1
data/lib/cloud_cache.rb CHANGED
@@ -12,7 +12,7 @@ module ActiveSupport
12
12
 
13
13
  class CloudCache < Store
14
14
 
15
- VERSION = '1.0.0'
15
+ VERSION = '1.0.1'
16
16
 
17
17
  attr_accessor :secret_key
18
18
 
@@ -25,11 +25,11 @@ module ActiveSupport
25
25
 
26
26
  def run_http(http_method, command_name, command_path, body=nil, parameters=nil, extra_headers=nil)
27
27
  ts = generate_timestamp(Time.now.gmtime)
28
- puts 'timestamp = ' + ts
28
+ # puts 'timestamp = ' + ts
29
29
  sig = generate_signature("CloudCache", command_name, ts, @secret_key)
30
- puts "My signature = " + sig
30
+ # puts "My signature = " + sig
31
31
  url = "http://cloudcache.ws/" + command_path
32
- puts url
32
+ # puts url
33
33
 
34
34
  user_agent = "CloudCache Ruby Client"
35
35
  headers = {'User-Agent' => user_agent, 'signature' => sig, 'timestamp' => ts, 'akey' => @access_key}
@@ -61,15 +61,15 @@ module ActiveSupport
61
61
  headers.each_pair do |k, v|
62
62
  req[k] = v
63
63
  end
64
- req.each_header do |k, v|
65
- puts 'header ' + k + '=' + v
66
- end
64
+ # req.each_header do |k, v|
65
+ # puts 'header ' + k + '=' + v
66
+ #end
67
67
  res = Net::HTTP.start(uri.host, uri.port) do |http|
68
68
  http.request(req)
69
69
  end
70
70
  case res
71
71
  when Net::HTTPSuccess
72
- puts 'response body=' + res.body
72
+ # puts 'response body=' + res.body
73
73
  res.body
74
74
  else
75
75
  res.error!
@@ -85,7 +85,7 @@ module ActiveSupport
85
85
 
86
86
  def put(key, val, seconds_to_store=0)
87
87
  # seconds_to_store = seconds_to_store > 0 ? seconds_to_store : 9999999
88
- puts 'seconds=' + seconds_to_store.to_s
88
+ # puts 'seconds=' + seconds_to_store.to_s
89
89
  data = Marshal.dump(val)
90
90
  val_to_put = data #(Time.now+seconds_to_store).to_i.to_s + "::" + data
91
91
  extra_headers = seconds_to_store > 0 ? {"ttl"=>seconds_to_store} : nil
@@ -98,10 +98,11 @@ module ActiveSupport
98
98
  begin
99
99
  cache_entry = run_http(:get, "GET", key)
100
100
  rescue Net::HTTPServerException
101
- puts $!.message
101
+ # puts $!.message
102
102
  return nil if $!.message.include? "404"
103
+ raise $!
103
104
  end
104
- puts 'cache_entry=' + cache_entry
105
+ # puts 'cache_entry=' + cache_entry
105
106
  =begin
106
107
  index = cache_entry.index('::')
107
108
  puts 'index=' + index.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder