sinatra-jsonp 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +37 -29
  2. data/spec/jsonp_spec.rb +1 -1
  3. data/spec/spec_helper.rb +1 -1
  4. metadata +58 -57
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sinatra::Jsonp ![Project status](http://stillmaintained.com/shtirlic/sinatra-jsonp.png)
2
2
  ==============
3
3
 
4
- JSONP output helper for [Sinatra](http://sinatrarb.com). Automatically detects callback params and returns proper JSONP output.
4
+ JSONP output helper for [Sinatra](http://sinatrarb.com). Automatically detects callback params and returns proper JSONP output.
5
5
  If no callback params where detected it returns plain JSON.
6
6
  Works with [jQuery](http://jquery.com) [jQuery.getJSON](http://api.jquery.com/jQuery.getJSON/) method out of the box.
7
7
 
@@ -9,50 +9,58 @@ Works with [jQuery](http://jquery.com) [jQuery.getJSON](http://api.jquery.com/jQ
9
9
  Installation
10
10
  ------------
11
11
 
12
+ System install
13
+
12
14
  ```bash
13
15
  gem install sinatra-jsonp
14
16
  ```
15
17
 
18
+ Gemfile
19
+
20
+ ```ruby
21
+ gem 'sinatra-jsonp', :require => 'sinatra/jsonp'
22
+ ```
23
+
16
24
  Usage
17
25
  -----
18
26
 
19
27
  Classic:
20
28
 
21
29
  ```ruby
22
- require "sinatra"
23
- require "sinatra/jsonp"
24
-
25
- get '/hello' do
26
- data = ["hello","hi","hallo"]
27
- JSONP data # JSONP is an alias for jsonp method
28
- end
29
-
30
- # define your own callback as second string param
31
- get '/hi' do
32
- data = ["hello","hi","hallo"]
33
- jsonp data, 'functionA'
34
- end
35
-
36
- # same with symbol param
37
- get '/hallo' do
38
- data = ["hello","hi","hallo"]
39
- jsonp data, :functionB
40
- end
30
+ require "sinatra"
31
+ require "sinatra/jsonp"
32
+
33
+ get '/hello' do
34
+ data = ["hello","hi","hallo"]
35
+ JSONP data # JSONP is an alias for jsonp method
36
+ end
37
+
38
+ # define your own callback as second string param
39
+ get '/hi' do
40
+ data = ["hello","hi","hallo"]
41
+ jsonp data, 'functionA'
42
+ end
43
+
44
+ # same with symbol param
45
+ get '/hallo' do
46
+ data = ["hello","hi","hallo"]
47
+ jsonp data, :functionB
48
+ end
41
49
  ```
42
50
  Modular:
43
51
 
44
52
  ```ruby
45
- require "sinatra/base"
46
- require "sinatra/jsonp"
53
+ require "sinatra/base"
54
+ require "sinatra/jsonp"
47
55
 
48
- class Foo < Sinatra::Base
49
- helpers Sinatra::Jsonp
56
+ class Foo < Sinatra::Base
57
+ helpers Sinatra::Jsonp
50
58
 
51
- get '/' do
52
- data = ["hello","hi","hallo"]
53
- jsonp data
54
- end
55
- end
59
+ get '/' do
60
+ data = ["hello","hi","hallo"]
61
+ jsonp data
62
+ end
63
+ end
56
64
  ```
57
65
 
58
66
  Links
data/spec/jsonp_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
+ require 'backports'
1
2
  require_relative 'spec_helper'
2
- require 'sinatra/jsonp'
3
3
 
4
4
  describe Sinatra::Jsonp do
5
5
  before do
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'sinatra/contrib'
2
-
2
+ require 'sinatra/jsonp'
3
3
 
4
4
  RSpec.configure do |config|
5
5
  config.expect_with :rspec, :stdlib
metadata CHANGED
@@ -1,104 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sinatra-jsonp
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
4
5
  prerelease:
5
- version: 0.3.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Serg Podtynnyi
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-25 00:00:00 +04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: sinatra
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &82328930 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: "1.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: json_pure
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *82328930
25
+ - !ruby/object:Gem::Dependency
26
+ name: json_pure
27
+ requirement: &82328400 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
29
+ requirements:
33
30
  - - ~>
34
- - !ruby/object:Gem::Version
35
- version: "1.4"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.4'
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *82328400
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &82327530 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
40
+ requirements:
44
41
  - - ~>
45
- - !ruby/object:Gem::Version
46
- version: "2.3"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.3'
47
44
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
45
+ prerelease: false
46
+ version_requirements: *82327530
47
+ - !ruby/object:Gem::Dependency
50
48
  name: rake
49
+ requirement: &83330550 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
51
56
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
57
+ version_requirements: *83330550
58
+ - !ruby/object:Gem::Dependency
59
+ name: sinatra-contrib
60
+ requirement: &83330280 !ruby/object:Gem::Requirement
53
61
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.0'
58
66
  type: :development
59
- version_requirements: *id004
67
+ prerelease: false
68
+ version_requirements: *83330280
60
69
  description: JSONP output helper for Sinatra
61
70
  email: serg.podtynnyi@gmail.com
62
71
  executables: []
63
-
64
72
  extensions: []
65
-
66
73
  extra_rdoc_files: []
67
-
68
- files:
74
+ files:
69
75
  - spec/jsonp_spec.rb
70
76
  - spec/spec_helper.rb
71
77
  - lib/sinatra/jsonp.rb
72
78
  - README.md
73
79
  - Rakefile
74
80
  - LICENSE
75
- has_rdoc: true
76
81
  homepage: http://github.com/shtirlic/sinatra-jsonp
77
82
  licenses: []
78
-
79
83
  post_install_message:
80
84
  rdoc_options: []
81
-
82
- require_paths:
85
+ require_paths:
83
86
  - lib
84
- required_ruby_version: !ruby/object:Gem::Requirement
87
+ required_ruby_version: !ruby/object:Gem::Requirement
85
88
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
96
99
  requirements: []
97
-
98
100
  rubyforge_project:
99
- rubygems_version: 1.6.2
101
+ rubygems_version: 1.8.11
100
102
  signing_key:
101
103
  specification_version: 3
102
104
  summary: JSONP output helper for Sinatra
103
105
  test_files: []
104
-