pixy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/README.md +3 -1
- data/Rakefile +7 -0
- data/lib/pixy.rb +1 -0
- data/lib/pixy/version.rb +1 -1
- data/pixy.gemspec +4 -0
- data/spec/pixy/shorten_spec.rb +42 -0
- data/spec/spec_helper.rb +15 -0
- metadata +42 -4
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Pixy
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/NARKOZ/pixy.png)](http://travis-ci.org/NARKOZ/pixy)
|
4
|
+
|
3
5
|
Pixy is an API wrapper for Pixiv url shortener - [p.tl](http://p.tl/)
|
4
6
|
|
5
7
|
## Installation
|
@@ -30,5 +32,5 @@ url.counter
|
|
30
32
|
|
31
33
|
## Copyright
|
32
34
|
|
33
|
-
Copyright (c) 2011 Nihad Abbasov
|
35
|
+
Copyright (c) 2011 Nihad Abbasov
|
34
36
|
BSD License.
|
data/Rakefile
CHANGED
data/lib/pixy.rb
CHANGED
data/lib/pixy/version.rb
CHANGED
data/pixy.gemspec
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pixy::Shorten do
|
4
|
+
context "when a new short url requested" do
|
5
|
+
it { Pixy.should respond_to(:shorten!) }
|
6
|
+
it { Pixy.should respond_to(:shorten) }
|
7
|
+
|
8
|
+
context "without arguments" do
|
9
|
+
it "should raise a required API key error" do
|
10
|
+
lambda { Pixy.shorten! }.should raise_error(ArgumentError, "API key is required")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with arguments" do
|
15
|
+
subject { Pixy.shorten!('API_KEY', 'https://github.com/narkoz/pixy') }
|
16
|
+
|
17
|
+
describe "#status" do
|
18
|
+
it "should return a response status" do
|
19
|
+
subject.status.should == 'ok'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#long_url" do
|
24
|
+
it "should return a long url" do
|
25
|
+
subject.long_url.should == 'https://github.com/narkoz/pixy'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#short_url" do
|
30
|
+
it "should return a short url" do
|
31
|
+
subject.short_url.should == 'http://p.tl/Us9R'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#counter" do
|
36
|
+
it "should return a request number" do
|
37
|
+
subject.counter.should == 12
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'fakeweb'
|
3
|
+
require 'pixy'
|
4
|
+
|
5
|
+
FakeWeb.allow_net_connect = false
|
6
|
+
|
7
|
+
url_to_shorten = "https%3A%2F%2Fgithub.com%2Fnarkoz%2Fpixy"
|
8
|
+
FakeWeb.register_uri(:get,
|
9
|
+
"http://p.tl/api/api_simple.php?key=API_KEY&url=#{url_to_shorten}",
|
10
|
+
:body => {
|
11
|
+
:status => 'ok',
|
12
|
+
:long_url => 'https://github.com/narkoz/pixy',
|
13
|
+
:short_url => 'http://p.tl/Us9R',
|
14
|
+
:counter => 12
|
15
|
+
}.to_json)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &2151939620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,40 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2151939620
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &2151939040 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2151939040
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &2151937580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2151937580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: fakeweb
|
49
|
+
requirement: &2151937040 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2151937040
|
25
58
|
description: Pixy is an API wrapper for Pixiv url shortener - p.tl
|
26
59
|
email:
|
27
60
|
- mail@narkoz.me
|
@@ -30,6 +63,7 @@ extensions: []
|
|
30
63
|
extra_rdoc_files: []
|
31
64
|
files:
|
32
65
|
- .gitignore
|
66
|
+
- .travis.yml
|
33
67
|
- Gemfile
|
34
68
|
- LICENSE.txt
|
35
69
|
- README.md
|
@@ -38,6 +72,8 @@ files:
|
|
38
72
|
- lib/pixy/shorten.rb
|
39
73
|
- lib/pixy/version.rb
|
40
74
|
- pixy.gemspec
|
75
|
+
- spec/pixy/shorten_spec.rb
|
76
|
+
- spec/spec_helper.rb
|
41
77
|
homepage: https://github.com/narkoz/pixy
|
42
78
|
licenses: []
|
43
79
|
post_install_message:
|
@@ -62,4 +98,6 @@ rubygems_version: 1.8.12
|
|
62
98
|
signing_key:
|
63
99
|
specification_version: 3
|
64
100
|
summary: API wrapper for Pixiv url shortener
|
65
|
-
test_files:
|
101
|
+
test_files:
|
102
|
+
- spec/pixy/shorten_spec.rb
|
103
|
+
- spec/spec_helper.rb
|