yfrog 1.0.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/.gitignore +1 -0
- data/.rvmrc +21 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +18 -0
- data/README.md +19 -0
- data/Rakefile +2 -0
- data/lib/yfrog.rb +14 -0
- data/spec/yfrog_spec.rb +48 -0
- data/yfrog.gemspec +16 -0
- metadata +56 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/.rvmrc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
environment_id="ruby-1.9.2-p290@yfrog"
|
4
|
+
|
5
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
6
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
7
|
+
then
|
8
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
9
|
+
|
10
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
11
|
+
then
|
12
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
13
|
+
fi
|
14
|
+
else
|
15
|
+
if ! rvm --create "$environment_id"
|
16
|
+
then
|
17
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
18
|
+
exit 1
|
19
|
+
fi
|
20
|
+
fi
|
21
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
rspec (2.6.0)
|
6
|
+
rspec-core (~> 2.6.0)
|
7
|
+
rspec-expectations (~> 2.6.0)
|
8
|
+
rspec-mocks (~> 2.6.0)
|
9
|
+
rspec-core (2.6.4)
|
10
|
+
rspec-expectations (2.6.0)
|
11
|
+
diff-lcs (~> 1.1.2)
|
12
|
+
rspec-mocks (2.6.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
rspec
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# yfrog
|
2
|
+
|
3
|
+
yfrog doesn't seem to have it documented how to get an image URL given a yfrog URL, such as you might get from twitter's API.
|
4
|
+
|
5
|
+
this gem is intended to abstract this process for robustness.
|
6
|
+
|
7
|
+
# installation
|
8
|
+
|
9
|
+
$ gem install yfrog
|
10
|
+
|
11
|
+
# usage
|
12
|
+
|
13
|
+
require 'yfrog'
|
14
|
+
|
15
|
+
image_url = YFrog.image_url_for("http://yfrog.com/kjugqgbj")
|
16
|
+
|
17
|
+
# license
|
18
|
+
|
19
|
+
MIT dude!
|
data/Rakefile
ADDED
data/lib/yfrog.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module YFrog
|
2
|
+
class << self
|
3
|
+
def image_url_for(url, options = {:format => :medium} )
|
4
|
+
suffix = case options.delete(:format)
|
5
|
+
when :medium; ":medium"
|
6
|
+
when :iphone; ":iphone"
|
7
|
+
when :small; ":small"
|
8
|
+
when :thumb; ":small"
|
9
|
+
end
|
10
|
+
raise ArgumentError unless suffix
|
11
|
+
url << suffix
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/yfrog_spec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'yfrog'
|
2
|
+
|
3
|
+
describe YFrog do
|
4
|
+
|
5
|
+
describe "some basics" do
|
6
|
+
subject { YFrog }
|
7
|
+
it { should be }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#image_url_for" do
|
11
|
+
let(:url) { "http://yfrog.com/kjugqgbj" }
|
12
|
+
|
13
|
+
context "without arguments" do
|
14
|
+
subject { YFrog.image_url_for(url) }
|
15
|
+
it { should == "http://yfrog.com/kjugqgbj:medium" }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with a format specified" do
|
19
|
+
subject { YFrog.image_url_for(url, :format => format) }
|
20
|
+
context "medium" do
|
21
|
+
let(:format) { :medium }
|
22
|
+
it { should == "http://yfrog.com/kjugqgbj:medium" }
|
23
|
+
end
|
24
|
+
|
25
|
+
context "iphone" do
|
26
|
+
let(:format) { :iphone }
|
27
|
+
it { should == "http://yfrog.com/kjugqgbj:iphone" }
|
28
|
+
end
|
29
|
+
|
30
|
+
context "small" do
|
31
|
+
let(:format) { :small }
|
32
|
+
it { should == "http://yfrog.com/kjugqgbj:small" }
|
33
|
+
end
|
34
|
+
|
35
|
+
context "thumb" do
|
36
|
+
let(:format) { :thumb }
|
37
|
+
it { should == "http://yfrog.com/kjugqgbj:small" }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with an unsupported format" do
|
42
|
+
let(:format) { :omgwtfbbq }
|
43
|
+
it "should raise an exception" do
|
44
|
+
expect { YFrog.image_url_for(url, :format => format) }.to raise_error(ArgumentError)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/yfrog.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "yfrog"
|
5
|
+
s.version = "1.0.0"
|
6
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Sean Moon"]
|
9
|
+
s.email = ["seanmoon@seanmoon.com"]
|
10
|
+
s.homepage = "http://github.com/seanmoon/yfrog"
|
11
|
+
s.summary = %Q{yfrog gem}
|
12
|
+
s.description = %Q{work with yfrog urls to get image urls and such}
|
13
|
+
s.has_rdoc = false
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yfrog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sean Moon
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-14 00:00:00.000000000 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: work with yfrog urls to get image urls and such
|
16
|
+
email:
|
17
|
+
- seanmoon@seanmoon.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- .rvmrc
|
24
|
+
- Gemfile
|
25
|
+
- Gemfile.lock
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- lib/yfrog.rb
|
29
|
+
- spec/yfrog_spec.rb
|
30
|
+
- yfrog.gemspec
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://github.com/seanmoon/yfrog
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.6.2
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: yfrog gem
|
56
|
+
test_files: []
|