Skip to content

Commit

Permalink
Updating to a13, adding Faraday Caching
Browse files Browse the repository at this point in the history
  • Loading branch information
LightGuard committed Feb 5, 2014
1 parent 46dfa87 commit 9017271
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/aweplug/cache/yaml_file_cache.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'yaml/store'

module Aweplug
module Aweplug::Cache
# Public: A simple caching implementation.
# Internally it using a YAML::Store for a file backing. It also saves
# data in a hash for the life of the object. Any keys which are
Expand All @@ -14,7 +14,7 @@ class YamlFileCache
#
# Examples
#
# store = Aweplug::YamlFileCache.new
# store = Aweplug::Cache::YamlFileCache.new
# store.write('key', 'data')
# # => 'data'
# store.read('key')
Expand Down
2 changes: 2 additions & 0 deletions lib/aweplug/helpers/searchisko.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'faraday'
require 'faraday_middleware'
require 'aweplug/cache/yaml_file_cache'

module Aweplug::Helpers
# Public: A helper class for using Searchisko.
Expand Down Expand Up @@ -27,6 +28,7 @@ def initialize opts={}
end
builder.response :logger if opts[:logging]
builder.response :raise_error if opts[:raise_error]
builder.use FaradayMiddleware::Caching, Aweplug::Cache::YamlFileCache.new, {}
#builder.response :json, :content_type => /\bjson$/
builder.adapter opts[:adapter] || :net_http
end
Expand Down
2 changes: 1 addition & 1 deletion lib/aweplug/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Aweplug
VERSION='1.0.0.a12'
VERSION='1.0.0.a13'
end

4 changes: 2 additions & 2 deletions spec/aweplug/cache/yaml_file_cache_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'aweplug/cache/yaml_file_cache'

describe Aweplug::YamlFileCache do
describe Aweplug::Cache::YamlFileCache do
specify 'it should respond to #write' do
expect(subject).to respond_to :write
end
Expand All @@ -12,7 +12,7 @@
expect(subject).to respond_to :read
end
context 'with a new instance' do
subject = Aweplug::YamlFileCache.new
subject = Aweplug::Cache::YamlFileCache.new
# destroy any file stores
before { File.delete 'tmp/cache.store' if File.exists? 'tmp/cache.store' }

Expand Down

0 comments on commit 9017271

Please sign in to comment.