deadlinez 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.name = "deadlinez"
8
8
  gem.summary = %Q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
9
9
  gem.description = %Q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
10
- gem.email = "david@bitwax.cd"
10
+ gem.email = "dbalatero@gmail.com"
11
11
  gem.homepage = "http://github.com/dbalatero/deadlinez"
12
12
  gem.authors = ["David Balatero"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/deadlinez.gemspec ADDED
@@ -0,0 +1,67 @@
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{deadlinez}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["David Balatero"]
12
+ s.date = %q{2009-12-10}
13
+ s.description = %q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
14
+ s.email = %q{dbalatero@gmail.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
+ "deadlinez.gemspec",
27
+ "init.rb",
28
+ "lib/deadlinez.rb",
29
+ "lib/deadlinez/api.rb",
30
+ "lib/deadlinez/proxy.rb",
31
+ "spec/deadlinez/api_spec.rb",
32
+ "spec/deadlinez/proxy_spec.rb",
33
+ "spec/fixtures/stats.response",
34
+ "spec/spec.opts",
35
+ "spec/spec_helper.rb"
36
+ ]
37
+ s.homepage = %q{http://github.com/dbalatero/deadlinez}
38
+ s.rdoc_options = ["--charset=UTF-8"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = %q{1.3.5}
41
+ s.summary = %q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
42
+ s.test_files = [
43
+ "spec/deadlinez/api_spec.rb",
44
+ "spec/deadlinez/proxy_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
54
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
55
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
+ s.add_dependency(%q<fakeweb>, [">= 0"])
59
+ s.add_dependency(%q<httparty>, [">= 0"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
63
+ s.add_dependency(%q<fakeweb>, [">= 0"])
64
+ s.add_dependency(%q<httparty>, [">= 0"])
65
+ end
66
+ end
67
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'deadlinez'
data/lib/deadlinez/api.rb CHANGED
@@ -4,6 +4,17 @@ module Deadlinez
4
4
  format :xml
5
5
  base_uri 'service.afterthedeadline.com'
6
6
 
7
+ # Proxies any URL through to AtD. Useful for the TinyMCE
8
+ # plugin.
9
+ def self.proxy(path, params)
10
+ proxy_params = Deadlinez::Proxy.strip_params(params)
11
+ proxy_params['key'] = Deadlinez.api_key
12
+ response = get(path,
13
+ :query => params,
14
+ :format => nil)
15
+ response.body
16
+ end
17
+
7
18
  def self.stats(data)
8
19
  response = get('/stats',
9
20
  :query => {
@@ -1,4 +1,11 @@
1
1
  module Deadlinez
2
2
  class Proxy
3
+ def self.strip_params(params)
4
+ copy = params.dup
5
+ [:action, :controller, :path].each do |k|
6
+ copy.delete(k)
7
+ end
8
+ copy
9
+ end
3
10
  end
4
11
  end
@@ -11,6 +11,7 @@ describe Deadlinez::Api do
11
11
 
12
12
  data = %Q{Jacobs spent most of his childhood moving around the East Coast with his family, eventually settling in Tampa, Florida. As a drummer he won the 1978 "Most Talented" trophy at Greco Junior High School, but after relocating to Queens, New York (as a result of his parents' divorce), he traded his drums in for a set of turntables apon discovering and marveling over hip hop while the artform was still in an underground developmental stage. He was mentored in the craft by his cousin Rene Negron (a.k.a. DJ-Stretch), and their close friend Shawn Trone (a.k.a. MC Shah-T of the parody-rap group No Face) who suggested Greg use the name "Shah-G". Jacobs liked the idea, but mistakenly thought his friend said "Shock-G", and began using that name instead.}
13
13
  result = Deadlinez::Api.stats(data)
14
+ puts result.inspect
14
15
  result.should have(4).things
15
16
  end
16
17
  end
@@ -1,7 +1,14 @@
1
1
  require File.dirname(__FILE__) + "/../spec_helper"
2
2
 
3
3
  describe Deadlinez::Proxy do
4
- describe "#fire_request" do
5
- it "should remove action and controller"
4
+ describe "#strip_params" do
5
+ it "should remove action and controller" do
6
+ params = { :action => 'something',
7
+ :controller => 'whatever',
8
+ :key => '89fdsa8fd88a99s9ss' }
9
+ result = Deadlinez::Proxy.strip_params(params)
10
+ result[:action].should be_nil
11
+ result[:controller].should be_nil
12
+ end
6
13
  end
7
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deadlinez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Balatero
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-08 00:00:00 -08:00
12
+ date: 2009-12-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: "0"
44
44
  version:
45
45
  description: Makes it easy to handle After the Deadline AJAX proxying and their API.
46
- email: david@bitwax.cd
46
+ email: dbalatero@gmail.com
47
47
  executables: []
48
48
 
49
49
  extensions: []
@@ -58,6 +58,8 @@ files:
58
58
  - README.rdoc
59
59
  - Rakefile
60
60
  - VERSION
61
+ - deadlinez.gemspec
62
+ - init.rb
61
63
  - lib/deadlinez.rb
62
64
  - lib/deadlinez/api.rb
63
65
  - lib/deadlinez/proxy.rb