blingee 0.0.1
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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +29 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/blingee.gemspec +76 -0
- data/lib/blingee.rb +25 -0
- data/lib/blingee/api.rb +62 -0
- data/lib/blingee/collection.rb +15 -0
- data/lib/blingee/entry.rb +29 -0
- data/lib/blingee/exceptions.rb +34 -0
- data/lib/blingee/image.rb +19 -0
- data/lib/blingee/instance.rb +36 -0
- data/test/fixtures/errors.yml +11 -0
- data/test/fixtures/search.yml +11 -0
- data/test/helper.rb +53 -0
- data/test/integration/test_exceptions.rb +25 -0
- data/test/integration/test_search.rb +49 -0
- metadata +125 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Nathaniel Bibler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
= Blingee
|
2
|
+
|
3
|
+
This library provides a simple interface to the Blingee.com API. To utilize
|
4
|
+
the API, you'll have to have an API user identifier and secret. Getting those
|
5
|
+
credentials is entirely on you.
|
6
|
+
|
7
|
+
== Searching Blingee
|
8
|
+
|
9
|
+
You may search Blingee by tags. If, for example, you'd like to search for
|
10
|
+
Miley Cyrus pictures:
|
11
|
+
|
12
|
+
blingee = Blingee.new(:user_id => 500, :secret => 'SECRET')
|
13
|
+
result = blingee.tag_search('miley,cyrus,miley cyrus')
|
14
|
+
# => Blingee::Collection of Blingee::Entry instances
|
15
|
+
|
16
|
+
== Note on Patches/Pull Requests
|
17
|
+
|
18
|
+
* Fork the project.
|
19
|
+
* Make your feature addition or bug fix.
|
20
|
+
* Add tests for it. This is important so I don't break it in a
|
21
|
+
future version unintentionally.
|
22
|
+
* Commit, do not mess with rakefile, version, or history.
|
23
|
+
(if you want to have your own version, that is fine but
|
24
|
+
bump version in a commit by itself I can ignore when I pull)
|
25
|
+
* Send me a pull request. Bonus points for topic branches.
|
26
|
+
|
27
|
+
== Copyright
|
28
|
+
|
29
|
+
Copyright (c) 2009 Nathaniel Bibler. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "blingee"
|
8
|
+
gem.summary = %Q{A Ruby interface to the Blingee.com API}
|
9
|
+
gem.description = %Q{blingee is a Ruby interface to the Blingee.com API.}
|
10
|
+
gem.email = "gem@nathanielbibler.com"
|
11
|
+
gem.homepage = "http://github.com/nbibler/blingee"
|
12
|
+
gem.authors = ["Nathaniel Bibler"]
|
13
|
+
|
14
|
+
gem.add_dependency('relax', ">= 0.1.3")
|
15
|
+
gem.add_dependency('activesupport', ">= 0")
|
16
|
+
|
17
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
18
|
+
gem.add_development_dependency "fakeweb", ">= 0"
|
19
|
+
gem.add_development_dependency "mocha", ">= 0"
|
20
|
+
end
|
21
|
+
Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rake/testtask'
|
27
|
+
Rake::TestTask.new(:test) do |test|
|
28
|
+
test.libs << 'lib' << 'test'
|
29
|
+
test.pattern = 'test/**/test_*.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
require 'rcov/rcovtask'
|
35
|
+
Rcov::RcovTask.new do |test|
|
36
|
+
test.libs << 'test'
|
37
|
+
test.pattern = 'test/**/test_*.rb'
|
38
|
+
test.verbose = true
|
39
|
+
end
|
40
|
+
rescue LoadError
|
41
|
+
task :rcov do
|
42
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
task :test => :check_dependencies
|
47
|
+
|
48
|
+
task :default => :test
|
49
|
+
|
50
|
+
require 'rake/rdoctask'
|
51
|
+
Rake::RDocTask.new do |rdoc|
|
52
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
53
|
+
|
54
|
+
rdoc.rdoc_dir = 'rdoc'
|
55
|
+
rdoc.title = "blingee #{version}"
|
56
|
+
rdoc.main = "README.rdoc"
|
57
|
+
rdoc.rdoc_files.include('README*')
|
58
|
+
rdoc.rdoc_files.include('LICENSE*')
|
59
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
60
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/blingee.gemspec
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{blingee}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Nathaniel Bibler"]
|
12
|
+
s.date = %q{2009-10-22}
|
13
|
+
s.description = %q{blingee is a Ruby interface to the Blingee.com API.}
|
14
|
+
s.email = %q{gem@nathanielbibler.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"blingee.gemspec",
|
27
|
+
"lib/blingee.rb",
|
28
|
+
"lib/blingee/api.rb",
|
29
|
+
"lib/blingee/collection.rb",
|
30
|
+
"lib/blingee/entry.rb",
|
31
|
+
"lib/blingee/exceptions.rb",
|
32
|
+
"lib/blingee/image.rb",
|
33
|
+
"lib/blingee/instance.rb",
|
34
|
+
"test/fixtures/errors.yml",
|
35
|
+
"test/fixtures/search.yml",
|
36
|
+
"test/helper.rb",
|
37
|
+
"test/integration/test_exceptions.rb",
|
38
|
+
"test/integration/test_search.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/nbibler/blingee}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.5}
|
44
|
+
s.summary = %q{A Ruby interface to the Blingee.com API}
|
45
|
+
s.test_files = [
|
46
|
+
"test/helper.rb",
|
47
|
+
"test/integration/test_exceptions.rb",
|
48
|
+
"test/integration/test_search.rb"
|
49
|
+
]
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_runtime_dependency(%q<relax>, [">= 0.1.3"])
|
57
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<relax>, [">= 0.1.3"])
|
63
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
64
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
65
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
66
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<relax>, [">= 0.1.3"])
|
70
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
71
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
72
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
73
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
data/lib/blingee.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
require 'activesupport'
|
4
|
+
require 'relax'
|
5
|
+
require 'blingee/exceptions'
|
6
|
+
require 'blingee/api'
|
7
|
+
require 'blingee/instance'
|
8
|
+
require 'blingee/collection'
|
9
|
+
require 'blingee/entry'
|
10
|
+
require 'blingee/image'
|
11
|
+
|
12
|
+
module Blingee
|
13
|
+
|
14
|
+
mattr_accessor :user_id
|
15
|
+
mattr_accessor :secret
|
16
|
+
|
17
|
+
##
|
18
|
+
# Create a new Blingee::Instance. You must either pass in a user_id and
|
19
|
+
# secret or define a Blingee.user_id and Blingee.secret.
|
20
|
+
#
|
21
|
+
def self.new(options = {})
|
22
|
+
Blingee::Instance.new({:user_id => @@user_id, :secret => @@secret}.merge(options))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/blingee/api.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
module Blingee
|
4
|
+
|
5
|
+
class API < Relax::Service # :nodoc:all
|
6
|
+
|
7
|
+
def self.generate_signature(parameters, secret)
|
8
|
+
Digest::MD5.hexdigest(parameters.
|
9
|
+
sort { |a,b| a.to_s <=> b.to_s }.
|
10
|
+
map { |k,v| k.to_s + '=' + (v.to_s || '') }.
|
11
|
+
concat([secret]).
|
12
|
+
join('&'))
|
13
|
+
end
|
14
|
+
|
15
|
+
def request(&block)
|
16
|
+
begin
|
17
|
+
yield
|
18
|
+
rescue RestClient::RequestTimeout
|
19
|
+
raise Blingee::ConnectionError.from_exception($!)
|
20
|
+
rescue RestClient::RequestFailed
|
21
|
+
case $!.http_code
|
22
|
+
when 403
|
23
|
+
raise Blingee::AuthenticationFailure.from_exception_with_response($!, $!.response)
|
24
|
+
else
|
25
|
+
raise Blingee::ErrorWithResponse.from_exception_with_response($!, $!.response)
|
26
|
+
end
|
27
|
+
rescue
|
28
|
+
raise Blingee::Error.from_exception($!)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
defaults do
|
33
|
+
parameter :api_user_id, :required => true
|
34
|
+
parameter :api_timestamp, :required => true
|
35
|
+
parameter :api_signature, :required => true
|
36
|
+
end
|
37
|
+
|
38
|
+
endpoint 'http://blingee.com/api' do
|
39
|
+
|
40
|
+
action :search, :url => '/blingee_search' do
|
41
|
+
parameter :tags
|
42
|
+
|
43
|
+
parser :blingees do
|
44
|
+
elements :blingee do
|
45
|
+
attribute :id
|
46
|
+
attribute :name
|
47
|
+
attribute :display_url
|
48
|
+
|
49
|
+
elements :image, :as => :images do
|
50
|
+
attribute :width
|
51
|
+
attribute :height
|
52
|
+
attribute :url
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Blingee
|
2
|
+
|
3
|
+
##
|
4
|
+
# Simple collection, generally holding several instances of Blingee::Entry.
|
5
|
+
#
|
6
|
+
class Collection < Array
|
7
|
+
|
8
|
+
def self.from_hash(blingee_hash_array)
|
9
|
+
blingee_hash_array = [blingee_hash_array].compact unless blingee_hash_array.kind_of?(Array)
|
10
|
+
new(blingee_hash_array.collect { |attributes| Blingee::Entry.new(attributes) })
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Blingee
|
2
|
+
|
3
|
+
##
|
4
|
+
# An entry contains details and Blingee::Image instances for a single entry
|
5
|
+
# found on Blingee.com.
|
6
|
+
#
|
7
|
+
class Entry
|
8
|
+
|
9
|
+
attr_reader :name, :display_url, :id, :images
|
10
|
+
|
11
|
+
def initialize(attributes = {})
|
12
|
+
@display_url = attributes[:display_url]
|
13
|
+
@id = attributes[:id].to_i
|
14
|
+
@images = collect_images(attributes[:images])
|
15
|
+
@name = attributes[:name]
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
|
22
|
+
def collect_images(images)
|
23
|
+
images = [images].compact unless images.kind_of?(Array)
|
24
|
+
images.collect { |attributes| Blingee::Image.new(attributes) }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Blingee
|
2
|
+
|
3
|
+
class Error < RuntimeError
|
4
|
+
|
5
|
+
def self.from_exception(e)
|
6
|
+
new("#{e.class.name}: #{e.message}").tap do |exception|
|
7
|
+
exception.set_backtrace(e.backtrace)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class ErrorWithResponse < Error
|
14
|
+
attr_accessor :response
|
15
|
+
|
16
|
+
def self.from_exception_with_response(e, response)
|
17
|
+
from_exception(e).tap do |exception|
|
18
|
+
exception.response = response
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def http_code
|
23
|
+
response.code.to_i if response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#:stopdoc:
|
28
|
+
|
29
|
+
class ConnectionError < Error; end
|
30
|
+
class AuthenticationFailure < ErrorWithResponse; end
|
31
|
+
|
32
|
+
#:startdoc:
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Blingee
|
2
|
+
|
3
|
+
##
|
4
|
+
# Simple container for holding the attributes of an image (height, width,
|
5
|
+
# and url).
|
6
|
+
#
|
7
|
+
class Image
|
8
|
+
|
9
|
+
attr_reader :width, :height, :url
|
10
|
+
|
11
|
+
def initialize(attributes = {})
|
12
|
+
@height = attributes[:height].to_i
|
13
|
+
@url = attributes[:url]
|
14
|
+
@width = attributes[:width].to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Blingee
|
2
|
+
|
3
|
+
class Instance
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
options = HashWithIndifferentAccess.new(options)
|
7
|
+
@user_id = options[:user_id] || raise(ArgumentError, "Blingee user_id is required")
|
8
|
+
@secret = options[:secret] || raise(ArgumentError, "Blingee secret is required")
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# Search Blingee for graphics matching the given tags.
|
13
|
+
#
|
14
|
+
# blingee.search('miley,cyrus,myley cyrus')
|
15
|
+
# blingee.search(['miley','cyrus','myley cyrus'])
|
16
|
+
#
|
17
|
+
def tag_search(tags = '')
|
18
|
+
tags = tags.join(',') if tags.respond_to?(:join)
|
19
|
+
objectize(api.request { api.search(:tags => tags, :api_timestamp => Time.now.to_i, :api_signature => API.generate_signature({:api_user_id => @user_id, :tags => tags, :api_timestamp => Time.now.to_i}, @secret)) })
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
|
26
|
+
def api
|
27
|
+
@api ||= API.new(:api_user_id => @user_id)
|
28
|
+
end
|
29
|
+
|
30
|
+
def objectize(hash)
|
31
|
+
Blingee::Collection.from_hash(hash[:blingee])
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
authentication: |
|
2
|
+
HTTP/1.1 403 Forbidden
|
3
|
+
Connection: close
|
4
|
+
Date: Thu, 22 Oct 2009 20:03:10 GMT
|
5
|
+
Status: 403
|
6
|
+
Cache-Control: no-cache
|
7
|
+
Server: Mongrel 1.1.5
|
8
|
+
Content-Type: application/xml
|
9
|
+
Content-Length: 111
|
10
|
+
|
11
|
+
<?xml version='1.0' encoding='utf-8'?><error error_code="403" ><message >authentication error</message></error>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
success: |
|
2
|
+
HTTP/1.1 200 OK
|
3
|
+
Connection: close
|
4
|
+
Date: Thu, 22 Oct 2009 15:48:56 GMT
|
5
|
+
Status: 200 OK
|
6
|
+
Cache-Control: no-cache
|
7
|
+
Server: Mongrel 1.1.5
|
8
|
+
Content-Type: application/xml
|
9
|
+
Content-Length: 27139
|
10
|
+
|
11
|
+
<?xml version='1.0' encoding='utf-8'?><blingees ><blingee id="101008713" name="Miley Cyrus im Regen :-)" display_url="http://blingee.com/blingee/view/101008713-Miley-Cyrus-im-Regen-" ><images ><image width="160" height="120" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304266_1027459.gif" ></image><image width="280" height="210" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304267_83838.gif" ></image><image width="400" height="300" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304268_333059.gif" ></image></images></blingee><blingee id="101007775" name="Miley Cyrus Party in the U S A" display_url="http://blingee.com/blingee/view/101007775-Miley-Cyrus-Party-in-the-U-S-A" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513296706_517140.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513296707_441635.gif" ></image><image width="390" height="390" url="http://image.blingee.com/images17/content/output/000/000/000/605/513296708_97260.gif" ></image></images></blingee><blingee id="101004450" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/101004450-Miley-Cyrus" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/531989760_1951404.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/531989761_1272804.gif" ></image><image width="390" height="390" url="http://image.blingee.com/images17/content/output/000/000/000/605/531989762_1105072.gif" ></image></images></blingee><blingee id="100999843" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/100999843-Miley-Cyrus" ><images ><image width="280" height="137" url="http://image.blingee.com/images17/content/output/000/000/000/605/513236903_715369.gif" ></image><image width="400" height="196" url="http://image.blingee.com/images17/content/output/000/000/000/605/513236904_647716.gif" ></image></images></blingee><blingee id="100999297" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/100999297-Miley-Cyrus" ><images ><image width="280" height="137" url="http://image.blingee.com/images17/content/output/000/000/000/605/513232938_359777.gif" ></image><image width="400" height="196" url="http://image.blingee.com/images17/content/output/000/000/000/605/513232939_679600.gif" ></image></images></blingee><blingee id="100998224" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/100998224-Miley-Cyrus" ><images ><image width="121" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513224500_466640.gif" ></image><image width="212" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513224501_889670.gif" ></image><image width="303" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513224502_168896.gif" ></image></images></blingee><blingee id="100996836" name="adorable" display_url="http://blingee.com/blingee/view/100996836-adorable" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/531928603_1116091.gif" ></image><image width="240" height="240" url="http://image.blingee.com/images17/content/output/000/000/000/605/531928604_1922233.gif" ></image></images></blingee><blingee id="100995496" name="Miley Cyrus is Fall Autumn" display_url="http://blingee.com/blingee/view/100995496-Miley-Cyrus-is-Fall-Autumn" ><images ><image width="160" height="120" url="http://image.blingee.com/images17/content/output/000/000/000/605/531917739_1672368.gif" ></image><image width="280" height="210" url="http://image.blingee.com/images17/content/output/000/000/000/605/531917740_1358911.gif" ></image><image width="400" height="300" url="http://image.blingee.com/images17/content/output/000/000/000/605/531917741_1770412.gif" ></image></images></blingee><blingee id="100994105" name="~Autumn Miley Cyrus~" display_url="http://blingee.com/blingee/view/100994105--Autumn-Miley-Cyrus-" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513189738_434177.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513189739_278126.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513189740_212858.gif" ></image></images></blingee><blingee id="100993998" name="Yeahhhh It's a Party in the USA" display_url="http://blingee.com/blingee/view/100993998-Yeahhhh-It-s-a-Party-in-the-USA" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905326_2061888.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905327_1592921.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905328_1683927.gif" ></image></images></blingee><blingee id="100993963" name="Miley goes Vampire? For Halloween?" display_url="http://blingee.com/blingee/view/100993963-Miley-goes-Vampire-For-Halloween-" ><images ><image width="160" height="120" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905075_1934685.gif" ></image><image width="280" height="210" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905076_1811505.gif" ></image><image width="400" height="300" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905077_1095125.gif" ></image></images></blingee><blingee id="100993778" name="{{MILEY CYRUS}}" display_url="http://blingee.com/blingee/view/100993778--MILEY-CYRUS-" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513186997_288237.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513186998_945333.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513186999_758587.gif" ></image></images></blingee><blingee id="100987955" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/100987955-Miley-Cyrus" ><images ><image width="160" height="136" url="http://image.blingee.com/images17/content/output/000/000/000/604/531854715_1470825.gif" ></image><image width="280" height="237" url="http://image.blingee.com/images17/content/output/000/000/000/604/531854716_1341627.gif" ></image><image width="366" height="310" url="http://image.blingee.com/images17/content/output/000/000/000/604/531854717_2084947.gif" ></image></images></blingee><blingee id="100983672" name="Miley cyrus" display_url="http://blingee.com/blingee/view/100983672-Miley-cyrus" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531819419_1652136.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531819420_2003095.gif" ></image><image width="322" height="322" url="http://image.blingee.com/images17/content/output/000/000/000/604/531819425_1670942.gif" ></image></images></blingee><blingee id="100982023" name="Miley Cyrus" display_url="http://blingee.com/blingee/view/100982023-Miley-Cyrus" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/513090610_2418.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/513090611_582983.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/513090612_591526.gif" ></image></images></blingee><blingee id="100981547" name="miley BluE & wHitE" display_url="http://blingee.com/blingee/view/100981547-miley-BluE-wHitE" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531801721_2089348.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531801722_1718597.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/531801723_1215388.gif" ></image></images></blingee><blingee id="100981460" name="Sweet Miley <3<3<3" display_url="http://blingee.com/blingee/view/100981460-Sweet-Miley-3-3-3" ><images ><image width="160" height="143" url="http://image.blingee.com/images17/content/output/000/000/000/604/531800839_1494771.gif" ></image><image width="280" height="251" url="http://image.blingee.com/images17/content/output/000/000/000/604/531800840_1510578.gif" ></image><image width="400" height="358" url="http://image.blingee.com/images17/content/output/000/000/000/604/531800841_1101554.gif" ></image></images></blingee><blingee id="100981169" name="miley 4ever the best " display_url="http://blingee.com/blingee/view/100981169-miley-4ever-the-best-" ><images ><image width="157" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531798435_1672001.gif" ></image><image width="274" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531798436_1781145.gif" ></image><image width="392" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/531798437_1407652.gif" ></image></images></blingee><blingee id="101010053" name="Mileys to go" display_url="http://blingee.com/blingee/view/101010053-Mileys-to-go" ><images ><image width="105" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/532035012_1120144.gif" ></image><image width="170" height="258" url="http://image.blingee.com/images17/content/output/000/000/000/605/532035013_1081364.gif" ></image></images></blingee><blingee id="101009695" name="Miley mit Blue Jeans" display_url="http://blingee.com/blingee/view/101009695-Miley-mit-Blue-Jeans" ><images ><image width="110" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/532032174_1132537.gif" ></image><image width="192" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/532032175_1907427.gif" ></image><image width="274" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/532032176_1163033.gif" ></image></images></blingee><blingee id="101009542" name="Mini (Miley) Maus :-)" display_url="http://blingee.com/blingee/view/101009542-Mini-Miley-Maus-" ><images ><image width="106" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513312025_416893.gif" ></image><image width="186" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513312026_816696.gif" ></image><image width="265" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513312027_1040107.gif" ></image></images></blingee><blingee id="101009065" name="delen 4 ever" display_url="http://blingee.com/blingee/view/101009065-delen-4-ever" ><images ><image width="152" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/532026436_1366100.gif" ></image><image width="265" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/532026437_1671088.gif" ></image><image width="379" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/532026438_1102713.gif" ></image></images></blingee><blingee id="101008792" name="The other side of me" display_url="http://blingee.com/blingee/view/101008792-The-other-side-of-me" ><images ><image width="120" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304932_916674.gif" ></image><image width="211" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304933_623606.gif" ></image><image width="301" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513304934_2260.gif" ></image></images></blingee><blingee id="101008504" name="Miley Cyrus Rocks.jpg" display_url="http://blingee.com/blingee/view/101008504-Miley-Cyrus-Rocks-jpg" ><images ><image width="165" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/532022337_1665127.gif" ></image><image width="235" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/532022338_1879609.gif" ></image></images></blingee><blingee id="101007590" name="Miley_Gnamm!!" display_url="http://blingee.com/blingee/view/101007590-Miley-Gnamm-" ><images ><image width="160" height="159" url="http://image.blingee.com/images17/content/output/000/000/000/605/513295204_385904.gif" ></image><image width="280" height="279" url="http://image.blingee.com/images17/content/output/000/000/000/605/513295205_825266.gif" ></image><image width="400" height="398" url="http://image.blingee.com/images17/content/output/000/000/000/605/513295206_638919.gif" ></image></images></blingee><blingee id="101007433" name="Miley Rockt !!!!" display_url="http://blingee.com/blingee/view/101007433-Miley-Rockt-" ><images ><image width="160" height="148" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013588_1577875.gif" ></image><image width="280" height="258" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013589_1711804.gif" ></image><image width="400" height="369" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013590_2093205.gif" ></image></images></blingee><blingee id="101007391" name="miley rocks, selena sucks!" display_url="http://blingee.com/blingee/view/101007391-miley-rocks-selena-sucks-" ><images ><image width="148" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013323_1378029.gif" ></image><image width="258" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013325_1819509.gif" ></image><image width="369" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/532013326_1558627.gif" ></image></images></blingee><blingee id="101004438" name="Miley" display_url="http://blingee.com/blingee/view/101004438-Miley" ><images ><image width="107" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513270825_885276.gif" ></image><image width="187" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513270826_299334.gif" ></image><image width="267" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513270827_281958.gif" ></image></images></blingee><blingee id="101004307" name="Miley" display_url="http://blingee.com/blingee/view/101004307-Miley" ><images ><image width="124" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513269916_757925.gif" ></image><image width="218" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513269917_732409.gif" ></image><image width="311" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513269918_613665.gif" ></image></images></blingee><blingee id="101004157" name="miley/?" display_url="http://blingee.com/blingee/view/101004157-miley-" ><images ><image width="160" height="120" url="http://image.blingee.com/images17/content/output/000/000/000/605/531987721_1731950.gif" ></image><image width="280" height="210" url="http://image.blingee.com/images17/content/output/000/000/000/605/531987722_1078906.gif" ></image><image width="400" height="300" url="http://image.blingee.com/images17/content/output/000/000/000/605/531987723_1835852.gif" ></image></images></blingee><blingee id="101004018" name="Miley" display_url="http://blingee.com/blingee/view/101004018-Miley" ><images ><image width="160" height="110" url="http://image.blingee.com/images17/content/output/000/000/000/605/513267718_779135.gif" ></image><image width="280" height="192" url="http://image.blingee.com/images17/content/output/000/000/000/605/513267719_791643.gif" ></image><image width="400" height="274" url="http://image.blingee.com/images17/content/output/000/000/000/605/513267720_66274.gif" ></image></images></blingee><blingee id="101003554" name="DeMi LoVaTo!" display_url="http://blingee.com/blingee/view/101003554-DeMi-LoVaTo-" ><images ><image width="160" height="151" url="http://image.blingee.com/images17/content/output/000/000/000/605/531983034_1912528.gif" ></image><image width="280" height="264" url="http://image.blingee.com/images17/content/output/000/000/000/605/531983035_1967406.gif" ></image><image width="400" height="377" url="http://image.blingee.com/images17/content/output/000/000/000/605/531983036_1200868.gif" ></image></images></blingee><blingee id="101002029" name="three sisters" display_url="http://blingee.com/blingee/view/101002029-three-sisters" ><images ><image width="160" height="120" url="http://image.blingee.com/images17/content/output/000/000/000/605/513252379_299031.gif" ></image><image width="280" height="210" url="http://image.blingee.com/images17/content/output/000/000/000/605/513252380_586538.gif" ></image><image width="320" height="240" url="http://image.blingee.com/images17/content/output/000/000/000/605/513252381_149369.gif" ></image></images></blingee><blingee id="100997107" name="*/-->Miley Cyrus<--/* (Originally)" display_url="http://blingee.com/blingee/view/100997107--Miley-Cyrus-Originally-" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513215529_556693.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513215530_12008.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513215531_866076.gif" ></image></images></blingee><blingee id="100996951" name="Kristen and Rob!!!!!!! =D" display_url="http://blingee.com/blingee/view/100996951-Kristen-and-Rob-D" ><images ><image width="122" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/531929521_1420176.gif" ></image><image width="213" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/531929522_1765346.gif" ></image><image width="304" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/531929523_2051500.gif" ></image></images></blingee><blingee id="100993964" name="miley vanessa best freinds" display_url="http://blingee.com/blingee/view/100993964-miley-vanessa-best-freinds" ><images ><image width="160" height="139" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905086_1053791.gif" ></image><image width="280" height="243" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905087_1559111.gif" ></image><image width="346" height="300" url="http://image.blingee.com/images17/content/output/000/000/000/605/531905088_2002142.gif" ></image></images></blingee><blingee id="100993517" name="miley in blue" display_url="http://blingee.com/blingee/view/100993517-miley-in-blue" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/605/513184981_891834.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/605/513184982_789404.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/605/513184983_436449.gif" ></image></images></blingee><blingee id="100991206" name="selena Gomez" display_url="http://blingee.com/blingee/view/100991206-selena-Gomez" ><images ><image width="160" height="158" url="http://image.blingee.com/images17/content/output/000/000/000/605/531881889_1549831.gif" ></image><image width="280" height="277" url="http://image.blingee.com/images17/content/output/000/000/000/605/531881890_1096590.gif" ></image><image width="400" height="396" url="http://image.blingee.com/images17/content/output/000/000/000/605/531881891_1649436.gif" ></image></images></blingee><blingee id="100990954" name="miley " display_url="http://blingee.com/blingee/view/100990954-miley-" ><images ><image width="160" height="153" url="http://image.blingee.com/images17/content/output/000/000/000/604/513163635_2834.gif" ></image><image width="280" height="267" url="http://image.blingee.com/images17/content/output/000/000/000/604/513163636_298665.gif" ></image><image width="365" height="348" url="http://image.blingee.com/images17/content/output/000/000/000/604/513163637_95975.gif" ></image></images></blingee><blingee id="100988755" name="divaaa" display_url="http://blingee.com/blingee/view/100988755-divaaa" ><images ><image width="124" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531861317_1163860.gif" ></image><image width="218" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531861318_1750433.gif" ></image><image width="311" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/531861319_1473338.gif" ></image></images></blingee><blingee id="100988502" name="hannah" display_url="http://blingee.com/blingee/view/100988502-hannah" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/513143080_762684.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/513143081_252748.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/513143082_727698.gif" ></image></images></blingee><blingee id="100987312" name="ME AND AMY~2 PARTY GIRLS ~NO A VERY NICE BLINGEE" display_url="http://blingee.com/blingee/view/100987312-ME-AND-AMY-2-PARTY-GIRLS-NO-A-VERY-NICE-BLINGEE" ><images ><image width="160" height="104" url="http://image.blingee.com/images17/content/output/000/000/000/604/531849642_1330212.gif" ></image><image width="280" height="182" url="http://image.blingee.com/images17/content/output/000/000/000/604/531849643_1236090.gif" ></image><image width="400" height="260" url="http://image.blingee.com/images17/content/output/000/000/000/604/531849644_1861303.gif" ></image></images></blingee><blingee id="100986237" name="..tHey aRe: DeMi, MiLeY, SeLeNa & TayLoR --> mY favOrite sTarS & sinGeRs giRLs.." display_url="http://blingee.com/blingee/view/100986237--tHey-aRe-DeMi-MiLeY-SeLeNa-TayLoR-mY-favOrite-sTarS-sinGeRs-giRLs-" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/513124343_590303.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/513124345_833169.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/513124347_825695.gif" ></image></images></blingee><blingee id="100985896" name="you belong with me tralier" display_url="http://blingee.com/blingee/view/100985896-you-belong-with-me-tralier" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531837330_1843817.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531837331_1834865.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/531837332_1118500.gif" ></image></images></blingee><blingee id="100984361" name="miley" display_url="http://blingee.com/blingee/view/100984361-miley" ><images ><image width="126" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/513109296_225816.gif" ></image><image width="220" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/513109297_214781.gif" ></image><image width="314" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/513109298_624116.gif" ></image></images></blingee><blingee id="100983836" name="RainbowSprinkles1001 bg!!" display_url="http://blingee.com/blingee/view/100983836-RainbowSprinkles1001-bg-" ><images ><image width="160" height="114" url="http://image.blingee.com/images17/content/output/000/000/000/604/531820656_1288146.gif" ></image><image width="280" height="199" url="http://image.blingee.com/images17/content/output/000/000/000/604/531820657_1569153.gif" ></image><image width="400" height="284" url="http://image.blingee.com/images17/content/output/000/000/000/604/531820658_1650961.gif" ></image></images></blingee><blingee id="100983546" name="Miley Cyrus pretty angel <3" display_url="http://blingee.com/blingee/view/100983546-Miley-Cyrus-pretty-angel-3" ><images ><image width="160" height="143" url="http://image.blingee.com/images17/content/output/000/000/000/604/531818314_1744555.gif" ></image><image width="280" height="251" url="http://image.blingee.com/images17/content/output/000/000/000/604/531818315_1479048.gif" ></image><image width="400" height="358" url="http://image.blingee.com/images17/content/output/000/000/000/604/531818316_2056306.gif" ></image></images></blingee><blingee id="100981311" name="billy ray,noah,emma,brandy" display_url="http://blingee.com/blingee/view/100981311-billy-ray-noah-emma-brandy" ><images ><image width="160" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/513085042_418445.gif" ></image><image width="280" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/513085044_640492.gif" ></image><image width="400" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/513085045_143322.gif" ></image></images></blingee><blingee id="100980957" name="s/miley" display_url="http://blingee.com/blingee/view/100980957-s-miley" ><images ><image width="134" height="160" url="http://image.blingee.com/images17/content/output/000/000/000/604/531796614_1174224.gif" ></image><image width="235" height="280" url="http://image.blingee.com/images17/content/output/000/000/000/604/531796615_1190676.gif" ></image><image width="336" height="400" url="http://image.blingee.com/images17/content/output/000/000/000/604/531796616_1529867.gif" ></image></images></blingee><blingee id="100980613" name="Selena Gomez orange" display_url="http://blingee.com/blingee/view/100980613-Selena-Gomez-orange" ><images ><image width="160" height="142" url="http://image.blingee.com/images17/content/output/000/000/000/604/513079544_604183.gif" ></image><image width="280" height="249" url="http://image.blingee.com/images17/content/output/000/000/000/604/513079545_873075.gif" ></image><image width="400" height="356" url="http://image.blingee.com/images17/content/output/000/000/000/604/513079546_26133.gif" ></image></images></blingee></blingees>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'yaml'
|
4
|
+
require 'activesupport'
|
5
|
+
require 'shoulda'
|
6
|
+
require 'mocha'
|
7
|
+
require 'fakeweb'
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
11
|
+
require 'blingee'
|
12
|
+
|
13
|
+
FakeWeb.allow_net_connect = false
|
14
|
+
|
15
|
+
module Fixture
|
16
|
+
|
17
|
+
Dir[File.dirname(__FILE__) + "/fixtures/*.yml"].each do |fixture|
|
18
|
+
klass = const_set(File.basename(fixture, '.yml').camelize.to_sym, Module.new)
|
19
|
+
klass.class_eval do
|
20
|
+
(class << self; self; end).instance_eval do
|
21
|
+
YAML.load_file(fixture).each_pair do |name, response|
|
22
|
+
define_method name do
|
23
|
+
response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Test::Unit::TestCase
|
33
|
+
|
34
|
+
##
|
35
|
+
# Returns an instance of a Blingee object.
|
36
|
+
#
|
37
|
+
def blingee(options = {})
|
38
|
+
options[:user_id] ||= 500
|
39
|
+
options[:secret] ||= 'SECRET'
|
40
|
+
Blingee.new(options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def mock_response(*response)
|
44
|
+
options = response.extract_options!
|
45
|
+
begin
|
46
|
+
FakeWeb.register_uri(options[:method] || :get, /.*/, options[:exception] ? {:exception => options[:exception]} : {:response => response.first})
|
47
|
+
yield if block_given?
|
48
|
+
ensure
|
49
|
+
FakeWeb.clean_registry
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../helper")
|
2
|
+
|
3
|
+
class TestExceptions < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context 'When the service cannot be reached' do
|
6
|
+
|
7
|
+
should 'raise a Blingee::Error' do
|
8
|
+
mock_response(:exception => Timeout::Error) do
|
9
|
+
assert_raise(Blingee::ConnectionError) do
|
10
|
+
blingee.tag_search('miley')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
should 'raise a Blingee::AuthenticationFailure' do
|
16
|
+
mock_response(Fixture::Errors.authentication) do
|
17
|
+
assert_raise(Blingee::AuthenticationFailure) do
|
18
|
+
blingee.tag_search('miley')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../helper")
|
2
|
+
|
3
|
+
class TestSearch < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context 'Tag Searching' do
|
6
|
+
|
7
|
+
setup do
|
8
|
+
Time.stubs(:now).returns(Time.parse('2009-01-01T00:00:00Z'))
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'return a collection' do
|
12
|
+
mock_response(Fixture::Search.success) do
|
13
|
+
assert_kind_of Blingee::Collection, blingee.tag_search('miley')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'contain each responded entry' do
|
18
|
+
mock_response(Fixture::Search.success) do
|
19
|
+
result = blingee.tag_search('miley')
|
20
|
+
assert_equal(50, result.size)
|
21
|
+
entry = result.detect { |entry| entry.name == 'Miley Cyrus im Regen :-)' }
|
22
|
+
assert_not_nil(entry, "Expected entry was not found.")
|
23
|
+
assert_equal('Miley Cyrus im Regen :-)', entry.name)
|
24
|
+
assert_equal(101008713, entry.id)
|
25
|
+
assert_equal('http://blingee.com/blingee/view/101008713-Miley-Cyrus-im-Regen-', entry.display_url)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'load images for each entry' do
|
30
|
+
mock_response(Fixture::Search.success) do
|
31
|
+
entry = blingee.tag_search('miley').detect { |entry| entry.name == 'Miley Cyrus im Regen :-)' }
|
32
|
+
assert_not_nil(entry, "Expected entry was not found.")
|
33
|
+
assert_respond_to(entry, :images)
|
34
|
+
assert_equal(3, entry.images.size)
|
35
|
+
|
36
|
+
[
|
37
|
+
[160,120,"http://image.blingee.com/images17/content/output/000/000/000/605/513304266_1027459.gif"],
|
38
|
+
[280,210,"http://image.blingee.com/images17/content/output/000/000/000/605/513304267_83838.gif"],
|
39
|
+
[400,300,"http://image.blingee.com/images17/content/output/000/000/000/605/513304268_333059.gif"]
|
40
|
+
].each do |width,height,url|
|
41
|
+
assert entry.images.any? { |image| image.width == width && image.height == height && image.url == url }
|
42
|
+
"#{width}x#{height} - #{url} could not be matched."
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blingee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathaniel Bibler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-22 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: relax
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.1.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: thoughtbot-shoulda
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: fakeweb
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mocha
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
description: blingee is a Ruby interface to the Blingee.com API.
|
66
|
+
email: gem@nathanielbibler.com
|
67
|
+
executables: []
|
68
|
+
|
69
|
+
extensions: []
|
70
|
+
|
71
|
+
extra_rdoc_files:
|
72
|
+
- LICENSE
|
73
|
+
- README.rdoc
|
74
|
+
files:
|
75
|
+
- .document
|
76
|
+
- .gitignore
|
77
|
+
- LICENSE
|
78
|
+
- README.rdoc
|
79
|
+
- Rakefile
|
80
|
+
- VERSION
|
81
|
+
- blingee.gemspec
|
82
|
+
- lib/blingee.rb
|
83
|
+
- lib/blingee/api.rb
|
84
|
+
- lib/blingee/collection.rb
|
85
|
+
- lib/blingee/entry.rb
|
86
|
+
- lib/blingee/exceptions.rb
|
87
|
+
- lib/blingee/image.rb
|
88
|
+
- lib/blingee/instance.rb
|
89
|
+
- test/fixtures/errors.yml
|
90
|
+
- test/fixtures/search.yml
|
91
|
+
- test/helper.rb
|
92
|
+
- test/integration/test_exceptions.rb
|
93
|
+
- test/integration/test_search.rb
|
94
|
+
has_rdoc: true
|
95
|
+
homepage: http://github.com/nbibler/blingee
|
96
|
+
licenses: []
|
97
|
+
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options:
|
100
|
+
- --charset=UTF-8
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
version:
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
114
|
+
version:
|
115
|
+
requirements: []
|
116
|
+
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.3.5
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: A Ruby interface to the Blingee.com API
|
122
|
+
test_files:
|
123
|
+
- test/helper.rb
|
124
|
+
- test/integration/test_exceptions.rb
|
125
|
+
- test/integration/test_search.rb
|