sinatra-jsonp 0.2 → 0.2.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.
Files changed (3) hide show
  1. data/README.md +40 -25
  2. data/lib/sinatra/jsonp.rb +1 -1
  3. metadata +8 -3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Sinatra::JSONP
1
+ Sinatra::Jsonp
2
2
  =================
3
3
 
4
4
  JSONP output helper for [Sinatra](http://sinatrarb.com). Automatically detects callback params and returns proper JSONP output.
@@ -8,33 +8,48 @@ Works with [jQuery](http://jquery.com) [jQuery.getJSON](http://api.jquery.com/jQ
8
8
 
9
9
  Installation
10
10
  ------------
11
- <pre>
12
- sudo gem install sinatra-jsonp
13
- </pre>
11
+
12
+ gem install sinatra-jsonp
14
13
 
15
14
  Usage
16
15
  -----
17
- <pre>
18
- require "sinatra"
19
- require "sinatra/jsonp"
20
-
21
- get '/hello' do
22
- data = ["hello","hi","hallo"]
23
- JSONP data # JSONP is an alias for jsonp method
24
- end
25
-
26
- # define your own callback as second string param
27
- get '/hi' do
28
- data = ["hello","hi","hallo"]
29
- jsonp data, 'functionA'
30
- end
31
-
32
- # same with symbol param
33
- get '/hallo' do
34
- data = ["hello","hi","hallo"]
35
- jsonp data, :functionB
36
- end
37
- </pre>
16
+
17
+ Classic:
18
+
19
+ require "sinatra"
20
+ require "sinatra/jsonp"
21
+
22
+ get '/hello' do
23
+ data = ["hello","hi","hallo"]
24
+ JSONP data # JSONP is an alias for jsonp method
25
+ end
26
+
27
+ # define your own callback as second string param
28
+ get '/hi' do
29
+ data = ["hello","hi","hallo"]
30
+ jsonp data, 'functionA'
31
+ end
32
+
33
+ # same with symbol param
34
+ get '/hallo' do
35
+ data = ["hello","hi","hallo"]
36
+ jsonp data, :functionB
37
+ end
38
+
39
+ Modular:
40
+
41
+ require "sinatra/base"
42
+ require "sinatra/jsonp"
43
+
44
+ class Foo < Sinatra::Base
45
+ helpers Sinatra::Jsonp
46
+
47
+ get '/' do
48
+ data = ["hello","hi","hallo"]
49
+ jsonp data
50
+ end
51
+ end
52
+
38
53
 
39
54
  Links
40
55
  -----
data/lib/sinatra/jsonp.rb CHANGED
@@ -9,7 +9,7 @@ module Sinatra
9
9
  if args.size > 1
10
10
  callback = args[1].to_s
11
11
  else
12
- ['callback','jscallback','jsonp'].each do |x|
12
+ ['callback','jscallback','jsonp','jsoncallback'].each do |x|
13
13
  callback = params.delete(x) if not callback
14
14
  end
15
15
  end
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- version: "0.2"
8
+ - 1
9
+ version: 0.2.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - Serg Podtynnyi
@@ -13,13 +14,14 @@ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
16
 
16
- date: 2010-06-09 00:00:00 +04:00
17
+ date: 2010-10-12 00:00:00 +04:00
17
18
  default_executable:
18
19
  dependencies:
19
20
  - !ruby/object:Gem::Dependency
20
21
  name: sinatra
21
22
  prerelease: false
22
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
@@ -33,6 +35,7 @@ dependencies:
33
35
  name: json_pure
34
36
  prerelease: false
35
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
36
39
  requirements:
37
40
  - - ~>
38
41
  - !ruby/object:Gem::Version
@@ -63,6 +66,7 @@ rdoc_options: []
63
66
  require_paths:
64
67
  - lib
65
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
66
70
  requirements:
67
71
  - - ">="
68
72
  - !ruby/object:Gem::Version
@@ -70,6 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
74
  - 0
71
75
  version: "0"
72
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
73
78
  requirements:
74
79
  - - ">="
75
80
  - !ruby/object:Gem::Version
@@ -79,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
84
  requirements: []
80
85
 
81
86
  rubyforge_project:
82
- rubygems_version: 1.3.6
87
+ rubygems_version: 1.3.7
83
88
  signing_key:
84
89
  specification_version: 3
85
90
  summary: JSONP output helper for Sinatra