jsonapionify 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +29 -0
  3. data/.csslintrc +2 -0
  4. data/.gitignore +11 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +1171 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +10 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/Gemfile +4 -0
  11. data/Guardfile +14 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +43 -0
  14. data/Rakefile +34 -0
  15. data/TODO +13 -0
  16. data/bin/console +14 -0
  17. data/bin/setup +7 -0
  18. data/config.ru +15 -0
  19. data/fixtures/documentation.json +364 -0
  20. data/jsonapionify.gemspec +50 -0
  21. data/lib/core_ext/boolean.rb +3 -0
  22. data/lib/jsonapionify/api/action.rb +211 -0
  23. data/lib/jsonapionify/api/attribute.rb +67 -0
  24. data/lib/jsonapionify/api/base/app_builder.rb +33 -0
  25. data/lib/jsonapionify/api/base/class_methods.rb +73 -0
  26. data/lib/jsonapionify/api/base/delegation.rb +15 -0
  27. data/lib/jsonapionify/api/base/doc_helper.rb +47 -0
  28. data/lib/jsonapionify/api/base/reloader.rb +10 -0
  29. data/lib/jsonapionify/api/base/resource_definitions.rb +39 -0
  30. data/lib/jsonapionify/api/base.rb +25 -0
  31. data/lib/jsonapionify/api/context.rb +14 -0
  32. data/lib/jsonapionify/api/context_delegate.rb +42 -0
  33. data/lib/jsonapionify/api/errors.rb +6 -0
  34. data/lib/jsonapionify/api/errors_object.rb +66 -0
  35. data/lib/jsonapionify/api/header_options.rb +13 -0
  36. data/lib/jsonapionify/api/param_options.rb +46 -0
  37. data/lib/jsonapionify/api/relationship/blocks.rb +41 -0
  38. data/lib/jsonapionify/api/relationship/many.rb +61 -0
  39. data/lib/jsonapionify/api/relationship/one.rb +36 -0
  40. data/lib/jsonapionify/api/relationship.rb +89 -0
  41. data/lib/jsonapionify/api/resource/builders.rb +81 -0
  42. data/lib/jsonapionify/api/resource/class_methods.rb +82 -0
  43. data/lib/jsonapionify/api/resource/defaults/actions.rb +11 -0
  44. data/lib/jsonapionify/api/resource/defaults/errors.rb +99 -0
  45. data/lib/jsonapionify/api/resource/defaults/request_contexts.rb +96 -0
  46. data/lib/jsonapionify/api/resource/defaults/response_contexts.rb +31 -0
  47. data/lib/jsonapionify/api/resource/defaults.rb +10 -0
  48. data/lib/jsonapionify/api/resource/definitions/actions.rb +196 -0
  49. data/lib/jsonapionify/api/resource/definitions/attributes.rb +51 -0
  50. data/lib/jsonapionify/api/resource/definitions/contexts.rb +16 -0
  51. data/lib/jsonapionify/api/resource/definitions/helpers.rb +9 -0
  52. data/lib/jsonapionify/api/resource/definitions/pagination.rb +79 -0
  53. data/lib/jsonapionify/api/resource/definitions/params.rb +49 -0
  54. data/lib/jsonapionify/api/resource/definitions/relationships.rb +42 -0
  55. data/lib/jsonapionify/api/resource/definitions/request_headers.rb +103 -0
  56. data/lib/jsonapionify/api/resource/definitions/response_headers.rb +22 -0
  57. data/lib/jsonapionify/api/resource/definitions/scopes.rb +50 -0
  58. data/lib/jsonapionify/api/resource/definitions/sorting.rb +85 -0
  59. data/lib/jsonapionify/api/resource/definitions.rb +14 -0
  60. data/lib/jsonapionify/api/resource/error_handling.rb +108 -0
  61. data/lib/jsonapionify/api/resource/http.rb +11 -0
  62. data/lib/jsonapionify/api/resource/includer.rb +4 -0
  63. data/lib/jsonapionify/api/resource.rb +35 -0
  64. data/lib/jsonapionify/api/response.rb +47 -0
  65. data/lib/jsonapionify/api/server/mock_response.rb +37 -0
  66. data/lib/jsonapionify/api/server/request.rb +78 -0
  67. data/lib/jsonapionify/api/server.rb +50 -0
  68. data/lib/jsonapionify/api/test_helper.rb +52 -0
  69. data/lib/jsonapionify/api.rb +9 -0
  70. data/lib/jsonapionify/autoload.rb +52 -0
  71. data/lib/jsonapionify/callbacks.rb +49 -0
  72. data/lib/jsonapionify/character_range.rb +41 -0
  73. data/lib/jsonapionify/continuation.rb +26 -0
  74. data/lib/jsonapionify/documentation/template.erb +487 -0
  75. data/lib/jsonapionify/documentation.rb +40 -0
  76. data/lib/jsonapionify/enumerable_observer.rb +91 -0
  77. data/lib/jsonapionify/indented_string.rb +27 -0
  78. data/lib/jsonapionify/inherited_attributes.rb +125 -0
  79. data/lib/jsonapionify/structure/collections/base.rb +104 -0
  80. data/lib/jsonapionify/structure/collections/errors.rb +7 -0
  81. data/lib/jsonapionify/structure/collections/included_resources.rb +39 -0
  82. data/lib/jsonapionify/structure/collections/resource_identifiers.rb +7 -0
  83. data/lib/jsonapionify/structure/collections/resources.rb +7 -0
  84. data/lib/jsonapionify/structure/helpers/errors.rb +71 -0
  85. data/lib/jsonapionify/structure/helpers/inherits_origin.rb +17 -0
  86. data/lib/jsonapionify/structure/helpers/member_names.rb +37 -0
  87. data/lib/jsonapionify/structure/helpers/meta_delegate.rb +16 -0
  88. data/lib/jsonapionify/structure/helpers/object_defaults.rb +123 -0
  89. data/lib/jsonapionify/structure/helpers/object_setters.rb +21 -0
  90. data/lib/jsonapionify/structure/helpers/pagination_links.rb +10 -0
  91. data/lib/jsonapionify/structure/helpers/validations.rb +296 -0
  92. data/lib/jsonapionify/structure/maps/base.rb +25 -0
  93. data/lib/jsonapionify/structure/maps/error_links.rb +7 -0
  94. data/lib/jsonapionify/structure/maps/links.rb +21 -0
  95. data/lib/jsonapionify/structure/maps/relationship_links.rb +11 -0
  96. data/lib/jsonapionify/structure/maps/relationships.rb +23 -0
  97. data/lib/jsonapionify/structure/maps/resource_links.rb +7 -0
  98. data/lib/jsonapionify/structure/maps/top_level_links.rb +10 -0
  99. data/lib/jsonapionify/structure/objects/attributes.rb +29 -0
  100. data/lib/jsonapionify/structure/objects/base.rb +166 -0
  101. data/lib/jsonapionify/structure/objects/error.rb +16 -0
  102. data/lib/jsonapionify/structure/objects/included_resource.rb +14 -0
  103. data/lib/jsonapionify/structure/objects/jsonapi.rb +7 -0
  104. data/lib/jsonapionify/structure/objects/link.rb +18 -0
  105. data/lib/jsonapionify/structure/objects/meta.rb +7 -0
  106. data/lib/jsonapionify/structure/objects/relationship.rb +20 -0
  107. data/lib/jsonapionify/structure/objects/resource.rb +45 -0
  108. data/lib/jsonapionify/structure/objects/resource_identifier.rb +40 -0
  109. data/lib/jsonapionify/structure/objects/source.rb +10 -0
  110. data/lib/jsonapionify/structure/objects/top_level.rb +105 -0
  111. data/lib/jsonapionify/structure.rb +27 -0
  112. data/lib/jsonapionify/types/array_type.rb +32 -0
  113. data/lib/jsonapionify/types/boolean_type.rb +22 -0
  114. data/lib/jsonapionify/types/date_string_type.rb +28 -0
  115. data/lib/jsonapionify/types/float_type.rb +8 -0
  116. data/lib/jsonapionify/types/integer_type.rb +9 -0
  117. data/lib/jsonapionify/types/object_type.rb +22 -0
  118. data/lib/jsonapionify/types/string_type.rb +66 -0
  119. data/lib/jsonapionify/types/time_string_type.rb +28 -0
  120. data/lib/jsonapionify/types.rb +49 -0
  121. data/lib/jsonapionify/unstrict_proc.rb +28 -0
  122. data/lib/jsonapionify/version.rb +3 -0
  123. data/lib/jsonapionify.rb +37 -0
  124. metadata +530 -0
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.3
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.2.3
5
+ before_install: gem install bundler -v 1.10.6
6
+ script: bundle exec rspec
7
+ cache: bundler
8
+ addons:
9
+ code_climate:
10
+ repo_token: 8954c3078fac0b34ca184e61ca41e6b1dda3d820d5a0f3f18101d00bd86cdb1b
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jsonapi-objects.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ guard :rspec, cmd: "bundle exec rspec" do
2
+ require "guard/rspec/dsl"
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+
5
+ # RSpec files
6
+ rspec = dsl.rspec
7
+ watch(rspec.spec_helper) { rspec.spec_dir }
8
+ watch(rspec.spec_support) { rspec.spec_dir }
9
+ watch(rspec.spec_files)
10
+
11
+ # Ruby files
12
+ ruby = dsl.ruby
13
+ dsl.watch_spec_files_for(ruby.lib_files)
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jason Waldrip
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # JSONAPIonify
2
+ [![Version](http://allthebadges.io/brandfolder/jsonapionify/badge_fury.png)](http://allthebadges.io/brandfolder/jsonapionify/badge_fury)
3
+ [![Build Status](https://travis-ci.org/brandfolder/jsonapionify.svg?branch=master)](https://travis-ci.org/brandfolder/jsonapionify)
4
+ [![Code Climate](https://codeclimate.com/repos/5672446f137f95309c0067c6/badges/a369f0a182ce111c8fcd/gpa.svg)](https://codeclimate.com/repos/5672446f137f95309c0067c6/feed)
5
+ [![Test Coverage](https://codeclimate.com/repos/5672446f137f95309c0067c6/badges/a369f0a182ce111c8fcd/coverage.svg)](https://codeclimate.com/repos/5672446f137f95309c0067c6/coverage)
6
+
7
+ TODO: Write Description
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'jsonapionify'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install jsonapionify
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/brandfolder/jsonapionify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
38
+
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
43
+
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'fileutils'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ desc 'Generate missing specs'
8
+ task :missing_specs do
9
+ specs = Dir.glob("./lib/**/*.rb").map do |f|
10
+ f.gsub(/\.\/lib(.*)\.rb/, "./spec\\1_spec.rb")
11
+ end
12
+ specs.each do |f|
13
+ unless File.exist? f
14
+ puts 'created: ' + f
15
+ FileUtils.mkdir_p(File.dirname(f)) && FileUtils.touch(f)
16
+ end
17
+ end
18
+ end
19
+
20
+ STATS_DIRECTORIES = [
21
+ %w(Structure lib/jsonapionify/structure),
22
+ %w(Server lib/jsonapionify/api),
23
+ %w(Specs spec),
24
+ ].collect do |name, dir|
25
+ [name, "#{File.dirname(Rake.application.rakefile_location)}/#{dir}"]
26
+ end.select { |name, dir| File.directory?(dir) }
27
+
28
+ desc "Report code statistics (KLOCs, etc)"
29
+ task :stats do
30
+ require_relative './vendor/code_statistics'
31
+ CodeStatistics.new(*STATS_DIRECTORIES).to_s
32
+ end
33
+
34
+ task :default => :spec
data/TODO ADDED
@@ -0,0 +1,13 @@
1
+ HIGH
2
+ * Documentation
3
+ * TESTS
4
+ * Various top level objects for different requests
5
+ * Doc NavLinks!!!!
6
+
7
+ MED
8
+ * Logger
9
+ * Handle includes
10
+
11
+ LOW
12
+ *? Resource class instead of scope (resource class defines the first scope)
13
+ *? Fix required attributes on update
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jsonapionify"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "pry"
14
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/config.ru ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler/setup'
2
+ require 'rack'
3
+ require 'jsonapionify'
4
+ require 'navigable_hash'
5
+ require 'json'
6
+
7
+ api = NavigableHash.new JSON.load File.read 'fixtures/documentation.json'
8
+ docs = JSONAPIonify::Documentation.new(api)
9
+ result = docs.result
10
+
11
+ run ->(_) {
12
+ response = Rack::Response.new
13
+ response.write result
14
+ response.finish
15
+ }
@@ -0,0 +1,364 @@
1
+ {
2
+ "title": "Brandfolder API",
3
+ "base_url": "https://api.brandfolder.com",
4
+ "description": "Our API is awesome.",
5
+ "resources": {
6
+ "brandfolders": {
7
+ "actions": {
8
+
9
+ },
10
+ "description": "Good stuff here.",
11
+ "attributes": {
12
+ "name": {
13
+ "description": "The name of the Brandfolder.",
14
+ "required": true,
15
+ "allow": [
16
+ "read",
17
+ "write"
18
+ ]
19
+ },
20
+ "slug": {
21
+ "description": "The url of the Brandfolder on Branfolder.com.",
22
+ "required": true,
23
+ "allow": [
24
+ "read",
25
+ "write"
26
+ ]
27
+ },
28
+ "tagline": {
29
+ "description": "Tagline of the Brandfolder.",
30
+ "required": false,
31
+ "allow": [
32
+ "read",
33
+ "write"
34
+ ]
35
+ },
36
+ "privacy": {
37
+ "description": "The privacy of the Brandfolder, this can be `public`, `private` or `stealth`.",
38
+ "required": false,
39
+ "allow": [
40
+ "read",
41
+ "write"
42
+ ]
43
+ }
44
+ },
45
+ "relationships": {
46
+ "organization": {
47
+ "resource": "organizations",
48
+ "type": "one",
49
+ "allow": [
50
+ "read"
51
+ ]
52
+ },
53
+ "assets": {
54
+ "resource": "assets",
55
+ "type": "many",
56
+ "allow": [
57
+ "read"
58
+ ]
59
+ },
60
+ "sections": {
61
+ "resource": "sections",
62
+ "type": "many",
63
+ "allow": [
64
+ "read",
65
+ "write"
66
+ ]
67
+ },
68
+ "collections": {
69
+ "resource": "collections",
70
+ "type": "many",
71
+ "allow": [
72
+ "read",
73
+ "write"
74
+ ]
75
+ },
76
+ "admins": {
77
+ "resource": "users",
78
+ "type": "many",
79
+ "allow": [
80
+ "read",
81
+ "write"
82
+ ]
83
+ },
84
+ "collaborators": {
85
+ "resource": "users",
86
+ "type": "many",
87
+ "allow": [
88
+ "read",
89
+ "write"
90
+ ]
91
+ },
92
+ "guests": {
93
+ "resource": "users",
94
+ "type": "many",
95
+ "allow": [
96
+ "read",
97
+ "write"
98
+ ]
99
+ }
100
+ }
101
+ },
102
+ "users": {
103
+ "attributes": {
104
+ "first_name": {
105
+ "description": "The user's first name.",
106
+ "required": false,
107
+ "allow": [
108
+ "read",
109
+ "write"
110
+ ]
111
+ },
112
+ "last_name": {
113
+ "description": "The user's last name.",
114
+ "required": false,
115
+ "allow": [
116
+ "read",
117
+ "write"
118
+ ]
119
+ },
120
+ "email_address": {
121
+ "description": "The user's email address.",
122
+ "required": true,
123
+ "allow": [
124
+ "read",
125
+ "write"
126
+ ]
127
+ },
128
+ "password": {
129
+ "description": "The user's password.",
130
+ "required": true,
131
+ "allow": [
132
+ "write"
133
+ ]
134
+ }
135
+ },
136
+ "relationships": {
137
+ "brandfolders": {
138
+ "resource": "brandfolders",
139
+ "type": "many",
140
+ "allow": [
141
+ "read"
142
+ ]
143
+ }
144
+ }
145
+ },
146
+ "sections": {
147
+ "attributes": {
148
+ "name": {
149
+ "description": "The name of the section.",
150
+ "required": true,
151
+ "allow": [
152
+ "read",
153
+ "write"
154
+ ]
155
+ },
156
+ "slug": {
157
+ "description": "The url of the section on Branfolder.com.",
158
+ "required": true,
159
+ "allow": [
160
+ "read",
161
+ "write"
162
+ ]
163
+ }
164
+ },
165
+ "relationships": {
166
+ "brandfolder": {
167
+ "resource": "brandfolders",
168
+ "type": "one",
169
+ "allow": [
170
+ "read"
171
+ ]
172
+ },
173
+ "assets": {
174
+ "resource": "assets",
175
+ "type": "many",
176
+ "allow": [
177
+ "read",
178
+ "write"
179
+ ]
180
+ },
181
+ "sections": {
182
+ "resource": "sections",
183
+ "type": "many",
184
+ "allow": [
185
+ "read",
186
+ "write"
187
+ ]
188
+ },
189
+ "admins": {
190
+ "resource": "users",
191
+ "type": "many",
192
+ "allow": [
193
+ "read",
194
+ "write"
195
+ ]
196
+ },
197
+ "collaborators": {
198
+ "resource": "users",
199
+ "type": "many",
200
+ "allow": [
201
+ "read",
202
+ "write"
203
+ ]
204
+ },
205
+ "guests": {
206
+ "resource": "users",
207
+ "type": "many",
208
+ "allow": [
209
+ "read",
210
+ "write"
211
+ ]
212
+ }
213
+ }
214
+ },
215
+ "collections": {
216
+ "attributes": {
217
+ "name": {
218
+ "description": "The name of the Collection.",
219
+ "required": true,
220
+ "allow": [
221
+ "read",
222
+ "write"
223
+ ]
224
+ },
225
+ "slug": {
226
+ "description": "The url of the collection on Branfolder.com.",
227
+ "required": true,
228
+ "allow": [
229
+ "read",
230
+ "write"
231
+ ]
232
+ },
233
+ "tagline": {
234
+ "description": "Tagline of the Brandfolder.",
235
+ "required": false,
236
+ "allow": [
237
+ "read",
238
+ "write"
239
+ ]
240
+ },
241
+ "privacy": {
242
+ "description": "The privacy of the Brandfolder, this can be `public`, `private` or `stealth`.",
243
+ "required": false,
244
+ "allow": [
245
+ "read",
246
+ "write"
247
+ ]
248
+ }
249
+ },
250
+ "relationships": {
251
+ "brandfolder": {
252
+ "resource": "brandfolders",
253
+ "type": "one",
254
+ "allow": [
255
+ "read"
256
+ ]
257
+ },
258
+ "assets": {
259
+ "resource": "assets",
260
+ "type": "many",
261
+ "allow": [
262
+ "read",
263
+ "write"
264
+ ]
265
+ },
266
+ "sections": {
267
+ "resource": "sections",
268
+ "type": "many",
269
+ "allow": [
270
+ "read",
271
+ "write"
272
+ ]
273
+ },
274
+ "admins": {
275
+ "resource": "users",
276
+ "type": "many",
277
+ "allow": [
278
+ "read",
279
+ "write"
280
+ ]
281
+ },
282
+ "collaborators": {
283
+ "resource": "users",
284
+ "type": "many",
285
+ "allow": [
286
+ "read",
287
+ "write"
288
+ ]
289
+ },
290
+ "guests": {
291
+ "resource": "users",
292
+ "type": "many",
293
+ "allow": [
294
+ "read",
295
+ "write"
296
+ ]
297
+ }
298
+ }
299
+ },
300
+ "organizations": {
301
+ "attributes": {
302
+ "name": {
303
+ "description": "The name of the organization.",
304
+ "required": true,
305
+ "allow": [
306
+ "read",
307
+ "write"
308
+ ]
309
+ },
310
+ "slug": {
311
+ "description": "The url of the organization on Branfolder.com.",
312
+ "required": true,
313
+ "allow": [
314
+ "read",
315
+ "write"
316
+ ]
317
+ }
318
+ },
319
+ "relationships": {
320
+ "brandfolders": {
321
+ "resource": "brandfolders",
322
+ "type": "many",
323
+ "allow": [
324
+ "read",
325
+ "write"
326
+ ]
327
+ },
328
+ "owners": {
329
+ "resource": "users",
330
+ "type": "many",
331
+ "allow": [
332
+ "read",
333
+ "write"
334
+ ]
335
+ },
336
+ "admins": {
337
+ "resource": "users",
338
+ "type": "many",
339
+ "allow": [
340
+ "read",
341
+ "write"
342
+ ]
343
+ },
344
+ "collaborators": {
345
+ "resource": "users",
346
+ "type": "many",
347
+ "allow": [
348
+ "read",
349
+ "write"
350
+ ]
351
+ },
352
+ "guests": {
353
+ "resource": "users",
354
+ "type": "many",
355
+ "allow": [
356
+ "read",
357
+ "write"
358
+ ]
359
+ }
360
+ }
361
+ }
362
+ }
363
+ }
364
+
@@ -0,0 +1,50 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jsonapionify/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jsonapionify"
8
+ spec.version = JSONAPIonify::VERSION
9
+ spec.authors = ["Jason Waldrip"]
10
+ spec.email = ["jason@waldrip.net"]
11
+
12
+ spec.summary = %q{Ruby object structure conforming to the JSON API spec.}
13
+ spec.homepage = "https://github.com/brandfolder/jsonapionify"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(vendor|spec)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '~> 2.2'
22
+
23
+ spec.add_dependency "activesupport", "~> 4.2"
24
+ spec.add_dependency "faraday", "~> 0.9"
25
+ spec.add_dependency "rack"
26
+ spec.add_dependency "redcarpet"
27
+ spec.add_dependency "oj"
28
+ spec.add_dependency "rack-test"
29
+ spec.add_dependency 'faker'
30
+
31
+ spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'rocco'
33
+ spec.add_development_dependency 'bundler', '~> 1.10'
34
+ spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rspec'
36
+ spec.add_development_dependency 'guard'
37
+ spec.add_development_dependency 'guard-rspec'
38
+ spec.add_development_dependency 'navigable_hash'
39
+ spec.add_development_dependency 'code-statistics'
40
+ spec.add_development_dependency 'codeclimate-test-reporter'
41
+ spec.add_development_dependency 'guard-rack'
42
+ spec.add_development_dependency 'guard-rake'
43
+ spec.add_development_dependency 'guard-bundler'
44
+ spec.add_development_dependency 'activerecord'
45
+ spec.add_development_dependency 'activerecord-import'
46
+ spec.add_development_dependency 'sqlite3'
47
+ spec.add_development_dependency 'ruby-prof'
48
+ spec.add_development_dependency 'bcrypt'
49
+ spec.add_development_dependency 'thin'
50
+ end
@@ -0,0 +1,3 @@
1
+ module Boolean
2
+ [true, false].each { |obj| obj.class.include self }
3
+ end