pixy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
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
@@ -1,2 +1,9 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+
9
+ task :default => :spec
@@ -10,4 +10,5 @@ module Pixy
10
10
  raise ArgumentError, "API key is required" if key.nil?
11
11
  Pixy::Shorten.new(key, url)
12
12
  end
13
+ alias_method :shorten, :shorten!
13
14
  end
@@ -1,3 +1,3 @@
1
1
  module Pixy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -16,4 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Pixy::VERSION
17
17
 
18
18
  gem.add_runtime_dependency 'json'
19
+
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'rspec'
22
+ gem.add_development_dependency 'fakeweb'
19
23
  end
@@ -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
@@ -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.1
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: &2151918060 !ruby/object:Gem::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: *2151918060
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