whurl_engine 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -24,28 +24,31 @@ Then in your main app's routes.rb file, add this to make the whurl_engine routab
24
24
  Figure out how you want to authorize users for setting up the documentation vs. viewing it. Whurl
25
25
  comes with a default CanCan adapter. To us it install the cancan gem in your app and add a new whurl.rb to config/initializers:
26
26
 
27
- WhurlEngine.config do |config|
28
- config.current_user_method { current_user }
29
- config.authorize_with(:cancan)
30
- end
27
+ ```ruby
28
+ WhurlEngine.config do |config|
29
+ config.current_user_method { current_user }
30
+ config.authorize_with(:cancan)
31
+ end
32
+ ```
31
33
 
32
34
  ...and your ability.rb file looks like this:
33
35
 
34
- class Ability
35
- include CanCan::Ability
36
-
37
- def initialize(user)
38
- user ||= User.new # guest user (not logged in)
39
- if user.admin?
40
- can :manage, :all
41
- else
42
- can :read, :all
43
- can :access, :whurl_engine
44
- can :create, WhurlEngine::Whurl
45
- end
36
+ ```ruby
37
+ class Ability
38
+ include CanCan::Ability
39
+
40
+ def initialize(user)
41
+ user ||= User.new # guest user (not logged in)
42
+ if user.admin?
43
+ can :manage, :all
44
+ else
45
+ can :read, :all
46
+ can :access, :whurl_engine
47
+ can :create, WhurlEngine::Whurl
46
48
  end
47
49
  end
48
-
50
+ end
51
+ ```
49
52
 
50
53
  Finally, look at your new API playground by starting your rails server and hitting up the right URL:
51
54
 
@@ -53,7 +56,7 @@ Finally, look at your new API playground by starting your rails server and hitti
53
56
 
54
57
  ## Customize Whurl to Match Your Application
55
58
 
56
- Rails 3.1 Mountable Engines make it easy to override or extend many parts of Whurl.
59
+ Rails Mountable Engines make it easy to override or extend many parts of Whurl.
57
60
  If you need to override a method, view or partial, create the corresponding file in your
58
61
  main app directory and it will be used instead.
59
62
 
@@ -70,22 +73,4 @@ To do so, simply create a new application.html.haml in the corresponding directo
70
73
  \_ whurl_engine
71
74
  \_ application.html.haml
72
75
 
73
- ## Goals for this project
74
-
75
- Whurl is inspired by [hurl](http://hurl.it/), and the [Apigee Console](https://apigee.com/console/)
76
-
77
- * Use HTTPS for all requests, assume all users are passing sensitive data
78
- * Provide a usable tool for working with APIs
79
- * Further the use of Whurl through viral "whurls" - the urls that represent an API request
80
- * Prevent abuse - users should not be able to use Whurl as a proxy for a DoS attack or similar
81
-
82
- ## Note on Patches/Pull Requests
83
-
84
- * Fork the project.
85
- * Make your feature addition or bug fix.
86
- * Add tests for it. This is important so I don't break it in a
87
- future version unintentionally (actually, this should come before adding code, TDD!).
88
- * Commit, do not mess with rakefile, version, or history.
89
- (if you want to have your own version, that is fine but
90
- bump version in a commit by itself I can ignore when I pull)
91
- * Send me a pull request.
76
+ Whurl is inspired by [hurl](http://hurl.it/), and the [Apigee Console](https://apigee.com/console/)
@@ -1,6 +1,6 @@
1
1
  :javascript
2
2
  $(function() {
3
- $( ".new_whurl_engine_category, .edit_whurl_engine_category" ).dialog(
3
+ $( ".whurl_engine_category" ).dialog(
4
4
  {
5
5
  modal: true,
6
6
  autoOpen: false,
@@ -12,13 +12,13 @@
12
12
  }
13
13
  });
14
14
  });
15
-
16
- = form_for category, :remote => true do |f|
17
- %div
18
- = f.label :name
19
- = f.text_field :name, :placeholder => 'eg. Users, Projects, Tweets, etc.'
20
- %div
21
- = f.label :description
22
- %div
23
- = f.text_area :description
24
- = f.submit :value => 'Submit'
15
+ .whurl_engine_category
16
+ = form_for category, :remote => true do |f|
17
+ %div
18
+ = f.label :name
19
+ = f.text_field :name, :placeholder => 'eg. Users, Projects, Tweets, etc.'
20
+ %div
21
+ = f.label :description
22
+ %div
23
+ = f.text_area :description
24
+ = f.submit :value => 'Submit'
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:category => @category}))
2
2
  $('.content').append("#{content}");
3
- $('.edit_whurl_engine_category').dialog('open');
3
+ $('.whurl_engine_category').dialog('open');
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:category => @category}))
2
2
  $('.content').append("#{content}");
3
- $('.new_whurl_engine_category').dialog('open');
3
+ $('.whurl_engine_category').dialog('open');
@@ -1,6 +1,6 @@
1
1
  :javascript
2
2
  $(function() {
3
- $( ".new_whurl_engine_header_definition, .edit_whurl_engine_header_definition" ).dialog(
3
+ $( ".whurl_engine_header_definition" ).dialog(
4
4
  {
5
5
  modal: true,
6
6
  autoOpen: false,
@@ -12,20 +12,20 @@
12
12
  }
13
13
  });
14
14
  });
15
-
16
- = form_for(header_definition, :remote => true) do |f|
17
- = f.hidden_field :resource_id
18
- %div
19
- = f.label :name
20
- = f.text_field :name
21
- %div
22
- = f.check_box :required
23
- = f.label :required
24
- %div
25
- = f.label :example_value
26
- = f.text_field :example_value
27
- %div
28
- = f.label :description
29
- %div
30
- = f.text_area :description
31
- = f.submit :value => 'Submit'
15
+ .whurl_engine_header_definition
16
+ = form_for(header_definition, :remote => true) do |f|
17
+ = f.hidden_field :resource_id
18
+ %div
19
+ = f.label :name
20
+ = f.text_field :name
21
+ %div
22
+ = f.check_box :required
23
+ = f.label :required
24
+ %div
25
+ = f.label :example_value
26
+ = f.text_field :example_value
27
+ %div
28
+ = f.label :description
29
+ %div
30
+ = f.text_area :description
31
+ = f.submit :value => 'Submit'
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:header_definition => @header_definition}))
2
2
  $('.content').append("#{content}");
3
- $('.edit_whurl_engine_header_definition').dialog('open');
3
+ $('.whurl_engine_header_definition').dialog('open');
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:header_definition => @header_definition}))
2
2
  $('.content').append("#{content}");
3
- $('.new_whurl_engine_header_definition').dialog('open');
3
+ $('.whurl_engine_header_definition').dialog('open');
@@ -1,6 +1,6 @@
1
1
  :javascript
2
2
  $(function() {
3
- $( ".new_whurl_engine_parameter_definition, .edit_whurl_engine_parameter_definition" ).dialog(
3
+ $( ".whurl_engine_parameter_definition" ).dialog(
4
4
  {
5
5
  modal: true,
6
6
  autoOpen: false,
@@ -13,19 +13,20 @@
13
13
  });
14
14
  });
15
15
 
16
- = form_for(parameter_definition, :remote => true) do |f|
17
- = f.hidden_field :resource_id
18
- %div
19
- = f.label :name
20
- = f.text_field :name
21
- %div
22
- = f.check_box :required
23
- = f.label :required
24
- %div
25
- = f.label :example_value
26
- = f.text_field :example_value
27
- %div
28
- = f.label :description
29
- %div
30
- = f.text_area :description
31
- = f.submit :value => 'Submit'
16
+ .whurl_engine_parameter_definition
17
+ = form_for(parameter_definition, :remote => true) do |f|
18
+ = f.hidden_field :resource_id
19
+ %div
20
+ = f.label :name
21
+ = f.text_field :name
22
+ %div
23
+ = f.check_box :required
24
+ = f.label :required
25
+ %div
26
+ = f.label :example_value
27
+ = f.text_field :example_value
28
+ %div
29
+ = f.label :description
30
+ %div
31
+ = f.text_area :description
32
+ = f.submit :value => 'Submit'
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:parameter_definition => @parameter_definition}))
2
2
  $('.content').append("#{content}");
3
- $('.edit_whurl_engine_parameter_definition').dialog('open');
3
+ $('.whurl_engine_parameter_definition').dialog('open');
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:parameter_definition => @parameter_definition}))
2
2
  $('.content').append("#{content}");
3
- $('.new_whurl_engine_parameter_definition').dialog('open');
3
+ $('.whurl_engine_parameter_definition').dialog('open');
@@ -1,6 +1,6 @@
1
1
  :javascript
2
2
  $(function() {
3
- $( ".new_whurl_engine_resource, .edit_whurl_engine_resource" ).dialog(
3
+ $( ".whurl_engine_resource" ).dialog(
4
4
  {
5
5
  modal: true,
6
6
  autoOpen: false,
@@ -12,29 +12,29 @@
12
12
  }
13
13
  });
14
14
  });
15
-
16
- = form_for @resource, :remote => true do |f|
17
- = f.hidden_field :category_id
18
- %div
19
- = f.label :http_method
20
- = f.select(:http_method, options_for_select(['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'], 'GET'))
21
- %div
22
- = f.label :base_uri
23
- = f.text_field :base_uri, :placeholder => 'eg. https://api.twitter.com/1, https://api.groupon.com/v1, etc.'
24
- %div
25
- = f.label :relative_path
26
- = f.text_field :relative_path, :placeholder => 'eg. statuses/home_timeline, users/:id/edit, etc.'
27
- %div
28
- = f.check_box :rate_limited
29
- = f.label :rate_limited
30
- %div
31
- = f.check_box :requires_authentication
32
- = f.label :requires_authentication
33
- %div
34
- = f.label :response_formats
35
- = f.text_field :response_formats
36
- %div
37
- = f.label :description
38
- %div
39
- = f.text_area :description
40
- = f.submit :value => 'Submit'
15
+ .whurl_engine_resource
16
+ = form_for @resource, :remote => true do |f|
17
+ = f.hidden_field :category_id
18
+ %div
19
+ = f.label :http_method
20
+ = f.select(:http_method, options_for_select(['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'], 'GET'))
21
+ %div
22
+ = f.label :base_uri
23
+ = f.text_field :base_uri, :placeholder => 'eg. https://api.twitter.com/1, https://api.groupon.com/v1, etc.'
24
+ %div
25
+ = f.label :relative_path
26
+ = f.text_field :relative_path, :placeholder => 'eg. statuses/home_timeline, users/:id/edit, etc.'
27
+ %div
28
+ = f.check_box :rate_limited
29
+ = f.label :rate_limited
30
+ %div
31
+ = f.check_box :requires_authentication
32
+ = f.label :requires_authentication
33
+ %div
34
+ = f.label :response_formats
35
+ = f.text_field :response_formats
36
+ %div
37
+ = f.label :description
38
+ %div
39
+ = f.text_area :description
40
+ = f.submit :value => 'Submit'
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:resource => @resource}))
2
2
  $('.content').append("#{content}");
3
- $('.edit_whurl_engine_resource').dialog('open');
3
+ $('.whurl_engine_resource').dialog('open');
@@ -1,3 +1,3 @@
1
1
  - content = escape_javascript(render(:partial => 'form', :locals => {:resource => @resource}))
2
2
  $('.content').append("#{content}");
3
- $('.new_whurl_engine_resource').dialog('open');
3
+ $('.whurl_engine_resource').dialog('open');
@@ -13,17 +13,18 @@
13
13
  });
14
14
  });
15
15
 
16
- = form_for(whurl) do |f|
17
- %div
18
- = f.label :name
19
- = f.text_field :name, :value => whurl.name || whurl.response_headers['Status']
16
+ .edit_whurl_engine_whurl
17
+ = form_for(whurl) do |f|
18
+ %div
19
+ = f.label :name
20
+ = f.text_field :name, :value => whurl.name || whurl.response_headers['Status']
20
21
 
21
- %div
22
- = f.label :resource_id
23
- = f.select(:resource_id, option_groups_from_collection_for_select(WhurlEngine::Category.all, :resources, :name, :id, :relative_path))
22
+ %div
23
+ = f.label :resource_id
24
+ = f.select(:resource_id, option_groups_from_collection_for_select(WhurlEngine::Category.all, :resources, :name, :id, :relative_path))
24
25
 
25
- %div
26
- = f.label :description
27
- %div
28
- = f.text_area :description
29
- = f.submit :value => 'Submit'
26
+ %div
27
+ = f.label :description
28
+ %div
29
+ = f.text_area :description
30
+ = f.submit :value => 'Submit'
@@ -1,3 +1,3 @@
1
1
  module WhurlEngine
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whurl_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,23 +9,23 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-20 00:00:00.000000000 -08:00
12
+ date: 2012-02-27 00:00:00.000000000 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderay
17
- requirement: &2152434520 !ruby/object:Gem::Requirement
17
+ requirement: &2154609800 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.6
22
+ version: '0.9'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152434520
25
+ version_requirements: *2154609800
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: coffee-script
28
- requirement: &2152434100 !ruby/object:Gem::Requirement
28
+ requirement: &2154609340 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152434100
36
+ version_requirements: *2154609340
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: httmultiparty
39
- requirement: &2157985420 !ruby/object:Gem::Requirement
39
+ requirement: &2154608680 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,65 +44,65 @@ dependencies:
44
44
  version: '0.2'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2157985420
47
+ version_requirements: *2154608680
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml
50
- requirement: &2157984920 !ruby/object:Gem::Requirement
50
+ requirement: &2154608000 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 3.1.4
55
+ version: '3.1'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2157984920
58
+ version_requirements: *2154608000
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: json
61
- requirement: &2157984460 !ruby/object:Gem::Requirement
61
+ requirement: &2154607420 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
65
65
  - !ruby/object:Gem::Version
66
- version: 1.5.1
66
+ version: '1.5'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2157984460
69
+ version_requirements: *2154607420
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rails
72
- requirement: &2157984000 !ruby/object:Gem::Requirement
72
+ requirement: &2154606780 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 3.1.3
77
+ version: '3.1'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2157984000
80
+ version_requirements: *2154606780
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rinku
83
- requirement: &2157983540 !ruby/object:Gem::Requirement
83
+ requirement: &2154606200 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
87
87
  - !ruby/object:Gem::Version
88
- version: 1.5.0
88
+ version: '1.5'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2157983540
91
+ version_requirements: *2154606200
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: sass
94
- requirement: &2157983080 !ruby/object:Gem::Requirement
94
+ requirement: &2154605620 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
98
98
  - !ruby/object:Gem::Version
99
- version: 3.1.10
99
+ version: '3.1'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2157983080
102
+ version_requirements: *2154605620
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: uglifier
105
- requirement: &2157982700 !ruby/object:Gem::Requirement
105
+ requirement: &2154605160 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :runtime
112
112
  prerelease: false
113
- version_requirements: *2157982700
113
+ version_requirements: *2154605160
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: heroku
116
- requirement: &2157982240 !ruby/object:Gem::Requirement
116
+ requirement: &2154604540 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *2157982240
124
+ version_requirements: *2154604540
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mysql
127
- requirement: &2157981740 !ruby/object:Gem::Requirement
127
+ requirement: &2154603940 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ~>
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: 2.8.1
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *2157981740
135
+ version_requirements: *2154603940
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: webmock
138
- requirement: &2157981240 !ruby/object:Gem::Requirement
138
+ requirement: &2154603400 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ~>
@@ -143,7 +143,7 @@ dependencies:
143
143
  version: 1.7.10
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *2157981240
146
+ version_requirements: *2154603400
147
147
  description: ! "Whurl is a mountable engine for Rails 3.1+ apps allowing\n you
148
148
  to show the functionality of your API. You can save API calls and share them with
149
149
  your team or the public."