instant-api 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +142 -0
- data/README.md +231 -0
- data/instant_api.gemspec +20 -0
- data/lib/instant_api.rb +13 -0
- data/lib/instant_api/controller/build_create.rb +34 -0
- data/lib/instant_api/controller/build_destroy.rb +23 -0
- data/lib/instant_api/controller/build_edit.rb +11 -0
- data/lib/instant_api/controller/build_index.rb +39 -0
- data/lib/instant_api/controller/build_new.rb +22 -0
- data/lib/instant_api/controller/build_resource.rb +29 -0
- data/lib/instant_api/controller/build_show.rb +25 -0
- data/lib/instant_api/controller/build_update.rb +46 -0
- data/lib/instant_api/controller/builder.rb +54 -0
- data/lib/instant_api/controller/exception_handler.rb +38 -0
- data/lib/instant_api/controller/parameters.rb +43 -0
- data/lib/instant_api/controller/routes.rb +46 -0
- data/lib/instant_api/model/active_record_query_builder.rb +36 -0
- data/lib/instant_api/model/association_reflector.rb +93 -0
- data/lib/instant_api/model/builder.rb +95 -0
- data/lib/instant_api/model/collection.rb +43 -0
- data/lib/instant_api/model/resource.rb +14 -0
- data/lib/instant_api/util/array.rb +15 -0
- data/lib/instant_api/version.rb +3 -0
- data/spec/dummy/Gemfile +58 -0
- data/spec/dummy/Gemfile.lock +193 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/a.rb +5 -0
- data/spec/dummy/app/models/address.rb +4 -0
- data/spec/dummy/app/models/b.rb +4 -0
- data/spec/dummy/app/models/c.rb +4 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/country.rb +4 -0
- data/spec/dummy/app/models/d.rb +3 -0
- data/spec/dummy/app/models/movie.rb +4 -0
- data/spec/dummy/app/models/user.rb +8 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +4 -0
- data/spec/dummy/config/database.yml +39 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/instant_api.rb +3 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20131019140756_create_users.rb +14 -0
- data/spec/dummy/db/migrate/20131019141942_create_addresses.rb +14 -0
- data/spec/dummy/db/migrate/20131020003152_a.rb +9 -0
- data/spec/dummy/db/migrate/20131020003245_b.rb +10 -0
- data/spec/dummy/db/migrate/20131020003354_c.rb +11 -0
- data/spec/dummy/db/migrate/20131020164202_d.rb +9 -0
- data/spec/dummy/db/migrate/20131020164349_ad.rb +8 -0
- data/spec/dummy/db/migrate/20140419205834_create_countries.rb +9 -0
- data/spec/dummy/db/migrate/20140421005321_create_movies.rb +8 -0
- data/spec/dummy/db/migrate/20140421005435_create_countries_movies.rb +8 -0
- data/spec/dummy/db/schema.rb +88 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/spec/factories/address_factory.rb +8 -0
- data/spec/factories/country_factory.rb +5 -0
- data/spec/factories/movies_factory.rb +5 -0
- data/spec/factories/user_factory.rb +10 -0
- data/spec/functional/create_spec.rb +16 -0
- data/spec/functional/destroy_spec.rb +21 -0
- data/spec/functional/edit_spec.rb +19 -0
- data/spec/functional/index_spec.rb +82 -0
- data/spec/functional/new_spec.rb +14 -0
- data/spec/functional/show_spec.rb +20 -0
- data/spec/functional/update_spec.rb +47 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/support/database_cleaner.rb +20 -0
- data/spec/support/helpers.rb +31 -0
- data/spec/unit/lib/instant_api/controller/build_create_spec.rb +38 -0
- data/spec/unit/lib/instant_api/controller/build_destroy_spec.rb +25 -0
- data/spec/unit/lib/instant_api/controller/build_edit_spec.rb +24 -0
- data/spec/unit/lib/instant_api/controller/build_index_spec.rb +49 -0
- data/spec/unit/lib/instant_api/controller/build_new_spec.rb +18 -0
- data/spec/unit/lib/instant_api/controller/build_resource_spec.rb +27 -0
- data/spec/unit/lib/instant_api/controller/build_show_spec.rb +24 -0
- data/spec/unit/lib/instant_api/controller/build_update_spec.rb +66 -0
- data/spec/unit/lib/instant_api/controller/builder_spec.rb +18 -0
- data/spec/unit/lib/instant_api/controller/parameters_spec.rb +53 -0
- data/spec/unit/lib/instant_api/model/active_record_query_builder_spec.rb +133 -0
- data/spec/unit/lib/instant_api/model/builder_spec.rb +237 -0
- data/spec/unit/lib/instant_api/model/join_calculator_spec.rb +27 -0
- metadata +202 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :email
|
5
|
+
t.integer :age
|
6
|
+
t.date :born_at
|
7
|
+
t.datetime :registered_at
|
8
|
+
t.boolean :terms_accepted
|
9
|
+
t.decimal :money, :precision => 8, :scale => 2
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateAddresses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :addresses do |t|
|
4
|
+
t.string :street
|
5
|
+
t.string :number
|
6
|
+
t.string :postal_code
|
7
|
+
t.string :city
|
8
|
+
t.string :country
|
9
|
+
t.integer :user_id
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20140421005435) do
|
15
|
+
|
16
|
+
create_table "addresses", force: true do |t|
|
17
|
+
t.string "street"
|
18
|
+
t.string "number"
|
19
|
+
t.string "postal_code"
|
20
|
+
t.string "city"
|
21
|
+
t.string "country"
|
22
|
+
t.integer "user_id"
|
23
|
+
t.datetime "created_at"
|
24
|
+
t.datetime "updated_at"
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "as", force: true do |t|
|
28
|
+
t.string "value"
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "as_ds", force: true do |t|
|
34
|
+
t.integer "a_id"
|
35
|
+
t.integer "d_id"
|
36
|
+
end
|
37
|
+
|
38
|
+
create_table "bs", force: true do |t|
|
39
|
+
t.string "value"
|
40
|
+
t.integer "a_id"
|
41
|
+
t.datetime "created_at"
|
42
|
+
t.datetime "updated_at"
|
43
|
+
end
|
44
|
+
|
45
|
+
create_table "countries", force: true do |t|
|
46
|
+
t.string "name"
|
47
|
+
t.integer "address_id"
|
48
|
+
t.datetime "created_at"
|
49
|
+
t.datetime "updated_at"
|
50
|
+
end
|
51
|
+
|
52
|
+
create_table "countries_movies", force: true do |t|
|
53
|
+
t.integer "country_id"
|
54
|
+
t.integer "movie_id"
|
55
|
+
end
|
56
|
+
|
57
|
+
create_table "cs", force: true do |t|
|
58
|
+
t.string "value"
|
59
|
+
t.integer "b_id"
|
60
|
+
t.integer "a_id"
|
61
|
+
t.datetime "created_at"
|
62
|
+
t.datetime "updated_at"
|
63
|
+
end
|
64
|
+
|
65
|
+
create_table "ds", force: true do |t|
|
66
|
+
t.string "value"
|
67
|
+
t.datetime "created_at"
|
68
|
+
t.datetime "updated_at"
|
69
|
+
end
|
70
|
+
|
71
|
+
create_table "movies", force: true do |t|
|
72
|
+
t.string "name"
|
73
|
+
t.datetime "created_at"
|
74
|
+
t.datetime "updated_at"
|
75
|
+
end
|
76
|
+
|
77
|
+
create_table "users", force: true do |t|
|
78
|
+
t.string "email"
|
79
|
+
t.integer "age"
|
80
|
+
t.date "born_at"
|
81
|
+
t.datetime "registered_at"
|
82
|
+
t.boolean "terms_accepted"
|
83
|
+
t.decimal "money", precision: 8, scale: 2
|
84
|
+
t.datetime "created_at"
|
85
|
+
t.datetime "updated_at"
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|