jsonapi-resources 0.7.1.beta1 → 0.7.1.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +248 -74
- data/lib/jsonapi-resources.rb +5 -3
- data/lib/jsonapi/acts_as_resource_controller.rb +77 -14
- data/lib/jsonapi/configuration.rb +77 -16
- data/lib/jsonapi/error.rb +12 -0
- data/lib/jsonapi/error_codes.rb +2 -0
- data/lib/jsonapi/exceptions.rb +29 -9
- data/lib/jsonapi/formatter.rb +29 -4
- data/lib/jsonapi/link_builder.rb +18 -18
- data/lib/jsonapi/mime_types.rb +25 -6
- data/lib/jsonapi/naive_cache.rb +30 -0
- data/lib/jsonapi/operation.rb +10 -342
- data/lib/jsonapi/operation_dispatcher.rb +87 -0
- data/lib/jsonapi/operation_result.rb +2 -1
- data/lib/jsonapi/paginator.rb +6 -2
- data/lib/jsonapi/processor.rb +283 -0
- data/lib/jsonapi/relationship.rb +6 -4
- data/lib/jsonapi/{request.rb → request_parser.rb} +46 -35
- data/lib/jsonapi/resource.rb +88 -13
- data/lib/jsonapi/resource_controller.rb +2 -14
- data/lib/jsonapi/resource_controller_metal.rb +17 -0
- data/lib/jsonapi/resource_serializer.rb +62 -47
- data/lib/jsonapi/resources/version.rb +1 -1
- data/lib/jsonapi/response_document.rb +13 -2
- data/lib/jsonapi/routing_ext.rb +49 -11
- metadata +37 -129
- data/.gitignore +0 -22
- data/.travis.yml +0 -9
- data/Gemfile +0 -23
- data/Rakefile +0 -20
- data/jsonapi-resources.gemspec +0 -29
- data/lib/jsonapi/active_record_operations_processor.rb +0 -35
- data/lib/jsonapi/operations_processor.rb +0 -120
- data/locales/en.yml +0 -80
- data/test/config/database.yml +0 -5
- data/test/controllers/controller_test.rb +0 -3312
- data/test/fixtures/active_record.rb +0 -1486
- data/test/fixtures/author_details.yml +0 -9
- data/test/fixtures/book_authors.yml +0 -3
- data/test/fixtures/book_comments.yml +0 -12
- data/test/fixtures/books.yml +0 -7
- data/test/fixtures/categories.yml +0 -35
- data/test/fixtures/comments.yml +0 -21
- data/test/fixtures/comments_tags.yml +0 -20
- data/test/fixtures/companies.yml +0 -4
- data/test/fixtures/craters.yml +0 -9
- data/test/fixtures/customers.yml +0 -11
- data/test/fixtures/documents.yml +0 -3
- data/test/fixtures/expense_entries.yml +0 -13
- data/test/fixtures/facts.yml +0 -11
- data/test/fixtures/hair_cuts.yml +0 -3
- data/test/fixtures/iso_currencies.yml +0 -17
- data/test/fixtures/line_items.yml +0 -37
- data/test/fixtures/makes.yml +0 -2
- data/test/fixtures/moons.yml +0 -6
- data/test/fixtures/numeros_telefone.yml +0 -3
- data/test/fixtures/order_flags.yml +0 -7
- data/test/fixtures/people.yml +0 -31
- data/test/fixtures/pictures.yml +0 -15
- data/test/fixtures/planet_types.yml +0 -19
- data/test/fixtures/planets.yml +0 -47
- data/test/fixtures/posts.yml +0 -102
- data/test/fixtures/posts_tags.yml +0 -59
- data/test/fixtures/preferences.yml +0 -14
- data/test/fixtures/products.yml +0 -3
- data/test/fixtures/purchase_orders.yml +0 -23
- data/test/fixtures/sections.yml +0 -8
- data/test/fixtures/tags.yml +0 -39
- data/test/fixtures/vehicles.yml +0 -17
- data/test/fixtures/web_pages.yml +0 -3
- data/test/helpers/assertions.rb +0 -13
- data/test/helpers/functional_helpers.rb +0 -59
- data/test/helpers/value_matchers.rb +0 -60
- data/test/helpers/value_matchers_test.rb +0 -40
- data/test/integration/requests/namespaced_model_test.rb +0 -13
- data/test/integration/requests/request_test.rb +0 -932
- data/test/integration/routes/routes_test.rb +0 -218
- data/test/integration/sti_fields_test.rb +0 -18
- data/test/lib/generators/jsonapi/controller_generator_test.rb +0 -25
- data/test/lib/generators/jsonapi/resource_generator_test.rb +0 -30
- data/test/test_helper.rb +0 -342
- data/test/unit/formatters/dasherized_key_formatter_test.rb +0 -8
- data/test/unit/jsonapi_request/jsonapi_request_test.rb +0 -199
- data/test/unit/operation/operations_processor_test.rb +0 -528
- data/test/unit/pagination/offset_paginator_test.rb +0 -245
- data/test/unit/pagination/paged_paginator_test.rb +0 -242
- data/test/unit/resource/resource_test.rb +0 -560
- data/test/unit/serializer/include_directives_test.rb +0 -113
- data/test/unit/serializer/link_builder_test.rb +0 -244
- data/test/unit/serializer/polymorphic_serializer_test.rb +0 -383
- data/test/unit/serializer/response_document_test.rb +0 -61
- data/test/unit/serializer/serializer_test.rb +0 -1939
@@ -1,12 +0,0 @@
|
|
1
|
-
<% comment_id = 0 %>
|
2
|
-
<% for book_num in 0..4 %>
|
3
|
-
<% for comment_num in 0..50 %>
|
4
|
-
book_<%= book_num %>_comment_<%= comment_num %>:
|
5
|
-
id: <%= comment_id %>
|
6
|
-
body: This is comment <%= comment_num %> on book <%= book_num %>.
|
7
|
-
author_id: <%= book_num.even? ? comment_id % 2 : (comment_id % 2) + 2 %>
|
8
|
-
book_id: <%= book_num %>
|
9
|
-
approved: <%= comment_num.even? %>
|
10
|
-
<% comment_id = comment_id + 1 %>
|
11
|
-
<% end %>
|
12
|
-
<% end %>
|
data/test/fixtures/books.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
category_a:
|
2
|
-
id: 1
|
3
|
-
name: Category A
|
4
|
-
status: active
|
5
|
-
|
6
|
-
category_b:
|
7
|
-
id: 2
|
8
|
-
name: Category B
|
9
|
-
status: active
|
10
|
-
|
11
|
-
category_c:
|
12
|
-
id: 3
|
13
|
-
name: Category C
|
14
|
-
status: active
|
15
|
-
|
16
|
-
category_d:
|
17
|
-
id: 4
|
18
|
-
name: Category D
|
19
|
-
status: inactive
|
20
|
-
|
21
|
-
category_e:
|
22
|
-
id: 5
|
23
|
-
name: Category E
|
24
|
-
status: inactive
|
25
|
-
|
26
|
-
category_f:
|
27
|
-
id: 6
|
28
|
-
name: Category F
|
29
|
-
status: inactive
|
30
|
-
|
31
|
-
category_g:
|
32
|
-
id: 7
|
33
|
-
name: Category G
|
34
|
-
status: inactive
|
35
|
-
|
data/test/fixtures/comments.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
post_1_dumb_post:
|
2
|
-
id: 1
|
3
|
-
post_id: 1
|
4
|
-
body: what a dumb post
|
5
|
-
author_id: 1
|
6
|
-
|
7
|
-
post_1_i_liked_it:
|
8
|
-
id: 2
|
9
|
-
post_id: 1
|
10
|
-
body: i liked it
|
11
|
-
author_id: 2
|
12
|
-
|
13
|
-
post_2_thanks_man:
|
14
|
-
id: 3
|
15
|
-
post_id: 2
|
16
|
-
body: Thanks man. Great post. But what is JR?
|
17
|
-
author_id: 2
|
18
|
-
|
19
|
-
rogue_comment:
|
20
|
-
body: Rogue Comment Here
|
21
|
-
author_id: 3
|
@@ -1,20 +0,0 @@
|
|
1
|
-
post_1_dumb_post_whiny:
|
2
|
-
comment_id: 1
|
3
|
-
tag_id: 2
|
4
|
-
|
5
|
-
post_1_dumb_post_short:
|
6
|
-
comment_id: 1
|
7
|
-
tag_id: 1
|
8
|
-
|
9
|
-
post_1_i_liked_it_happy:
|
10
|
-
comment_id: 2
|
11
|
-
tag_id: 4
|
12
|
-
|
13
|
-
post_1_i_liked_it_short:
|
14
|
-
comment_id: 2
|
15
|
-
tag_id: 1
|
16
|
-
|
17
|
-
post_2_thanks_man_jr:
|
18
|
-
comment_id: 3
|
19
|
-
tag_id: 5
|
20
|
-
|
data/test/fixtures/companies.yml
DELETED
data/test/fixtures/craters.yml
DELETED
data/test/fixtures/customers.yml
DELETED
data/test/fixtures/documents.yml
DELETED
data/test/fixtures/facts.yml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
fact_1:
|
2
|
-
id: 1
|
3
|
-
spouse_name: Jane Author
|
4
|
-
bio: First man to run across Antartica.
|
5
|
-
quality_rating: <%= 23.89/45.6 %>
|
6
|
-
salary: 47000.56
|
7
|
-
date_time_joined: 2013-08-07 20:25:00 UTC +00:00
|
8
|
-
birthday: 1965-06-30
|
9
|
-
bedtime: 2000-01-01 20:00:00 UTC +00:00
|
10
|
-
photo: abc
|
11
|
-
cool: false
|
data/test/fixtures/hair_cuts.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
usd:
|
2
|
-
code: USD
|
3
|
-
name: United States Dollar
|
4
|
-
country_name: United States
|
5
|
-
minor_unit: cent
|
6
|
-
|
7
|
-
eur:
|
8
|
-
code: EUR
|
9
|
-
name: Euro Member Countries
|
10
|
-
country_name: Euro Member Countries
|
11
|
-
minor_unit: cent
|
12
|
-
|
13
|
-
cad:
|
14
|
-
code: CAD
|
15
|
-
name: Canadian dollar
|
16
|
-
country_name: Canada
|
17
|
-
minor_unit: cent
|
@@ -1,37 +0,0 @@
|
|
1
|
-
po_1_li_1:
|
2
|
-
id: 1
|
3
|
-
purchase_order_id: 1
|
4
|
-
part_number: 556324
|
5
|
-
quantity: 1
|
6
|
-
item_cost: 45.67
|
7
|
-
|
8
|
-
po_1_li_2:
|
9
|
-
id: 2
|
10
|
-
purchase_order_id: 1
|
11
|
-
part_number: 79324231A
|
12
|
-
quantity: 3
|
13
|
-
item_cost: 19.99
|
14
|
-
|
15
|
-
li_3:
|
16
|
-
id: 3
|
17
|
-
part_number: 79324231A
|
18
|
-
quantity: 67
|
19
|
-
item_cost: 19.99
|
20
|
-
|
21
|
-
li_4:
|
22
|
-
id: 4
|
23
|
-
part_number: 5678
|
24
|
-
quantity: 2
|
25
|
-
item_cost: 199.99
|
26
|
-
|
27
|
-
li_5:
|
28
|
-
id: 5
|
29
|
-
part_number: 5WERT
|
30
|
-
quantity: 1
|
31
|
-
item_cost: 299.98
|
32
|
-
|
33
|
-
li_6:
|
34
|
-
id: 6
|
35
|
-
part_number: 25washer
|
36
|
-
quantity: 10
|
37
|
-
item_cost: 0.98
|
data/test/fixtures/makes.yml
DELETED
data/test/fixtures/moons.yml
DELETED
data/test/fixtures/people.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
a:
|
2
|
-
id: 1
|
3
|
-
name: Joe Author
|
4
|
-
email: joe@xyz.fake
|
5
|
-
date_joined: <%= DateTime.parse('2013-08-07 20:25:00 UTC +00:00') %>
|
6
|
-
preferences_id: 1
|
7
|
-
|
8
|
-
b:
|
9
|
-
id: 2
|
10
|
-
name: Fred Reader
|
11
|
-
email: fred@xyz.fake
|
12
|
-
date_joined: <%= DateTime.parse('2013-10-31 20:25:00 UTC +00:00') %>
|
13
|
-
|
14
|
-
c:
|
15
|
-
id: 3
|
16
|
-
name: Lazy Author
|
17
|
-
email: lazy@xyz.fake
|
18
|
-
date_joined: <%= DateTime.parse('2013-10-31 21:25:00 UTC +00:00') %>
|
19
|
-
|
20
|
-
d:
|
21
|
-
id: 4
|
22
|
-
name: Tag Crazy Author
|
23
|
-
email: taggy@xyz.fake
|
24
|
-
date_joined: <%= DateTime.parse('2013-11-30 4:20:00 UTC +00:00') %>
|
25
|
-
|
26
|
-
e:
|
27
|
-
id: 5
|
28
|
-
name: Wilma Librarian
|
29
|
-
email: lib@xyz.fake
|
30
|
-
date_joined: <%= DateTime.parse('2013-11-30 4:20:00 UTC +00:00') %>
|
31
|
-
book_admin: true
|
data/test/fixtures/pictures.yml
DELETED
data/test/fixtures/planets.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
saturn:
|
2
|
-
id: 1
|
3
|
-
name: Satern
|
4
|
-
description: Saturn is the sixth planet from the Sun and the second largest planet in the Solar System, after Jupiter.
|
5
|
-
planet_type_id: 2
|
6
|
-
|
7
|
-
makemake:
|
8
|
-
id: 2
|
9
|
-
name: Makemake
|
10
|
-
description: A small planetoid in the Kuiperbelt.
|
11
|
-
planet_type_id: 2
|
12
|
-
|
13
|
-
uranus:
|
14
|
-
id: 3
|
15
|
-
name: Uranus
|
16
|
-
description: Insert adolescent jokes here.
|
17
|
-
planet_type_id: 1
|
18
|
-
|
19
|
-
jupiter:
|
20
|
-
id: 4
|
21
|
-
name: Jupiter
|
22
|
-
description: A gas giant.
|
23
|
-
planet_type_id: 1
|
24
|
-
|
25
|
-
betax:
|
26
|
-
id: 5
|
27
|
-
name: Beta X
|
28
|
-
description: Newly discovered Planet X
|
29
|
-
planet_type_id: 5
|
30
|
-
|
31
|
-
betay:
|
32
|
-
id: 6
|
33
|
-
name: Beta X
|
34
|
-
description: Newly discovered Planet Y
|
35
|
-
planet_type_id: 5
|
36
|
-
|
37
|
-
betaz:
|
38
|
-
id: 7
|
39
|
-
name: Beta X
|
40
|
-
description: Newly discovered Planet Z
|
41
|
-
planet_type_id: 5
|
42
|
-
|
43
|
-
betaw:
|
44
|
-
id: 8
|
45
|
-
name: Beta W
|
46
|
-
description: Newly discovered Planet W
|
47
|
-
planet_type_id:
|
data/test/fixtures/posts.yml
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
post_1:
|
2
|
-
id: 1
|
3
|
-
title: New post
|
4
|
-
body: A body!!!
|
5
|
-
author_id: 1
|
6
|
-
|
7
|
-
post_2:
|
8
|
-
id: 2
|
9
|
-
title: JR Solves your serialization woes!
|
10
|
-
body: Use JR
|
11
|
-
author_id: 1
|
12
|
-
section_id: 2
|
13
|
-
|
14
|
-
post_3:
|
15
|
-
id: 3
|
16
|
-
title: Update This Later
|
17
|
-
body: AAAA
|
18
|
-
author_id: 3
|
19
|
-
|
20
|
-
post_4:
|
21
|
-
id: 4
|
22
|
-
title: Delete This Later - Single
|
23
|
-
body: AAAA
|
24
|
-
author_id: 3
|
25
|
-
|
26
|
-
post_5:
|
27
|
-
id: 5
|
28
|
-
title: Delete This Later - Multiple1
|
29
|
-
body: AAAA
|
30
|
-
author_id: 3
|
31
|
-
|
32
|
-
post_6:
|
33
|
-
id: 6
|
34
|
-
title: Delete This Later - Multiple2
|
35
|
-
body: AAAA
|
36
|
-
author_id: 3
|
37
|
-
|
38
|
-
post_7:
|
39
|
-
id: 7
|
40
|
-
title: Delete This Later - Single2
|
41
|
-
body: AAAA
|
42
|
-
author_id: 3
|
43
|
-
|
44
|
-
post_8:
|
45
|
-
id: 8
|
46
|
-
title: Delete This Later - Multiple2-1
|
47
|
-
body: AAAA
|
48
|
-
author_id: 3
|
49
|
-
|
50
|
-
post_9:
|
51
|
-
id: 9
|
52
|
-
title: Delete This Later - Multiple2-2
|
53
|
-
body: AAAA
|
54
|
-
author_id: 3
|
55
|
-
|
56
|
-
post_10:
|
57
|
-
id: 10
|
58
|
-
title: Update This Later - Multiple
|
59
|
-
body: AAAA
|
60
|
-
author_id: 3
|
61
|
-
|
62
|
-
post_11:
|
63
|
-
id: 11
|
64
|
-
title: JR How To
|
65
|
-
body: Use JR to write API apps
|
66
|
-
author_id: 1
|
67
|
-
|
68
|
-
post_12:
|
69
|
-
id: 12
|
70
|
-
title: Tagged up post 1
|
71
|
-
body: AAAA
|
72
|
-
author_id: 4
|
73
|
-
|
74
|
-
post_13:
|
75
|
-
id: 13
|
76
|
-
title: Tagged up post 2
|
77
|
-
body: BBBB
|
78
|
-
author_id: 4
|
79
|
-
|
80
|
-
post_14:
|
81
|
-
id: 14
|
82
|
-
title: A First Post
|
83
|
-
body: A First Post!!!!!!!!!
|
84
|
-
author_id: 3
|
85
|
-
|
86
|
-
post_15:
|
87
|
-
id: 15
|
88
|
-
title: AAAA First Post
|
89
|
-
body: First!!!!!!!!!
|
90
|
-
author_id: 3
|
91
|
-
|
92
|
-
post_16:
|
93
|
-
id: 16
|
94
|
-
title: SDFGH
|
95
|
-
body: Not First!!!!
|
96
|
-
author_id: 3
|
97
|
-
|
98
|
-
post_17:
|
99
|
-
id: 17
|
100
|
-
title: No Author!!!!!!
|
101
|
-
body: This post has no Author
|
102
|
-
author_id:
|