dry_ice 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9273a2bb6141415b82d146159be9a17907afa204
4
+ data.tar.gz: 7476aeb02df739da3661694399d7a5f4b42e3e97
5
+ SHA512:
6
+ metadata.gz: c3f63662eefaee47e03a804a2c825f8525e6b8978a67419339285926bf808b7ca54d719cee8a28a2e6890e6928fec0e409c6d708f7629f786ddfc21118d0af46
7
+ data.tar.gz: 5a92cc885332b829846ea6e394813e0c13fbc8ed52f18e2d5295f5d9ab6d659986e7feeb2df5bfed554517f77d551d4d93055a9d369b753a7f542f250967b55e
data/History CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.1.1 2014-08-07
2
+
3
+ * Update httparty dependencey
4
+
5
+ == 0.1
6
+ * New fork: Dryice
7
+
8
+
1
9
  == 0.0.4 2012-01-03
2
10
  * minor enhancements
3
11
  * Update gemspec to depend on HTTParty 0.8.X to fix YAML issues.
@@ -10,7 +18,7 @@
10
18
  * minor enhancements
11
19
  * Return a cached result if network fails. [Andreas Garnæs]
12
20
 
13
- == 0.0.1
21
+ == 0.0.1
14
22
 
15
23
  * major enhancements
16
24
  * Initial release.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DryIce - Caching for HTTParty
2
2
 
3
- [![Code Climate](https://codeclimate.com/repos/5204fbf4c7f3a324e901d957/badges/4da6100b52ac17461549/gpa.png)](https://codeclimate.com/repos/5204fbf4c7f3a324e901d957/feed)
3
+ [![Code Climate](https://codeclimate.com/github/homeflow/dry_ice/badges/gpa.svg)](https://codeclimate.com/github/homeflow/dry_ice)
4
4
 
5
5
  ## Description
6
6
 
data/dry_ice.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Cache responses in HTTParty models}
14
14
  s.license = 'MIT'
15
15
 
16
- s.add_dependency("httparty", "~> 0.9.0")
16
+ s.add_dependency("httparty", "~> 0.13.1")
17
17
  s.add_dependency("msgpack")
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
@@ -1,5 +1,5 @@
1
1
  module Httparty
2
2
  module DryIce
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
data/lib/dry_ice.rb CHANGED
@@ -34,10 +34,10 @@ module HTTParty #:nodoc:
34
34
  # # Use your own cache store (see +AbstractStore+ class below)
35
35
  # cache :store => 'memcached', :timeout => 600, :server => '192.168.1.1:1001'
36
36
  #
37
- def cache(cache)
37
+ def cache(cache, options = {})
38
38
  return @cache = nil unless cache
39
39
  raise "cache instance must respond_to #read, #write and #delete" unless cache.respond_to?(:read) && cache.respond_to?(:write) && cache.respond_to?(:delete)
40
- @cache = IceCache.new(cache)
40
+ @cache = IceCache.new(cache, options)
41
41
  end
42
42
 
43
43
  def get_cache
@@ -102,7 +102,8 @@ module HTTParty #:nodoc:
102
102
 
103
103
  require 'msgpack'
104
104
 
105
- def initialize(cache)
105
+ def initialize(cache, options = {})
106
+ @options = {:serialize => true}.merge(options)
106
107
  @cache = cache
107
108
  end
108
109
 
@@ -115,12 +116,18 @@ module HTTParty #:nodoc:
115
116
  headers = response.headers.dup
116
117
  body = response.body.dup
117
118
  parsed_response = response.parsed_response
118
- [headers,body,parsed_response].to_msgpack
119
+ if @options[:serialize]
120
+ [headers,body,parsed_response].to_msgpack
121
+ else
122
+ [headers,body,parsed_response]
123
+ end
119
124
  end
120
125
 
121
126
  def build_response(serialized_response)
122
- res = MessagePack.unpack(serialized_response)
123
- CachedHTTPartyResponse.new(res[0], res[1], res[2])
127
+ if @options[:serialize]
128
+ serialized_response = MessagePack.unpack(serialized_response)
129
+ end
130
+ CachedHTTPartyResponse.new(serialized_response[0], serialized_response[1], serialized_response[2])
124
131
  end
125
132
 
126
133
  def read(*args)
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_ice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel Cooper
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.9.0
19
+ version: 0.13.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 0.9.0
26
+ version: 0.13.1
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: msgpack
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: Cache responses in HTTParty models
@@ -64,26 +59,25 @@ files:
64
59
  homepage: https://github.com/homeflow/dry_ice
65
60
  licenses:
66
61
  - MIT
62
+ metadata: {}
67
63
  post_install_message:
68
64
  rdoc_options: []
69
65
  require_paths:
70
66
  - lib
71
67
  required_ruby_version: !ruby/object:Gem::Requirement
72
- none: false
73
68
  requirements:
74
- - - ! '>='
69
+ - - '>='
75
70
  - !ruby/object:Gem::Version
76
71
  version: '0'
77
72
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
73
  requirements:
80
- - - ! '>='
74
+ - - '>='
81
75
  - !ruby/object:Gem::Version
82
76
  version: '0'
83
77
  requirements: []
84
78
  rubyforge_project:
85
- rubygems_version: 1.8.24
79
+ rubygems_version: 2.2.2
86
80
  signing_key:
87
- specification_version: 3
81
+ specification_version: 4
88
82
  summary: Caching for HTTParty
89
83
  test_files: []