kmayer-highrise 0.8.1 → 0.9.0

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/README.mkdn CHANGED
@@ -1,10 +1,8 @@
1
- # Highrise (0.8.0)
1
+ # Highrise (0.9.0)
2
2
 
3
- ## What
3
+ ## What is it?
4
4
 
5
- [Highrise][h] is a gem that provides an easy way to use the [Highrise API][api].
6
-
7
- This gem provides a set of classes to access available information on [Highrise][h].
5
+ This gem provides a set of classes to access information on [Highrise][h] via the published [API][api]
8
6
 
9
7
  These are the list of classes:
10
8
 
@@ -16,14 +14,14 @@ All these classes are inherited of ActiveResouce::Base. For more informations se
16
14
 
17
15
  gem install kmayer-highrise
18
16
 
19
- ## Dependencies
17
+ ### Dependencies
20
18
 
21
19
  * ActiveResorce >= 2.2.2
22
20
  * ActiveSupport >= 2.1
23
21
  * Curb
24
22
  * Hpricot
25
23
 
26
- ## Configure your key.
24
+ ### Configure your key
27
25
 
28
26
  require 'rubygems'
29
27
  require 'highrise'
@@ -35,7 +33,7 @@ or
35
33
  Highrise::Base.site = 'http://your_site.highrisehq.com'
36
34
  Highrise::Base.user = 'api-auth-token'
37
35
 
38
- and, if you want caching(!)
36
+ and, if you want [caching][c]:
39
37
 
40
38
  Highrise::Base.connection.cache_store= <your normal ActiveSupport::Caching options>
41
39
 
@@ -69,18 +67,19 @@ Comments are welcome. Send your feedback through the [issue tracker on GitHub][i
69
67
  [How to Cache Anything With ActiveSupport][rh] on the very *day* I started writing the cache code. Thank you, Rein
70
68
  for writing an excellent tutorial and [posting your source][e] on GitHub.
71
69
 
70
+ [api]: http://developer.37signals.com/highrise
72
71
  [ar]: http://api.rubyonrails.org/classes/ActiveResource/Base.html
73
- [mt]: http://www.improveit.com.br/en/company/tapajos
74
- [ii]: http://www.improveit.com.br/en
72
+ [c]: http://api.rubyonrails.org/classes/ActiveSupport/Cache
75
73
  [co]: http://github.com/kmayer
76
- [mit]:http://www.opensource.org/licenses/mit-license.php
74
+ [e]: http://github.com/primedia/endeca/tree/master
77
75
  [h]: http://www.highrisehq.com/
78
76
  [i]: http://github.com/kmayer/highrise/issues
77
+ [ii]: http://www.improveit.com.br/en
79
78
  [km]: http://github.com/kmayer
80
79
  [lg]: http://github.com/luisbebop
80
+ [mit]:http://www.opensource.org/licenses/mit-license.php
81
+ [mt]: http://www.improveit.com.br/en/company/tapajos
81
82
  [nb]: http://github.com/slainer86
82
- [tl]: http://github.com/ThiagoLelis
83
- [api]: http://developer.37signals.com/highrise
84
83
  [re]: http://www.railsenvy.com/2009/4/29/rails-envy-podcast-episode-077-04-29-2009
85
84
  [rh]: http://reinh.com/blog/2009/04/27/how-to-cache-anything-with-activesupport.html
86
- [e]: http://github.com/primedia/endeca/tree/master
85
+ [tl]: http://github.com/ThiagoLelis
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 0
3
3
  :major: 0
4
- :minor: 8
4
+ :minor: 9
data/lib/cachable.rb CHANGED
@@ -6,7 +6,7 @@ require 'digest/sha1'
6
6
  #
7
7
  # == Usage
8
8
  #
9
- # require 'lib/cachable'
9
+ # require 'cachable'
10
10
  #
11
11
  # module CachedResource
12
12
  # class Base < ActiveResource::Base
@@ -16,7 +16,7 @@ require 'digest/sha1'
16
16
  #
17
17
  # == Caching stores
18
18
  #
19
- # All the caching stores from ActiveSupport::Cache are available to be used
19
+ # All the caching stores from ActiveSupport::Cache are available
20
20
  # as backends for caching. See the Rails rdoc for more information on
21
21
  # these stores
22
22
  #
@@ -28,7 +28,9 @@ require 'digest/sha1'
28
28
  # CachedResource.connection.cache_store = :mem_cache_store, "localhost"
29
29
  # CachedResource.connection.cache_store = MyOwnStore.new("parameter")
30
30
  #
31
- # Note: To ensure that caching is turned off, set CachedResource.connection.cache_store = nil
31
+ # Note: To ensure that caching is turned off, set CachedResource.connection.cache_store = :none
32
+ #
33
+ # FYI: You can use this with *any* active resource interface, not just Highrise.
32
34
 
33
35
  module Cachable
34
36
  def self.included(base)
@@ -39,8 +41,19 @@ module Cachable
39
41
  @cache_store ||= nil
40
42
  end
41
43
 
42
- def cache_store=(store_option)
43
- @cache_store = store_option.nil? ? nil : ActiveSupport::Cache.lookup_store(store_option)
44
+ # Wrapper for lookup_store, with a couple of special options:
45
+ # Passing +:none+ will turn off caching
46
+ # Passing +:rails+ will use the default Rails/AS cache (whatever it happens to be)
47
+ # Passing no args or nil will return the default cache from AS
48
+ def cache_store=(*store_option)
49
+ @cache_store = case store_option
50
+ when [:none]
51
+ nil
52
+ when [:rails]
53
+ Rails.cache rescue ActiveSupport::Cache.lookup_store
54
+ else
55
+ ActiveSupport::Cache.lookup_store(*store_option)
56
+ end
44
57
  end
45
58
 
46
59
  def is_caching?
@@ -12,9 +12,14 @@ describe Highrise::Base, "class configuration" do
12
12
  end
13
13
 
14
14
  it "should tell us if caching is not active" do
15
- @connection.cache_store = nil
15
+ @connection.cache_store = :none
16
16
  @connection.is_caching?.should == false
17
17
  end
18
+
19
+ it "should use the Rails stack default cache" do
20
+ @connection.cache_store = :rails
21
+ @connection.is_caching?.should == true
22
+ end
18
23
  end
19
24
 
20
25
  describe Highrise::Base do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kmayer-highrise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Marcos Tapaj\xC3\xB3s"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-01 00:00:00 -07:00
13
+ date: 2009-05-04 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency