amazon_associate 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +8 -0
- data/.gitignore +2 -0
- data/.project +23 -0
- data/CHANGELOG +34 -0
- data/MIT-LICENSE +21 -0
- data/README.rdoc +120 -0
- data/Rakefile +43 -0
- data/VERSION.yml +4 -0
- data/amazon_associate.gemspec +67 -0
- data/lib/amazon_associate.rb +14 -0
- data/lib/amazon_associate/cache_factory.rb +31 -0
- data/lib/amazon_associate/caching_strategy.rb +2 -0
- data/lib/amazon_associate/caching_strategy/base.rb +22 -0
- data/lib/amazon_associate/caching_strategy/filesystem.rb +109 -0
- data/lib/amazon_associate/configuration_error.rb +4 -0
- data/lib/amazon_associate/element.rb +100 -0
- data/lib/amazon_associate/request.rb +354 -0
- data/lib/amazon_associate/request_error.rb +4 -0
- data/lib/amazon_associate/response.rb +74 -0
- data/test/amazon_associate/browse_node_lookup_test.rb +38 -0
- data/test/amazon_associate/cache_test.rb +33 -0
- data/test/amazon_associate/caching_strategy/filesystem_test.rb +193 -0
- data/test/amazon_associate/cart_test.rb +90 -0
- data/test/amazon_associate/request_test.rb +108 -0
- data/test/test_helper.rb +20 -0
- data/test/utilities/filesystem_test_helper.rb +31 -0
- metadata +86 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "test/unit"
|
3
|
+
require "shoulda"
|
4
|
+
require "mocha"
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__) , '..', 'lib'))
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__) , 'utilities'))
|
8
|
+
require "filesystem_test_helper"
|
9
|
+
require 'amazon_associate'
|
10
|
+
|
11
|
+
|
12
|
+
AmazonAssociate::Request.configure do |options|
|
13
|
+
options[:aWS_access_key_id] = ENV["AWS_ACCESS_KEY"] || ""
|
14
|
+
options[:secret_key] = ENV["AWS_SECRET_KEY"] || ""
|
15
|
+
|
16
|
+
#raise exception if user has not entered their access key
|
17
|
+
if options[:aWS_access_key_id] == ""
|
18
|
+
raise "Access key is not entered - enter an access key in test_helper.rb if you'd like to run tests"
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module FilesystemTestHelper
|
2
|
+
@@cache_path = File.dirname(__FILE__) + "/cache/"
|
3
|
+
|
4
|
+
protected
|
5
|
+
def get_valid_caching_options
|
6
|
+
#configure Amazon library for filesystem caching
|
7
|
+
AmazonAssociate::Request.configure do |options|
|
8
|
+
options[:caching_strategy] = :filesystem
|
9
|
+
options[:caching_options] = {:cache_path => @@cache_path}
|
10
|
+
options[:disk_quota] = 200
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def destroy_caching_options
|
15
|
+
#reset caching to off
|
16
|
+
AmazonAssociate::Request.configure do |options|
|
17
|
+
options[:caching_strategy] = nil
|
18
|
+
options[:caching_options] = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_cache_directory
|
23
|
+
#make the caching directory
|
24
|
+
FileUtils.makedirs(@@cache_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
def destroy_cache_directory
|
28
|
+
#remove all the cache files
|
29
|
+
FileUtils.rm_rf(@@cache_path)
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: amazon_associate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Pickett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-01 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: interfaces with Amazon Associate's API using Hpricot
|
17
|
+
email: dpickett@enlightsolutions.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- .autotest
|
26
|
+
- .gitignore
|
27
|
+
- .project
|
28
|
+
- CHANGELOG
|
29
|
+
- MIT-LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
- Rakefile
|
32
|
+
- VERSION.yml
|
33
|
+
- amazon_associate.gemspec
|
34
|
+
- lib/amazon_associate.rb
|
35
|
+
- lib/amazon_associate/cache_factory.rb
|
36
|
+
- lib/amazon_associate/caching_strategy.rb
|
37
|
+
- lib/amazon_associate/caching_strategy/base.rb
|
38
|
+
- lib/amazon_associate/caching_strategy/filesystem.rb
|
39
|
+
- lib/amazon_associate/configuration_error.rb
|
40
|
+
- lib/amazon_associate/element.rb
|
41
|
+
- lib/amazon_associate/request.rb
|
42
|
+
- lib/amazon_associate/request_error.rb
|
43
|
+
- lib/amazon_associate/response.rb
|
44
|
+
- test/amazon_associate/browse_node_lookup_test.rb
|
45
|
+
- test/amazon_associate/cache_test.rb
|
46
|
+
- test/amazon_associate/caching_strategy/filesystem_test.rb
|
47
|
+
- test/amazon_associate/cart_test.rb
|
48
|
+
- test/amazon_associate/request_test.rb
|
49
|
+
- test/test_helper.rb
|
50
|
+
- test/utilities/filesystem_test_helper.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://github.com/dpickett/amazon_associate
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --charset=UTF-8
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: "0"
|
65
|
+
version:
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: "0"
|
71
|
+
version:
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.5
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Amazon Associates API Interface using Hpricot
|
79
|
+
test_files:
|
80
|
+
- test/amazon_associate/browse_node_lookup_test.rb
|
81
|
+
- test/amazon_associate/cache_test.rb
|
82
|
+
- test/amazon_associate/caching_strategy/filesystem_test.rb
|
83
|
+
- test/amazon_associate/cart_test.rb
|
84
|
+
- test/amazon_associate/request_test.rb
|
85
|
+
- test/test_helper.rb
|
86
|
+
- test/utilities/filesystem_test_helper.rb
|