acts_as_api_sequel 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +13 -0
  5. data/History.txt +108 -0
  6. data/README.md +126 -0
  7. data/Rakefile +48 -0
  8. data/acts_as_api.gemspec +28 -0
  9. data/examples/introduction/docco.css +186 -0
  10. data/examples/introduction/index.html +338 -0
  11. data/examples/introduction/index.rb +144 -0
  12. data/examples/introduction/layout.mustache +67 -0
  13. data/lib/acts_as_api.rb +46 -0
  14. data/lib/acts_as_api/adapters.rb +5 -0
  15. data/lib/acts_as_api/adapters/mongoid.rb +11 -0
  16. data/lib/acts_as_api/api_template.rb +139 -0
  17. data/lib/acts_as_api/array.rb +21 -0
  18. data/lib/acts_as_api/base.rb +88 -0
  19. data/lib/acts_as_api/config.rb +58 -0
  20. data/lib/acts_as_api/exceptions.rb +4 -0
  21. data/lib/acts_as_api/rails_renderer.rb +17 -0
  22. data/lib/acts_as_api/rendering.rb +95 -0
  23. data/lib/acts_as_api/responder.rb +39 -0
  24. data/lib/acts_as_api/version.rb +3 -0
  25. data/spec/README.md +55 -0
  26. data/spec/active_record_dummy/.gitignore +15 -0
  27. data/spec/active_record_dummy/Gemfile +16 -0
  28. data/spec/active_record_dummy/README.rdoc +261 -0
  29. data/spec/active_record_dummy/Rakefile +7 -0
  30. data/spec/active_record_dummy/app/assets/images/rails.png +0 -0
  31. data/spec/active_record_dummy/app/assets/javascripts/application.js +15 -0
  32. data/spec/active_record_dummy/app/assets/stylesheets/application.css +13 -0
  33. data/spec/active_record_dummy/app/controllers/application_controller.rb +3 -0
  34. data/spec/active_record_dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/active_record_dummy/app/mailers/.gitkeep +0 -0
  36. data/spec/active_record_dummy/app/models/.gitkeep +0 -0
  37. data/spec/active_record_dummy/app/models/profile.rb +4 -0
  38. data/spec/active_record_dummy/app/models/task.rb +4 -0
  39. data/spec/active_record_dummy/app/models/untouched.rb +2 -0
  40. data/spec/active_record_dummy/app/models/user.rb +186 -0
  41. data/spec/active_record_dummy/app/views/layouts/application.html.erb +14 -0
  42. data/spec/active_record_dummy/config.ru +4 -0
  43. data/spec/active_record_dummy/config/application.rb +59 -0
  44. data/spec/active_record_dummy/config/boot.rb +6 -0
  45. data/spec/active_record_dummy/config/database.yml +25 -0
  46. data/spec/active_record_dummy/config/environment.rb +5 -0
  47. data/spec/active_record_dummy/config/environments/development.rb +37 -0
  48. data/spec/active_record_dummy/config/environments/production.rb +67 -0
  49. data/spec/active_record_dummy/config/environments/test.rb +37 -0
  50. data/spec/active_record_dummy/config/initializers/backtrace_silencers.rb +7 -0
  51. data/spec/active_record_dummy/config/initializers/generators.rb +2 -0
  52. data/spec/active_record_dummy/config/initializers/inflections.rb +15 -0
  53. data/spec/active_record_dummy/config/initializers/mime_types.rb +5 -0
  54. data/spec/active_record_dummy/config/initializers/secret_token.rb +7 -0
  55. data/spec/active_record_dummy/config/initializers/session_store.rb +8 -0
  56. data/spec/active_record_dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/spec/active_record_dummy/config/locales/en.yml +5 -0
  58. data/spec/active_record_dummy/config/routes.rb +59 -0
  59. data/spec/active_record_dummy/db/migrate/20110214201640_create_tables.rb +44 -0
  60. data/spec/active_record_dummy/db/schema.rb +47 -0
  61. data/spec/active_record_dummy/db/seeds.rb +7 -0
  62. data/spec/active_record_dummy/doc/README_FOR_APP +2 -0
  63. data/spec/active_record_dummy/lib/assets/.gitkeep +0 -0
  64. data/spec/active_record_dummy/lib/tasks/.gitkeep +0 -0
  65. data/spec/active_record_dummy/log/.gitkeep +0 -0
  66. data/spec/active_record_dummy/public/404.html +26 -0
  67. data/spec/active_record_dummy/public/422.html +26 -0
  68. data/spec/active_record_dummy/public/500.html +25 -0
  69. data/spec/active_record_dummy/public/favicon.ico +0 -0
  70. data/spec/active_record_dummy/public/index.html +241 -0
  71. data/spec/active_record_dummy/public/robots.txt +5 -0
  72. data/spec/active_record_dummy/script/rails +6 -0
  73. data/spec/active_record_dummy/vendor/assets/javascripts/.gitkeep +0 -0
  74. data/spec/active_record_dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  75. data/spec/active_record_dummy/vendor/plugins/.gitkeep +0 -0
  76. data/spec/controllers/plain_objects_controller_spec.rb +36 -0
  77. data/spec/controllers/respond_with_users_controller_spec.rb +142 -0
  78. data/spec/controllers/users_controller_spec.rb +15 -0
  79. data/spec/models/model_spec.rb +31 -0
  80. data/spec/mongoid_dummy/.gitignore +15 -0
  81. data/spec/mongoid_dummy/Gemfile +18 -0
  82. data/spec/mongoid_dummy/README.rdoc +261 -0
  83. data/spec/mongoid_dummy/Rakefile +7 -0
  84. data/spec/mongoid_dummy/app/assets/images/rails.png +0 -0
  85. data/spec/mongoid_dummy/app/assets/javascripts/application.js +15 -0
  86. data/spec/mongoid_dummy/app/assets/stylesheets/application.css +13 -0
  87. data/spec/mongoid_dummy/app/controllers/application_controller.rb +3 -0
  88. data/spec/mongoid_dummy/app/helpers/application_helper.rb +2 -0
  89. data/spec/mongoid_dummy/app/mailers/.gitkeep +0 -0
  90. data/spec/mongoid_dummy/app/models/.gitkeep +0 -0
  91. data/spec/mongoid_dummy/app/models/profile.rb +10 -0
  92. data/spec/mongoid_dummy/app/models/task.rb +12 -0
  93. data/spec/mongoid_dummy/app/models/untouched.rb +7 -0
  94. data/spec/mongoid_dummy/app/models/user.rb +48 -0
  95. data/spec/mongoid_dummy/app/views/layouts/application.html.erb +14 -0
  96. data/spec/mongoid_dummy/config.ru +4 -0
  97. data/spec/mongoid_dummy/config/application.rb +65 -0
  98. data/spec/mongoid_dummy/config/boot.rb +6 -0
  99. data/spec/mongoid_dummy/config/environment.rb +5 -0
  100. data/spec/mongoid_dummy/config/environments/development.rb +31 -0
  101. data/spec/mongoid_dummy/config/environments/production.rb +64 -0
  102. data/spec/mongoid_dummy/config/environments/test.rb +35 -0
  103. data/spec/mongoid_dummy/config/initializers/backtrace_silencers.rb +7 -0
  104. data/spec/mongoid_dummy/config/initializers/generators.rb +2 -0
  105. data/spec/mongoid_dummy/config/initializers/include_acts_as_api.rb +3 -0
  106. data/spec/mongoid_dummy/config/initializers/inflections.rb +15 -0
  107. data/spec/mongoid_dummy/config/initializers/mime_types.rb +5 -0
  108. data/spec/mongoid_dummy/config/initializers/secret_token.rb +7 -0
  109. data/spec/mongoid_dummy/config/initializers/session_store.rb +8 -0
  110. data/spec/mongoid_dummy/config/initializers/wrap_parameters.rb +10 -0
  111. data/spec/mongoid_dummy/config/locales/en.yml +5 -0
  112. data/spec/mongoid_dummy/config/mongoid.yml +120 -0
  113. data/spec/mongoid_dummy/config/routes.rb +59 -0
  114. data/spec/mongoid_dummy/db/seeds.rb +7 -0
  115. data/spec/mongoid_dummy/doc/README_FOR_APP +2 -0
  116. data/spec/mongoid_dummy/lib/assets/.gitkeep +0 -0
  117. data/spec/mongoid_dummy/lib/tasks/.gitkeep +0 -0
  118. data/spec/mongoid_dummy/log/.gitkeep +0 -0
  119. data/spec/mongoid_dummy/public/404.html +26 -0
  120. data/spec/mongoid_dummy/public/422.html +26 -0
  121. data/spec/mongoid_dummy/public/500.html +25 -0
  122. data/spec/mongoid_dummy/public/favicon.ico +0 -0
  123. data/spec/mongoid_dummy/public/index.html +241 -0
  124. data/spec/mongoid_dummy/public/robots.txt +5 -0
  125. data/spec/mongoid_dummy/script/rails +6 -0
  126. data/spec/mongoid_dummy/vendor/assets/javascripts/.gitkeep +0 -0
  127. data/spec/mongoid_dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  128. data/spec/mongoid_dummy/vendor/plugins/.gitkeep +0 -0
  129. data/spec/shared_engine/.gitignore +7 -0
  130. data/spec/shared_engine/Gemfile +14 -0
  131. data/spec/shared_engine/MIT-LICENSE +20 -0
  132. data/spec/shared_engine/README.rdoc +3 -0
  133. data/spec/shared_engine/Rakefile +29 -0
  134. data/spec/shared_engine/app/assets/images/shared_engine/.gitkeep +0 -0
  135. data/spec/shared_engine/app/assets/javascripts/shared_engine/application.js +15 -0
  136. data/spec/shared_engine/app/assets/stylesheets/shared_engine/application.css +13 -0
  137. data/spec/shared_engine/app/controllers/shared_engine/application_controller.rb +4 -0
  138. data/spec/shared_engine/app/controllers/shared_engine/plain_objects_controller.rb +14 -0
  139. data/spec/shared_engine/app/controllers/shared_engine/respond_with_users_controller.rb +64 -0
  140. data/spec/shared_engine/app/controllers/shared_engine/users_controller.rb +71 -0
  141. data/spec/shared_engine/app/helpers/shared_engine/application_helper.rb +4 -0
  142. data/spec/shared_engine/app/models/plain_object.rb +17 -0
  143. data/spec/shared_engine/app/models/user_template.rb +154 -0
  144. data/spec/shared_engine/app/views/layouts/shared_engine/application.html.erb +14 -0
  145. data/spec/shared_engine/config/routes.rb +28 -0
  146. data/spec/shared_engine/dummy/README.rdoc +261 -0
  147. data/spec/shared_engine/dummy/Rakefile +7 -0
  148. data/spec/shared_engine/dummy/app/assets/javascripts/application.js +15 -0
  149. data/spec/shared_engine/dummy/app/assets/stylesheets/application.css +13 -0
  150. data/spec/shared_engine/dummy/app/controllers/application_controller.rb +3 -0
  151. data/spec/shared_engine/dummy/app/helpers/application_helper.rb +2 -0
  152. data/spec/shared_engine/dummy/app/mailers/.gitkeep +0 -0
  153. data/spec/shared_engine/dummy/app/models/.gitkeep +0 -0
  154. data/spec/shared_engine/dummy/app/views/layouts/application.html.erb +14 -0
  155. data/spec/shared_engine/dummy/config.ru +4 -0
  156. data/spec/shared_engine/dummy/config/application.rb +62 -0
  157. data/spec/shared_engine/dummy/config/boot.rb +10 -0
  158. data/spec/shared_engine/dummy/config/database.yml +25 -0
  159. data/spec/shared_engine/dummy/config/environment.rb +5 -0
  160. data/spec/shared_engine/dummy/config/environments/development.rb +37 -0
  161. data/spec/shared_engine/dummy/config/environments/production.rb +67 -0
  162. data/spec/shared_engine/dummy/config/environments/test.rb +37 -0
  163. data/spec/shared_engine/dummy/config/initializers/backtrace_silencers.rb +7 -0
  164. data/spec/shared_engine/dummy/config/initializers/inflections.rb +15 -0
  165. data/spec/shared_engine/dummy/config/initializers/mime_types.rb +5 -0
  166. data/spec/shared_engine/dummy/config/initializers/secret_token.rb +7 -0
  167. data/spec/shared_engine/dummy/config/initializers/session_store.rb +8 -0
  168. data/spec/shared_engine/dummy/config/initializers/wrap_parameters.rb +14 -0
  169. data/spec/shared_engine/dummy/config/locales/en.yml +5 -0
  170. data/spec/shared_engine/dummy/config/routes.rb +4 -0
  171. data/spec/shared_engine/dummy/lib/assets/.gitkeep +0 -0
  172. data/spec/shared_engine/dummy/log/.gitkeep +0 -0
  173. data/spec/shared_engine/dummy/public/404.html +26 -0
  174. data/spec/shared_engine/dummy/public/422.html +26 -0
  175. data/spec/shared_engine/dummy/public/500.html +25 -0
  176. data/spec/shared_engine/dummy/public/favicon.ico +0 -0
  177. data/spec/shared_engine/dummy/script/rails +6 -0
  178. data/spec/shared_engine/lib/magic/rails/engine.rb +69 -0
  179. data/spec/shared_engine/lib/shared_engine.rb +4 -0
  180. data/spec/shared_engine/lib/shared_engine/engine.rb +5 -0
  181. data/spec/shared_engine/lib/shared_engine/version.rb +3 -0
  182. data/spec/shared_engine/lib/tasks/shared_engine_tasks.rake +4 -0
  183. data/spec/shared_engine/script/rails +8 -0
  184. data/spec/shared_engine/shared_engine.gemspec +22 -0
  185. data/spec/spec.opts +1 -0
  186. data/spec/spec_helper.rb +22 -0
  187. data/spec/support/api_test_helpers.rb +23 -0
  188. data/spec/support/controller_examples.rb +458 -0
  189. data/spec/support/it_supports.rb +3 -0
  190. data/spec/support/model_examples/associations.rb +272 -0
  191. data/spec/support/model_examples/callbacks.rb +38 -0
  192. data/spec/support/model_examples/closures.rb +49 -0
  193. data/spec/support/model_examples/conditional_if.rb +165 -0
  194. data/spec/support/model_examples/conditional_unless.rb +165 -0
  195. data/spec/support/model_examples/enabled.rb +10 -0
  196. data/spec/support/model_examples/extending.rb +112 -0
  197. data/spec/support/model_examples/methods.rb +23 -0
  198. data/spec/support/model_examples/options.rb +53 -0
  199. data/spec/support/model_examples/renaming.rb +50 -0
  200. data/spec/support/model_examples/simple.rb +23 -0
  201. data/spec/support/model_examples/sub_nodes.rb +105 -0
  202. data/spec/support/model_examples/undefined.rb +7 -0
  203. data/spec/support/model_examples/untouched.rb +13 -0
  204. data/spec/support/routing.rb +4 -0
  205. data/spec/support/simple_fixtures.rb +59 -0
  206. metadata +499 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d82a3f078dfaaf88beec7b3210cbc1b53e95b79
4
+ data.tar.gz: 0b7c7a359449a41db7a3b711dadf656a81e991b8
5
+ SHA512:
6
+ metadata.gz: c7f6a77c0be31f58b7ef7cad39c2aa7468b7b2491ce7e61b25bc7a95eac51f3d329f3a4b509003c986b6905055c2be8e90d39ff52fc7baa4b05944e66b83b72b
7
+ data.tar.gz: 1de3320e5dccc7b079b27805a0efb2b4fd3d0e680ef7b9bd5f13b0e88a7a81348449070089e0bf1907f79671616054b9eedff8098d5dfc0f09542b30cf0844d1
@@ -0,0 +1,14 @@
1
+ nbproject/
2
+ pkg/*
3
+ .bundle
4
+ Gemfile.lock
5
+ test
6
+ acts_as_api.tmproj
7
+ spec/active_record_dummy/db/*.sqlite3
8
+ spec/active_record_dummy/tmp/**/*
9
+ spec/active_record_dummy/log/*.log
10
+ spec/mongoid_dummy/tmp/**/*
11
+ spec/mongoid_dummy/log/*.log
12
+ .rspec
13
+ .rvmrc
14
+ *.sqlite3-journal
@@ -0,0 +1,5 @@
1
+ script: bundle exec rake spec:all
2
+ services:
3
+ - mongodb
4
+ rvm:
5
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in acts_as_api.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'sqlite3-ruby'
8
+ gem 'mongoid', '>= 3.0.1'
9
+ gem 'rspec', '>= 2.9.0'
10
+ gem 'rspec-rails', '>= 2.5.0'
11
+ gem 'webrat'
12
+ gem 'shared_engine', :path => './spec/shared_engine'
13
+ end
@@ -0,0 +1,108 @@
1
+ === 0.4.2 2013-12-28
2
+
3
+ * Fixed problem with rendering of POROs (see PR #88)
4
+
5
+ === 0.4.1 2012-07-18
6
+
7
+ * Added support for Mongoid 3
8
+
9
+ === 0.4 2012-04-30
10
+
11
+ * Added support for a second parameter (options) to pass to as_api_response
12
+
13
+ === 0.3.11 2011-11-06
14
+
15
+ * Added :postfix, :prefix options for template rendering
16
+
17
+ === 0.3.10 2011-10-03
18
+
19
+ * Fixed Mongoid problems, when no ActiveRecord is available (Ticket #36)
20
+
21
+ === 0.3.9 2011-09-24
22
+
23
+ * Spec suite now running on Rails 3.1
24
+ * Fixed naming issue with ActiveRecord::Relation (Ticket #35)
25
+
26
+ === 0.3.8 2011-06-21
27
+
28
+ * Fixed Rails 3.1 deprecation warning
29
+
30
+ === 0.3.7 2011-06-13
31
+
32
+ * Added before/around/after callbacks
33
+
34
+ === 0.3.6 2011-05-13
35
+
36
+ * Finally added Mongoid Support out of the box
37
+ * Support for Rails 3 Responders
38
+
39
+ === 0.3.4 2011-04-26
40
+
41
+ * Fixed a bug concerning the inheritance of sub templates/additional options
42
+
43
+ === 0.3.3 2011-04-24
44
+
45
+ * Added support for :if and :unless options
46
+
47
+ === 0.3.2 2011-04-20
48
+
49
+ * Raise an exception if a specified api template is not found
50
+
51
+ === 0.3.1 2011-04-08
52
+
53
+ * Added the :template option to specify sub templates
54
+
55
+ * Fixed a bug concerning extended api templates
56
+
57
+ === 0.3.0 2011-02-22
58
+
59
+ * Added bundler support
60
+
61
+ * Added mongoid support
62
+
63
+ * Removed lots of unnecessary dependencies esp. ActiveRecord
64
+
65
+ === 0.2.2 2010-10-21
66
+
67
+ * Version bump only for changing the github account in the docs.
68
+
69
+ === 0.2.1 2010-09-20
70
+
71
+ * Updated to work with Rails 3.0.0
72
+
73
+ * Added support for multiple renderings of the same model (e.g. useful for versioning).
74
+ Note that the interface of acts as api changed, soyou have to update your code.
75
+
76
+ * Updated dependecies to user Rails 3.0.0 libs instead of beta.
77
+
78
+ === 0.1.10 2010-07-23
79
+
80
+ * More Bugfixes. When you want to render an Array of records (e.g. from MyRecord.all)
81
+ make sure you pass the :root options to render_as_api - in case it will return an empty array
82
+
83
+ === 0.1.7 2010-07-05
84
+
85
+ * Fixed bug with multi-word models.
86
+
87
+ === 0.1.4 2010-07-04
88
+
89
+ * Added better documentation.
90
+
91
+ === 0.1.3 2010-07-04
92
+
93
+ * Support for including methods of associated models.
94
+ * Better root name determination for arrays.
95
+
96
+ === 0.0.3 2010-07-01
97
+
98
+ * 1 small bugfix
99
+
100
+ === 0.0.2 2010-07-01
101
+
102
+ * 1 major enhancement:
103
+ * Added a wrapping root node for JSON responses by default.
104
+
105
+ === 0.0.1 2010-06-27
106
+
107
+ * 1 major enhancement:
108
+ * Initial release
@@ -0,0 +1,126 @@
1
+ # acts_as_api ![acts_as_api on travis ci](https://secure.travis-ci.org/fabrik42/acts_as_api.png?branch=master)
2
+
3
+ acts_as_api makes creating XML/JSON responses in Rails 3 easy and fun.
4
+
5
+ It provides a simple interface to determine the representation of your model data, that should be rendered in your API responses.
6
+
7
+ In addition to Rails it theoretically can be used with any ruby app and any database (__ActiveRecord__ and __Mongoid__ are supported out of the box) as it only has few dependencies.
8
+
9
+ The lib is _very_ fast in generating your responses and battle tested in production with platforms like [Diaspora](https://joindiaspora.com) or [flinc](https://flinc.org).
10
+
11
+ ## Introduction
12
+
13
+ acts_as_api enriches the models and controllers of your app in a Rails-like way so you can easily determine how your API responses should look like:
14
+
15
+ ```ruby
16
+ class User < ActiveRecord::Base
17
+
18
+ acts_as_api
19
+
20
+ api_accessible :public do |template|
21
+ template.add :first_name
22
+ template.add :age
23
+ end
24
+ # will render json: { "user": { "first_name": "John", "age": 26 } }
25
+
26
+ api_accessible :private, :extend => :public do |template|
27
+ template.add :last_name
28
+ template.add :email
29
+ end
30
+ # will render json: { "user": { "first_name": "John", "last_name": "Doe", "age": 26, "email": "john@example.org" } }
31
+
32
+ end
33
+ ```
34
+
35
+ ## Getting started
36
+
37
+ A nice introduction about acts_as_api with examples can be found here:
38
+
39
+ http://fabrik42.github.com/acts_as_api
40
+
41
+ See the Wiki for a lot of usage examples and features:
42
+
43
+ https://github.com/fabrik42/acts_as_api/wiki
44
+
45
+ There are a lot of how-tos like:
46
+
47
+ * [Extending existing api templates](https://github.com/fabrik42/acts_as_api/wiki/Extending-an-existing-api-template)
48
+ * [Include attributes and all other kinds of methods of your model](https://github.com/fabrik42/acts_as_api/wiki/Calling-a-method-of-the-model)
49
+ * [Include child associations (if they also act_as_api this will be considered)](https://github.com/fabrik42/acts_as_api/wiki/Including-a-child-association)
50
+ * [Rename attributes, methods, associations](https://github.com/fabrik42/acts_as_api/wiki/Renaming-an-attribute)
51
+ * [Keep your API templates out of your models](https://github.com/fabrik42/acts_as_api/wiki/Keep-your-api-templates-out-of-your-models)
52
+ * [and much more...](https://github.com/fabrik42/acts_as_api/wiki)
53
+
54
+ ## Features:
55
+
56
+ * DRY templates for your api responses
57
+ * Ships with support for __ActiveRecord__ and __Mongoid__
58
+ * Support for Rails 3 Responders
59
+ * Plays very well together with client libs like [Backbone.js](http://documentcloud.github.com/backbone), [RestKit](http://restkit.org) (iOS) or [gson](http://code.google.com/p/google-gson) (Android).
60
+ * Easy but very flexible syntax for defining the templates
61
+ * XML, JSON and JSON-P support out of the box, easy to extend
62
+ * Minimal dependecies (you can also use it without Rails)
63
+ * Supports multiple api rendering templates per model. This is especially useful for API versioning or for example for private vs. public access points to a user’s profile.
64
+
65
+ ### Requirements:
66
+
67
+ * ActiveModel (>= 3.0.0)
68
+ * ActiveSupport (>= 3.0.0)
69
+ * Rack (>= 1.1.0)
70
+
71
+ ### Links
72
+
73
+ * Introduction: http://fabrik42.github.com/acts_as_api
74
+
75
+ * Docs: http://rdoc.info/projects/fabrik42/acts_as_api
76
+
77
+ * Found a bug? http://github.com/fabrik42/acts_as_api/issues
78
+
79
+ * Wiki: https://github.com/fabrik42/acts_as_api/wiki
80
+
81
+ * Want to contribute - the spec suite is explained here: https://github.com/fabrik42/acts_as_api/tree/master/spec
82
+
83
+ ### Travis CI build status ![acts_as_api on travis ci](https://secure.travis-ci.org/fabrik42/acts_as_api.png?branch=master)
84
+
85
+ Specs run with 1.9.3: http://travis-ci.org/#!/fabrik42/acts_as_api
86
+
87
+ ### Tested with:
88
+
89
+ It has been used in production with the following ruby versions.
90
+
91
+ They are not integrated in Travis, because optional dependencies (like Mongoid 3) don't support these Ruby versions.
92
+
93
+ * MRI 1.9.3-p125
94
+ * MRI 1.9.2-p290
95
+ * MRI 1.8.7-p358
96
+ * But it just should work fine with other versions too... :)
97
+
98
+ ### Downwards Compatibility
99
+
100
+ Note that upgrading to 0.3.0 will break code that worked with previous versions due to a complete overhaul of the lib.
101
+ For a legacy version of this readme file look here: https://github.com/fabrik42/acts_as_api/wiki/legacy-acts_as_api-0.2-readme
102
+
103
+ ### LICENSE:
104
+
105
+ (The MIT License)
106
+
107
+ Copyright (c) 2010 Christian Bäuerlein
108
+
109
+ Permission is hereby granted, free of charge, to any person obtaining
110
+ a copy of this software and associated documentation files (the
111
+ 'Software'), to deal in the Software without restriction, including
112
+ without limitation the rights to use, copy, modify, merge, publish,
113
+ distribute, sublicense, and/or sell copies of the Software, and to
114
+ permit persons to whom the Software is furnished to do so, subject to
115
+ the following conditions:
116
+
117
+ The above copyright notice and this permission notice shall be
118
+ included in all copies or substantial portions of the Software.
119
+
120
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
121
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
123
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
124
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
125
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
126
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ require 'bundler'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ namespace :spec do
10
+
11
+ supported_orms = %w(mongoid active_record)
12
+
13
+ supported_orms.each do |orm|
14
+ desc "Run #{orm} specs only"
15
+ RSpec::Core::RakeTask.new(orm) do |t|
16
+ t.rspec_opts = ["--color"]
17
+ end
18
+
19
+ task "prepare_#{orm}" do
20
+ ENV['ACTS_AS_API_ORM'] = orm
21
+ end
22
+
23
+ Rake::Task["spec:#{orm}"].prerequisites << "spec:prepare_#{orm}"
24
+ end
25
+
26
+
27
+ # task :all => supported_orms.map{|orm| "spec:#{orm}"}
28
+
29
+ desc "Runs specs for all ORMs (#{supported_orms.join(', ')})"
30
+ task :all do
31
+ supported_orms.each do |orm|
32
+ puts "Starting to run specs for #{orm}..."
33
+ system("bundle exec rake spec:#{orm}")
34
+ raise "#{orm} failed!" unless $?.exitstatus == 0
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+
41
+ gemspec = Gem::Specification.load("acts_as_api.gemspec")
42
+
43
+ task :default => "spec:all"
44
+
45
+ desc "Generate the gh_pages site"
46
+ task :rocco do
47
+ system "bundle exec rocco examples/introduction/index.rb -t examples/introduction/layout.mustache"
48
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "acts_as_api/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "acts_as_api_sequel"
7
+ s.version = ActsAsApi::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Roupen Mouradian"]
10
+ s.email = ["roupen.mouradian@gmail.com"]
11
+ s.homepage = "https://github.com/roupen/acts_as_api"
12
+ s.summary = %q{Original acts_as_api library by Christian Bäuerlein with sequel}
13
+ s.description = %q{acts_as_api library adjusted to support sequel models}
14
+
15
+ s.add_dependency('activemodel','>= 3.0.0')
16
+ s.add_dependency('activesupport','>= 3.0.0')
17
+ s.add_dependency('rack','>= 1.1.0')
18
+
19
+ s.add_development_dependency('rails', ['>= 3.2.16'])
20
+ s.add_development_dependency('mongoid', ['>= 3.0.1'])
21
+
22
+ s.rdoc_options = ['--charset=UTF-8']
23
+
24
+ s.files = `git ls-files`.split("\n")
25
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
+ s.require_paths = ["lib"]
28
+ end
@@ -0,0 +1,186 @@
1
+ /*--------------------- Layout and Typography ----------------------------*/
2
+ body {
3
+ font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
4
+ font-size: 15px;
5
+ line-height: 22px;
6
+ color: #252519;
7
+ margin: 0; padding: 0;
8
+ }
9
+ a {
10
+ color: #261a3b;
11
+ }
12
+ a:visited {
13
+ color: #261a3b;
14
+ }
15
+ p {
16
+ margin: 0 0 15px 0;
17
+ }
18
+ h1, h2, h3, h4, h5, h6 {
19
+ margin: 0px 0 15px 0;
20
+ }
21
+ h1 {
22
+ margin-top: 40px;
23
+ }
24
+ #container {
25
+ position: relative;
26
+ }
27
+ #background {
28
+ position: fixed;
29
+ top: 0; left: 525px; right: 0; bottom: 0;
30
+ background: #f5f5ff;
31
+ border-left: 1px solid #e5e5ee;
32
+ z-index: -1;
33
+ }
34
+ #jump_to, #jump_page {
35
+ background: white;
36
+ -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
37
+ -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
38
+ font: 10px Arial;
39
+ text-transform: uppercase;
40
+ cursor: pointer;
41
+ text-align: right;
42
+ }
43
+ #jump_to, #jump_wrapper {
44
+ position: fixed;
45
+ right: 0; top: 0;
46
+ padding: 5px 10px;
47
+ }
48
+ #jump_wrapper {
49
+ padding: 0;
50
+ display: none;
51
+ }
52
+ #jump_to:hover #jump_wrapper {
53
+ display: block;
54
+ }
55
+ #jump_page {
56
+ padding: 5px 0 3px;
57
+ margin: 0 0 25px 25px;
58
+ }
59
+ #jump_page .source {
60
+ display: block;
61
+ padding: 5px 10px;
62
+ text-decoration: none;
63
+ border-top: 1px solid #eee;
64
+ }
65
+ #jump_page .source:hover {
66
+ background: #f5f5ff;
67
+ }
68
+ #jump_page .source:first-child {
69
+ }
70
+ table td {
71
+ border: 0;
72
+ outline: 0;
73
+ }
74
+ td.docs, th.docs {
75
+ max-width: 450px;
76
+ min-width: 450px;
77
+ min-height: 5px;
78
+ padding: 10px 25px 1px 50px;
79
+ overflow-x: hidden;
80
+ vertical-align: top;
81
+ text-align: left;
82
+ }
83
+ .docs pre {
84
+ margin: 15px 0 15px;
85
+ padding-left: 15px;
86
+ }
87
+ .docs p tt, .docs p code {
88
+ background: #f8f8ff;
89
+ border: 1px solid #dedede;
90
+ font-size: 12px;
91
+ padding: 0 0.2em;
92
+ }
93
+ .pilwrap {
94
+ position: relative;
95
+ }
96
+ .pilcrow {
97
+ font: 12px Arial;
98
+ text-decoration: none;
99
+ color: #454545;
100
+ position: absolute;
101
+ top: 3px; left: -20px;
102
+ padding: 1px 2px;
103
+ opacity: 0;
104
+ -webkit-transition: opacity 0.2s linear;
105
+ }
106
+ td.docs:hover .pilcrow {
107
+ opacity: 1;
108
+ }
109
+ td.code, th.code {
110
+ padding: 14px 15px 16px 25px;
111
+ width: 100%;
112
+ vertical-align: top;
113
+ background: #f5f5ff;
114
+ border-left: 1px solid #e5e5ee;
115
+ }
116
+ pre, tt, code {
117
+ font-size: 12px; line-height: 18px;
118
+ font-family: Monaco, Consolas, "Lucida Console", monospace;
119
+ margin: 0; padding: 0;
120
+ }
121
+
122
+
123
+ /*---------------------- Syntax Highlighting -----------------------------*/
124
+ td.linenos { background-color: #f0f0f0; padding-right: 10px; }
125
+ span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
126
+ body .hll { background-color: #ffffcc }
127
+ body .c { color: #408080; font-style: italic } /* Comment */
128
+ body .err { border: 1px solid #FF0000 } /* Error */
129
+ body .k { color: #954121 } /* Keyword */
130
+ body .o { color: #666666 } /* Operator */
131
+ body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
132
+ body .cp { color: #BC7A00 } /* Comment.Preproc */
133
+ body .c1 { color: #408080; font-style: italic } /* Comment.Single */
134
+ body .cs { color: #408080; font-style: italic } /* Comment.Special */
135
+ body .gd { color: #A00000 } /* Generic.Deleted */
136
+ body .ge { font-style: italic } /* Generic.Emph */
137
+ body .gr { color: #FF0000 } /* Generic.Error */
138
+ body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
139
+ body .gi { color: #00A000 } /* Generic.Inserted */
140
+ body .go { color: #808080 } /* Generic.Output */
141
+ body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
142
+ body .gs { font-weight: bold } /* Generic.Strong */
143
+ body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
144
+ body .gt { color: #0040D0 } /* Generic.Traceback */
145
+ body .kc { color: #954121 } /* Keyword.Constant */
146
+ body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
147
+ body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
148
+ body .kp { color: #954121 } /* Keyword.Pseudo */
149
+ body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
150
+ body .kt { color: #B00040 } /* Keyword.Type */
151
+ body .m { color: #666666 } /* Literal.Number */
152
+ body .s { color: #219161 } /* Literal.String */
153
+ body .na { color: #7D9029 } /* Name.Attribute */
154
+ body .nb { color: #954121 } /* Name.Builtin */
155
+ body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
156
+ body .no { color: #880000 } /* Name.Constant */
157
+ body .nd { color: #AA22FF } /* Name.Decorator */
158
+ body .ni { color: #999999; font-weight: bold } /* Name.Entity */
159
+ body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
160
+ body .nf { color: #0000FF } /* Name.Function */
161
+ body .nl { color: #A0A000 } /* Name.Label */
162
+ body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
163
+ body .nt { color: #954121; font-weight: bold } /* Name.Tag */
164
+ body .nv { color: #19469D } /* Name.Variable */
165
+ body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
166
+ body .w { color: #bbbbbb } /* Text.Whitespace */
167
+ body .mf { color: #666666 } /* Literal.Number.Float */
168
+ body .mh { color: #666666 } /* Literal.Number.Hex */
169
+ body .mi { color: #666666 } /* Literal.Number.Integer */
170
+ body .mo { color: #666666 } /* Literal.Number.Oct */
171
+ body .sb { color: #219161 } /* Literal.String.Backtick */
172
+ body .sc { color: #219161 } /* Literal.String.Char */
173
+ body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
174
+ body .s2 { color: #219161 } /* Literal.String.Double */
175
+ body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
176
+ body .sh { color: #219161 } /* Literal.String.Heredoc */
177
+ body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
178
+ body .sx { color: #954121 } /* Literal.String.Other */
179
+ body .sr { color: #BB6688 } /* Literal.String.Regex */
180
+ body .s1 { color: #219161 } /* Literal.String.Single */
181
+ body .ss { color: #19469D } /* Literal.String.Symbol */
182
+ body .bp { color: #954121 } /* Name.Builtin.Pseudo */
183
+ body .vc { color: #19469D } /* Name.Variable.Class */
184
+ body .vg { color: #19469D } /* Name.Variable.Global */
185
+ body .vi { color: #19469D } /* Name.Variable.Instance */
186
+ body .il { color: #666666 } /* Literal.Number.Integer.Long */