cuba-api 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.
Files changed (2) hide show
  1. data/lib/cuba_api/utils.rb +9 -5
  2. metadata +2 -2
@@ -27,7 +27,7 @@ module CubaApi
27
27
  end
28
28
 
29
29
  def last_modified( last )
30
- res[ 'Last-Modified' ] = last.rfc2822
30
+ res[ 'Last-Modified' ] = rfc2616( last )
31
31
  end
32
32
 
33
33
  def modified_since
@@ -39,12 +39,12 @@ module CubaApi
39
39
 
40
40
  def expires_in( minutes )
41
41
  now = DateTime.now
42
- res[ 'Date' ] = now.rfc2822
43
- res[ 'Expires' ] = ( now + minutes / 1440.0 ).rfc2822
42
+ res[ 'Date' ] = rfc2616( now )
43
+ res[ 'Expires' ] = rfc2616( now + minutes / 1440.0 )
44
44
  end
45
45
 
46
46
  def browser_only_cache
47
- res[ 'Date' ] = DateTime.now.rfc2822
47
+ res[ 'Date' ] = rfc2616
48
48
  res[ 'Expires' ] = "Fri, 01 Jan 1990 00:00:00 GMT"
49
49
  res[ 'Cache-Control' ] = "private, max-age=0, must-revalidate"
50
50
  end
@@ -60,7 +60,7 @@ module CubaApi
60
60
  end
61
61
 
62
62
  def no_cache
63
- res["Date"] = Time.now.rfc2822
63
+ res["Date"] = rfc2616
64
64
  res["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
65
65
  res["Pragma"] = "no-cache"
66
66
  res["Cache-Control"] = "no-cache, must-revalidate"
@@ -69,5 +69,9 @@ module CubaApi
69
69
  def content_type( mime )
70
70
  res[ 'Content-Type' ] = mime if mime
71
71
  end
72
+
73
+ def rfc2616( time = DateTime.now )
74
+ time.to_time.utc.rfc2822.sub( /.....$/, 'GMT')
75
+ end
72
76
  end
73
77
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: cuba-api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Meier
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cuba