oat 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ba603c78357fe7c01817de9999727c2cb8980e9f
4
- data.tar.gz: 8106d0bdc27f381887c2b614e04b3557e5eb0713
2
+ SHA256:
3
+ metadata.gz: 81a5eec5265ffe5304b90205043dd56bde0d379466c598f233ab840b8998a5bd
4
+ data.tar.gz: 411ee0a41a93cd42d7a628b3bce59e5730276402ee743632d01cb4b5b3b5a0b4
5
5
  SHA512:
6
- metadata.gz: e2b34f0607bb589e0e47f8bb0edec1ffce5057e02dd439a565025845f429add68307ddf7fdde84a75880be72b07301effdea3cd5d9c4a9ade2803272d5978a04
7
- data.tar.gz: ca0062c54c4800a7076e86683376fce749293eb7bfb094036da9a3eca35d571438fd9a1b46113fd3105723f1d0aed074b425cd2acb5447fc5f9bff6445e151aa
6
+ metadata.gz: 4536b22318309566582ee14c37b5ee367d13f0e0d5d6b1486083951d9197d6d8181ccb1192c4fcf976f132875bdc5e6bd4956e4a4dd77df9bac152ebd54911d7
7
+ data.tar.gz: 2a068482ed4ef964b11f1ad7a7cdc6a88ac7b85c4ee524c886e5cd3b91c135d6288f1bbb652a82af553e002ebaef6fd6a3cb8ff4da7a584d199a3502d5de2891
data/.travis.yml CHANGED
@@ -2,35 +2,9 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.1.2
5
- - 2.0.0
6
5
  - 1.9.3
7
- - 1.9.2
8
- - 1.8.7
9
- - jruby-1.7.11
10
-
11
- gemfile:
12
- - gemfiles/Gemfile.as-3.0.x
13
- - gemfiles/Gemfile.as-3.1.x
14
- - gemfiles/Gemfile.as-3.2.x
15
- - gemfiles/Gemfile.as-4.0.x
16
- - gemfiles/Gemfile.as-4.1.x
17
6
 
18
7
  matrix:
19
8
  include:
20
- - gemfile: gemfiles/Gemfile.as-1.4.4
21
- rvm: 1.8.7
22
- - gemfile: gemfiles/Gemfile.as-2.3.x
23
- rvm: 1.8.7
24
- - gemfile: gemfiles/Gemfile.as-2.3.x
25
- rvm: 1.9.2
26
- - gemfile: gemfiles/Gemfile.as-2.3.x
27
- rvm: 1.9.3
28
- exclude:
29
- - gemfile: gemfiles/Gemfile.as-4.0.x
30
- rvm: 1.8.7
31
- - gemfile: gemfiles/Gemfile.as-4.1.x
32
- rvm: 1.8.7
33
- - gemfile: gemfiles/Gemfile.as-4.0.x
34
- rvm: 1.9.2
35
- - gemfile: gemfiles/Gemfile.as-4.1.x
36
- rvm: 1.9.2
9
+ - rvm: 1.9.3
10
+ - rvm: 2.1.2
data/CHANGELOG.md CHANGED
@@ -1,150 +1,218 @@
1
- # Changelog
1
+ # Change Log
2
2
 
3
- ## [v0.4.6](https://github.com/ismasan/oat/tree/v0.4.6)
4
- [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.5...v0.4.6)
5
- #### 07/02/15
6
- - *Merged pull-request:* HAL support for an array of linked objects [\#60](https://github.com/ismasan/oat/pull/60) ([abargnesi](https://github.com/abargnesi))
3
+ ## [v0.5.2](https://github.com/ismasan/oat/tree/v0.5.2) (2018-02-02)
4
+ [Full Changelog](https://github.com/ismasan/oat/compare/v0.5.1...v0.5.2)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Remove dependency on ActiveSupport. [\#76](https://github.com/ismasan/oat/pull/76) ([ismasan](https://github.com/ismasan))
9
+
10
+ ## [v0.5.1](https://github.com/ismasan/oat/tree/v0.5.1) (2017-06-06)
11
+ [Full Changelog](https://github.com/ismasan/oat/compare/v0.5.0...v0.5.1)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Improve serialization performance by avoiding instance\_eval and method\_missing [\#73](https://github.com/ismasan/oat/pull/73) ([ivoanjo](https://github.com/ivoanjo))
16
+ - Remove duplicated license file [\#70](https://github.com/ismasan/oat/pull/70) ([tjmw](https://github.com/tjmw))
17
+
18
+ ## [v0.5.0](https://github.com/ismasan/oat/tree/v0.5.0) (2016-08-24)
19
+ [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.7...v0.5.0)
20
+
21
+ **Closed issues:**
22
+
23
+ - :only option for filtering [\#67](https://github.com/ismasan/oat/issues/67)
7
24
 
8
- - *Merged pull-request:* Fixing Nested Serializers example [\#57](https://github.com/ismasan/oat/pull/57) ([coderdave](https://github.com/coderdave))
25
+ **Merged pull requests:**
9
26
 
10
- - *Merged pull-request:* Fix spelling in README.md [\#53](https://github.com/ismasan/oat/pull/53) ([killpack](https://github.com/killpack))
27
+ - Add support for multiple schema blocks [\#69](https://github.com/ismasan/oat/pull/69) ([tjmw](https://github.com/tjmw))
11
28
 
12
- - *Merged pull-request:* provide an example of using Rails responders to support requests using a Hypermedia mime type [\#52](https://github.com/ismasan/oat/pull/52) ([apsoto](https://github.com/apsoto))
29
+ ## [v0.4.7](https://github.com/ismasan/oat/tree/v0.4.7) (2016-02-29)
30
+ [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.6...v0.4.7)
13
31
 
14
- - *Merged pull-request:* Stop entities/entity from duplicating entries in linked hash. [\#49](https://github.com/ismasan/oat/pull/49) ([dpdawson](https://github.com/dpdawson))
32
+ **Implemented enhancements:**
15
33
 
16
- - *Merged pull-request:* Better documentation for Oat::Adapters::JsonAPI#collection [\#46](https://github.com/ismasan/oat/pull/46) ([emilesilvis](https://github.com/emilesilvis))
34
+ - Override context on embedded serializers [\#13](https://github.com/ismasan/oat/issues/13)
17
35
 
18
- - *Merged pull-request:* add the required rel attribute for Siren sub-entities [\#45](https://github.com/ismasan/oat/pull/45) ([apsoto](https://github.com/apsoto))
36
+ **Closed issues:**
19
37
 
20
- - *Closed issue:* is lib/support/class\_attribute necessary? [\#44](https://github.com/ismasan/oat/issues/44)
38
+ - The Siren adapter renders multiple rels per link as an array of an array instead of a flat array [\#64](https://github.com/ismasan/oat/issues/64)
39
+ - JsonApi adapter generates anything but JSON API conformant document [\#62](https://github.com/ismasan/oat/issues/62)
40
+ - Cross-cutting concerns [\#61](https://github.com/ismasan/oat/issues/61)
21
41
 
22
- - *Closed issue:* Oat, Rails Responders and hypermedia mime types [\#50](https://github.com/ismasan/oat/issues/50)
42
+ **Merged pull requests:**
23
43
 
24
- - *Closed issue:* Array serialization [\#54](https://github.com/ismasan/oat/issues/54)
44
+ - Support for multiple rels specified as an array for a single link. fixes \#64. [\#65](https://github.com/ismasan/oat/pull/65) ([landlessness](https://github.com/landlessness))
25
45
 
26
- - *Closed issue:* Nested serializers: undefined method [\#56](https://github.com/ismasan/oat/issues/56)
46
+ ## [v0.4.6](https://github.com/ismasan/oat/tree/v0.4.6) (2015-02-07)
47
+ [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.5...v0.4.6)
48
+
49
+ **Closed issues:**
50
+
51
+ - Serialize to vanilla JSON using the same serializer class [\#59](https://github.com/ismasan/oat/issues/59)
52
+ - HAL support for multiple link objects per relationship? [\#58](https://github.com/ismasan/oat/issues/58)
53
+ - Nested serializers: undefined method [\#56](https://github.com/ismasan/oat/issues/56)
54
+ - Array serialization [\#54](https://github.com/ismasan/oat/issues/54)
55
+ - Oat, Rails Responders and hypermedia mime types [\#50](https://github.com/ismasan/oat/issues/50)
56
+ - is lib/support/class\_attribute necessary? [\#44](https://github.com/ismasan/oat/issues/44)
27
57
 
28
- - *Closed issue:* HAL support for multiple link objects per relationship? [\#58](https://github.com/ismasan/oat/issues/58)
58
+ **Merged pull requests:**
29
59
 
30
- - *Closed issue:* Serialize to vanilla JSON using the same serializer class [\#59](https://github.com/ismasan/oat/issues/59)
60
+ - HAL support for an array of linked objects [\#60](https://github.com/ismasan/oat/pull/60) ([abargnesi](https://github.com/abargnesi))
61
+ - Fixing Nested Serializers example [\#57](https://github.com/ismasan/oat/pull/57) ([coderdave](https://github.com/coderdave))
62
+ - Fix spelling in README.md [\#53](https://github.com/ismasan/oat/pull/53) ([killpack](https://github.com/killpack))
63
+ - provide an example of using Rails responders to support requests using a Hypermedia mime type [\#52](https://github.com/ismasan/oat/pull/52) ([apsoto](https://github.com/apsoto))
64
+ - Stop entities/entity from duplicating entries in linked hash. [\#49](https://github.com/ismasan/oat/pull/49) ([dpdawson](https://github.com/dpdawson))
65
+ - Better documentation for Oat::Adapters::JsonAPI\#collection [\#46](https://github.com/ismasan/oat/pull/46) ([emilesilvis](https://github.com/emilesilvis))
66
+ - add the required rel attribute for Siren sub-entities [\#45](https://github.com/ismasan/oat/pull/45) ([apsoto](https://github.com/apsoto))
31
67
 
32
- ## [v0.4.5](https://github.com/ismasan/oat/tree/v0.4.5)
68
+ ## [v0.4.5](https://github.com/ismasan/oat/tree/v0.4.5) (2014-07-09)
33
69
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.4...v0.4.5)
34
- #### 09/07/14
35
- - *Merged pull-request:* Fix serializer ampersand warning [\#43](https://github.com/ismasan/oat/pull/43) ([iainbeeston](https://github.com/iainbeeston))
36
70
 
37
- - *Merged pull-request:* Update build matrix [\#42](https://github.com/ismasan/oat/pull/42) ([iainbeeston](https://github.com/iainbeeston))
71
+ **Closed issues:**
38
72
 
39
- - *Merged pull-request:* Update to rspec3 [\#41](https://github.com/ismasan/oat/pull/41) ([iainbeeston](https://github.com/iainbeeston))
73
+ - Thread Safety [\#39](https://github.com/ismasan/oat/issues/39)
40
74
 
41
- - *Closed issue:* Thread Safety [\#39](https://github.com/ismasan/oat/issues/39)
75
+ **Merged pull requests:**
42
76
 
43
- ## [v0.4.4](https://github.com/ismasan/oat/tree/v0.4.4)
77
+ - Fix serializer ampersand warning [\#43](https://github.com/ismasan/oat/pull/43) ([iainbeeston](https://github.com/iainbeeston))
78
+ - Update build matrix [\#42](https://github.com/ismasan/oat/pull/42) ([iainbeeston](https://github.com/iainbeeston))
79
+ - Update to rspec3 [\#41](https://github.com/ismasan/oat/pull/41) ([iainbeeston](https://github.com/iainbeeston))
80
+
81
+ ## [v0.4.4](https://github.com/ismasan/oat/tree/v0.4.4) (2014-05-26)
44
82
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.3...v0.4.4)
45
- #### 26/05/14
46
- - *Merged pull-request:* Add title addribute to siren action's fields [\#38](https://github.com/ismasan/oat/pull/38) ([erezesk](https://github.com/erezesk))
47
83
 
48
- - *Closed issue:* Top level json api meta [\#28](https://github.com/ismasan/oat/issues/28)
84
+ **Closed issues:**
85
+
86
+ - Top level json api meta [\#28](https://github.com/ismasan/oat/issues/28)
49
87
 
50
- ## [v0.4.3](https://github.com/ismasan/oat/tree/v0.4.3)
88
+ **Merged pull requests:**
89
+
90
+ - Add title addribute to siren action's fields [\#38](https://github.com/ismasan/oat/pull/38) ([erezesk](https://github.com/erezesk))
91
+
92
+ ## [v0.4.3](https://github.com/ismasan/oat/tree/v0.4.3) (2014-05-01)
51
93
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.2...v0.4.3)
52
- #### 01/05/14
53
- - *Merged pull-request:* json-api: Don't add templated links to the resource [\#37](https://github.com/ismasan/oat/pull/37) ([kjg](https://github.com/kjg))
54
94
 
55
- ## [v0.4.2](https://github.com/ismasan/oat/tree/v0.4.2)
95
+ **Merged pull requests:**
96
+
97
+ - json-api: Don't add templated links to the resource [\#37](https://github.com/ismasan/oat/pull/37) ([kjg](https://github.com/kjg))
98
+
99
+ ## [v0.4.2](https://github.com/ismasan/oat/tree/v0.4.2) (2014-04-29)
56
100
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.1...v0.4.2)
57
- #### 29/04/14
58
- - *Merged pull-request:* Add type attribute for siren actions [\#36](https://github.com/ismasan/oat/pull/36) ([erezesk](https://github.com/erezesk))
59
101
 
60
- - *Closed issue:* Errors management [\#35](https://github.com/ismasan/oat/issues/35)
102
+ **Closed issues:**
61
103
 
62
- ## [v0.4.1](https://github.com/ismasan/oat/tree/v0.4.1)
104
+ - Errors management [\#35](https://github.com/ismasan/oat/issues/35)
105
+
106
+ **Merged pull requests:**
107
+
108
+ - Add type attribute for siren actions [\#36](https://github.com/ismasan/oat/pull/36) ([erezesk](https://github.com/erezesk))
109
+
110
+ ## [v0.4.1](https://github.com/ismasan/oat/tree/v0.4.1) (2014-04-25)
63
111
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.4.0...v0.4.1)
64
- #### 25/04/14
65
- - *Merged pull-request:* Add meta property [\#32](https://github.com/ismasan/oat/pull/32) ([ahx](https://github.com/ahx))
66
112
 
67
- ## [v0.4.0](https://github.com/ismasan/oat/tree/v0.4.0)
113
+ **Merged pull requests:**
114
+
115
+ - Add meta property [\#32](https://github.com/ismasan/oat/pull/32) ([ahx](https://github.com/ahx))
116
+
117
+ ## [v0.4.0](https://github.com/ismasan/oat/tree/v0.4.0) (2014-04-07)
68
118
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.3.0...v0.4.0)
69
- #### 07/04/14
70
- - *Merged pull-request:* Don't block NoMethodErrors from raising [\#31](https://github.com/ismasan/oat/pull/31) ([shekibobo](https://github.com/shekibobo))
71
119
 
72
- - *Closed issue:* Does this support any type of caching? [\#30](https://github.com/ismasan/oat/issues/30)
120
+ **Closed issues:**
73
121
 
74
- ## [v0.3.0](https://github.com/ismasan/oat/tree/v0.3.0)
122
+ - Does this support any type of caching? [\#30](https://github.com/ismasan/oat/issues/30)
123
+
124
+ **Merged pull requests:**
125
+
126
+ - Don't block NoMethodErrors from raising [\#31](https://github.com/ismasan/oat/pull/31) ([shekibobo](https://github.com/shekibobo))
127
+
128
+ ## [v0.3.0](https://github.com/ismasan/oat/tree/v0.3.0) (2014-03-25)
75
129
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.2.5...v0.3.0)
76
- #### 25/03/14
77
- - *Merged pull-request:* Don't allow rake 10.2 on ruby 1.8.7 [\#29](https://github.com/ismasan/oat/pull/29) ([kjg](https://github.com/kjg))
78
130
 
79
- - *Merged pull-request:* Json api link templates [\#27](https://github.com/ismasan/oat/pull/27) ([kjg](https://github.com/kjg))
131
+ **Closed issues:**
80
132
 
81
- - *Merged pull-request:* Json api attribute links [\#26](https://github.com/ismasan/oat/pull/26) ([kjg](https://github.com/kjg))
133
+ - How to serialize many records? [\#24](https://github.com/ismasan/oat/issues/24)
82
134
 
83
- - *Merged pull-request:* Serializer from block or class update [\#16](https://github.com/ismasan/oat/pull/16) ([kjg](https://github.com/kjg))
135
+ **Merged pull requests:**
84
136
 
85
- - *Closed issue:* How to serialize many records? [\#24](https://github.com/ismasan/oat/issues/24)
137
+ - Don't allow rake 10.2 on ruby 1.8.7 [\#29](https://github.com/ismasan/oat/pull/29) ([kjg](https://github.com/kjg))
138
+ - Json api link templates [\#27](https://github.com/ismasan/oat/pull/27) ([kjg](https://github.com/kjg))
139
+ - Json api attribute links [\#26](https://github.com/ismasan/oat/pull/26) ([kjg](https://github.com/kjg))
86
140
 
87
- ## [v0.2.5](https://github.com/ismasan/oat/tree/v0.2.5)
141
+ ## [v0.2.5](https://github.com/ismasan/oat/tree/v0.2.5) (2014-03-20)
88
142
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.2.4...v0.2.5)
89
- #### 20/03/14
90
- - *Merged pull-request:* Json api nil entities [\#25](https://github.com/ismasan/oat/pull/25) ([kjg](https://github.com/kjg))
91
143
 
92
- ## [v0.2.4](https://github.com/ismasan/oat/tree/v0.2.4)
144
+ **Merged pull requests:**
145
+
146
+ - Json api nil entities [\#25](https://github.com/ismasan/oat/pull/25) ([kjg](https://github.com/kjg))
147
+
148
+ ## [v0.2.4](https://github.com/ismasan/oat/tree/v0.2.4) (2014-02-24)
93
149
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.2.3...v0.2.4)
94
- #### 24/02/14
95
- - *Merged pull-request:* Allow for serializing json api resource collections into root key [\#23](https://github.com/ismasan/oat/pull/23) ([kjg](https://github.com/kjg))
96
150
 
97
- - *Merged pull-request:* Json api subent top linked [\#22](https://github.com/ismasan/oat/pull/22) ([kjg](https://github.com/kjg))
151
+ **Merged pull requests:**
152
+
153
+ - Allow for serializing json api resource collections into root key [\#23](https://github.com/ismasan/oat/pull/23) ([kjg](https://github.com/kjg))
154
+ - Json api subent top linked [\#22](https://github.com/ismasan/oat/pull/22) ([kjg](https://github.com/kjg))
98
155
 
99
- ## [v0.2.3](https://github.com/ismasan/oat/tree/v0.2.3)
156
+ ## [v0.2.3](https://github.com/ismasan/oat/tree/v0.2.3) (2014-02-17)
100
157
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.2.2...v0.2.3)
101
- #### 17/02/14
102
- - *Merged pull-request:* Json api sub behaviour [\#20](https://github.com/ismasan/oat/pull/20) ([kjg](https://github.com/kjg))
103
158
 
104
- - *Merged pull-request:* Add version badge to README [\#18](https://github.com/ismasan/oat/pull/18) ([shekibobo](https://github.com/shekibobo))
159
+ **Merged pull requests:**
160
+
161
+ - Json api sub behaviour [\#20](https://github.com/ismasan/oat/pull/20) ([kjg](https://github.com/kjg))
162
+ - Add version badge to README [\#18](https://github.com/ismasan/oat/pull/18) ([shekibobo](https://github.com/shekibobo))
105
163
 
106
- ## [v0.2.2](https://github.com/ismasan/oat/tree/v0.2.2)
164
+ ## [v0.2.2](https://github.com/ismasan/oat/tree/v0.2.2) (2014-02-17)
107
165
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.1.2...v0.2.2)
108
- #### 17/02/14
109
- - *Merged pull-request:* Test more combinations in travis [\#17](https://github.com/ismasan/oat/pull/17) ([kjg](https://github.com/kjg))
110
166
 
111
- - *Merged pull-request:* Make specs more accurate and using updated syntax [\#15](https://github.com/ismasan/oat/pull/15) ([shekibobo](https://github.com/shekibobo))
167
+ **Closed issues:**
112
168
 
113
- - *Merged pull-request:* Better Context [\#14](https://github.com/ismasan/oat/pull/14) ([shekibobo](https://github.com/shekibobo))
169
+ - Remove activesupport dependency [\#10](https://github.com/ismasan/oat/issues/10)
114
170
 
115
- - *Merged pull-request:* Less active support [\#11](https://github.com/ismasan/oat/pull/11) ([kjg](https://github.com/kjg))
171
+ **Merged pull requests:**
116
172
 
117
- - *Closed issue:* Remove activesupport dependency [\#10](https://github.com/ismasan/oat/issues/10)
173
+ - Test more combinations in travis [\#17](https://github.com/ismasan/oat/pull/17) ([kjg](https://github.com/kjg))
174
+ - Serializer from block or class update [\#16](https://github.com/ismasan/oat/pull/16) ([kjg](https://github.com/kjg))
175
+ - Make specs more accurate and using updated syntax [\#15](https://github.com/ismasan/oat/pull/15) ([shekibobo](https://github.com/shekibobo))
176
+ - Better Context [\#14](https://github.com/ismasan/oat/pull/14) ([shekibobo](https://github.com/shekibobo))
177
+ - Less active support [\#11](https://github.com/ismasan/oat/pull/11) ([kjg](https://github.com/kjg))
118
178
 
119
- ## [v0.1.2](https://github.com/ismasan/oat/tree/v0.1.2)
179
+ ## [v0.1.2](https://github.com/ismasan/oat/tree/v0.1.2) (2014-02-13)
120
180
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.1.1...v0.1.2)
121
- #### 13/02/14
122
- - *Merged pull-request:* Support ruby 1.8.7 [\#12](https://github.com/ismasan/oat/pull/12) ([kjg](https://github.com/kjg))
123
181
 
124
- - *Closed issue:* Serializing collections [\#9](https://github.com/ismasan/oat/issues/9)
182
+ **Closed issues:**
183
+
184
+ - Serializing collections [\#9](https://github.com/ismasan/oat/issues/9)
185
+
186
+ **Merged pull requests:**
125
187
 
126
- ## [v0.1.1](https://github.com/ismasan/oat/tree/v0.1.1)
188
+ - Support ruby 1.8.7 [\#12](https://github.com/ismasan/oat/pull/12) ([kjg](https://github.com/kjg))
189
+
190
+ ## [v0.1.1](https://github.com/ismasan/oat/tree/v0.1.1) (2014-01-26)
127
191
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.1.0...v0.1.1)
128
- #### 26/01/14
129
- - *Merged pull-request:* Don't add invalid link relations to HAL output [\#8](https://github.com/ismasan/oat/pull/8) ([shekibobo](https://github.com/shekibobo))
130
192
 
131
- ## [v0.1.0](https://github.com/ismasan/oat/tree/v0.1.0)
193
+ **Merged pull requests:**
194
+
195
+ - Don't add invalid link relations to HAL output [\#8](https://github.com/ismasan/oat/pull/8) ([shekibobo](https://github.com/shekibobo))
196
+
197
+ ## [v0.1.0](https://github.com/ismasan/oat/tree/v0.1.0) (2014-01-14)
132
198
  [Full Changelog](https://github.com/ismasan/oat/compare/v0.0.1...v0.1.0)
133
- #### 14/01/14
134
- - *Merged pull-request:* Add Serializer#map\_properties to DRY property definitions [\#6](https://github.com/ismasan/oat/pull/6) ([shekibobo](https://github.com/shekibobo))
135
199
 
136
- - *Merged pull-request:* Add action support for Siren. [\#4](https://github.com/ismasan/oat/pull/4) ([SebastianEdwards](https://github.com/SebastianEdwards))
200
+ **Closed issues:**
201
+
202
+ - DRY property declaration [\#5](https://github.com/ismasan/oat/issues/5)
137
203
 
138
- - *Merged pull-request:* Don't try to serialize nil with an entity serializer [\#3](https://github.com/ismasan/oat/pull/3) ([shekibobo](https://github.com/shekibobo))
204
+ **Merged pull requests:**
139
205
 
140
- - *Merged pull-request:* Fix a small typo in the README [\#2](https://github.com/ismasan/oat/pull/2) ([stevenharman](https://github.com/stevenharman))
206
+ - Add Serializer\#map\_properties to DRY property definitions [\#6](https://github.com/ismasan/oat/pull/6) ([shekibobo](https://github.com/shekibobo))
207
+ - Add action support for Siren. [\#4](https://github.com/ismasan/oat/pull/4) ([SebastianEdwards](https://github.com/SebastianEdwards))
208
+ - Don't try to serialize nil with an entity serializer [\#3](https://github.com/ismasan/oat/pull/3) ([shekibobo](https://github.com/shekibobo))
209
+ - Fix a small typo in the README [\#2](https://github.com/ismasan/oat/pull/2) ([stevenharman](https://github.com/stevenharman))
141
210
 
142
- - *Closed issue:* DRY property declaration [\#5](https://github.com/ismasan/oat/issues/5)
211
+ ## [v0.0.1](https://github.com/ismasan/oat/tree/v0.0.1) (2013-11-18)
212
+ **Merged pull requests:**
143
213
 
144
- ## [v0.0.1](https://github.com/ismasan/oat/tree/v0.0.1)
145
- #### 18/11/13
146
- - *Merged pull-request:* Fix a few spelling and grammar errors [\#1](https://github.com/ismasan/oat/pull/1) ([leemachin](https://github.com/leemachin))
214
+ - Fix a few spelling and grammar errors [\#1](https://github.com/ismasan/oat/pull/1) ([leemachin](https://github.com/leemachin))
147
215
 
148
216
 
149
217
 
150
- \* *This changelog was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
218
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/lib/oat/adapter.rb CHANGED
@@ -27,6 +27,7 @@ module Oat
27
27
  if block_given?
28
28
  serializer_class = Class.new(serializer.class)
29
29
  serializer_class.schemas = []
30
+ serializer_class.schema_methods = []
30
31
  serializer_class.adapter self.class
31
32
  s = serializer_class.new(obj, serializer.context.merge(context_options), serializer.adapter_class, serializer.top)
32
33
  serializer.instance_exec(obj, s, &block)
@@ -1,12 +1,4 @@
1
1
  # http://jsonapi.org/format/#url-based-json-api
2
- require 'active_support/inflector'
3
- require 'active_support/core_ext/string/inflections'
4
- unless defined?(String.new.pluralize)
5
- class String
6
- include ActiveSupport::CoreExtensions::String::Inflections
7
- end
8
- end
9
-
10
2
  module Oat
11
3
  module Adapters
12
4
 
@@ -24,7 +16,7 @@ module Oat
24
16
  end
25
17
 
26
18
  def type(*types)
27
- @root_name = types.first.to_s.pluralize.to_sym
19
+ @root_name = pluralize(types.first.to_s).to_sym
28
20
  end
29
21
 
30
22
  def link(rel, opts = {})
@@ -74,7 +66,7 @@ module Oat
74
66
  if ent
75
67
  ent_hash = ent.to_hash
76
68
  _name = entity_name(name)
77
- link_name = _name.to_s.pluralize.to_sym
69
+ link_name = pluralize(_name.to_s).to_sym
78
70
  data[:links][_name] = ent_hash[:id]
79
71
 
80
72
  entity_hash[link_name] ||= []
@@ -87,7 +79,7 @@ module Oat
87
79
  def entities(name, collection, serializer_class = nil, context_options = {}, &block)
88
80
  return if collection.nil? || collection.empty?
89
81
  _name = entity_name(name)
90
- link_name = _name.to_s.pluralize.to_sym
82
+ link_name = pluralize(_name.to_s).to_sym
91
83
  data[:links][link_name] = []
92
84
 
93
85
  collection.each do |obj|
@@ -155,6 +147,15 @@ module Oat
155
147
  ent.to_hash.values.first.first if ent
156
148
  end
157
149
 
150
+ PLURAL = /s$/
151
+
152
+ def pluralize(str)
153
+ if str =~ PLURAL
154
+ str
155
+ else
156
+ "#{str}s"
157
+ end
158
+ end
158
159
  end
159
160
  end
160
161
  end
@@ -70,7 +70,7 @@ module Oat
70
70
  @data = { :name => name, :class => [], :fields => [] }
71
71
  end
72
72
 
73
- def class(value)
73
+ def klass(value)
74
74
  data[:class] << value
75
75
  end
76
76
 
@@ -91,7 +91,11 @@ module Oat
91
91
  attr_reader :data
92
92
 
93
93
  def initialize(name)
94
- @data = { :name => name }
94
+ @data = { :name => name, :class => []}
95
+ end
96
+
97
+ def klass(value)
98
+ data[:class] << value
95
99
  end
96
100
 
97
101
  %w(type value title).each do |attribute|
@@ -1,13 +1,23 @@
1
1
  require 'support/class_attribute'
2
+
2
3
  module Oat
3
4
  class Serializer
4
-
5
- class_attribute :_adapter, :logger, :schemas
5
+ extend ClassAttribute
6
+ class_attribute :_adapter, :logger, :schemas, :schema_methods
6
7
 
7
8
  self.schemas = []
9
+ self.schema_methods = []
8
10
 
9
11
  def self.schema(&block)
10
- self.schemas += [block] if block_given?
12
+ if block_given?
13
+ schema_method_name = :"schema_block_#{self.schema_methods.count}"
14
+
15
+ self.schemas += [block]
16
+ self.schema_methods += [schema_method_name]
17
+
18
+ define_method(schema_method_name, &block)
19
+ private(schema_method_name)
20
+ end
11
21
  end
12
22
 
13
23
  def self.adapter(adapter_class = nil)
@@ -34,7 +44,15 @@ module Oat
34
44
 
35
45
  def method_missing(name, *args, &block)
36
46
  if adapter.respond_to?(name)
37
- adapter.send(name, *args, &block)
47
+ self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
48
+ private
49
+
50
+ def #{name}(*args, &block)
51
+ adapter.#{name}(*args, &block)
52
+ end
53
+ RUBY
54
+
55
+ send(name, *args, &block)
38
56
  else
39
57
  super
40
58
  end
@@ -52,8 +70,8 @@ module Oat
52
70
 
53
71
  def to_hash
54
72
  @to_hash ||= (
55
- self.class.schemas.each do |schema|
56
- instance_eval(&schema)
73
+ self.class.schema_methods.each do |schema_method_name|
74
+ send(schema_method_name)
57
75
  end
58
76
 
59
77
  adapter.to_hash
data/lib/oat/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oat
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -1,66 +1,37 @@
1
- begin
2
- require 'active_support/core_ext/class/attribute'
3
- rescue LoadError
4
- module Kernel
5
- # Returns the object's singleton class.
6
- def singleton_class
7
- class << self
8
- self
9
- end
10
- end unless respond_to?(:singleton_class) # exists in 1.9.2
11
-
12
- # class_eval on an object acts like singleton_class.class_eval.
13
- def class_eval(*args, &block)
14
- singleton_class.class_eval(*args, &block)
15
- end
16
- end
17
-
18
- class Module
19
- def remove_possible_method(method)
20
- if method_defined?(method) || private_method_defined?(method)
21
- remove_method(method)
22
- end
23
- rescue NameError
24
- # If the requested method is defined on a superclass or included module,
25
- # method_defined? returns true but remove_method throws a NameError.
26
- # Ignore this.
27
- end
28
-
29
- def redefine_method(method, &block)
30
- remove_possible_method(method)
31
- define_method(method, &block)
32
- end
33
- end
34
-
35
- class Class
1
+ module Oat
2
+ module ClassAttribute
36
3
  def class_attribute(*attrs)
37
4
  attrs.each do |name|
38
5
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
39
- def self.#{name}() nil end
40
- def self.#{name}?() !!#{name} end
6
+ def self.#{name}() nil end
41
7
 
42
- def self.#{name}=(val)
43
- singleton_class.class_eval do
44
- remove_possible_method(:#{name})
45
- define_method(:#{name}) { val }
46
- end
8
+ def self.#{name}=(val)
9
+ singleton_class.class_eval do
10
+ define_method(:#{name}) { val }
11
+ end
47
12
 
48
- if singleton_class?
49
- class_eval do
50
- remove_possible_method(:#{name})
51
- def #{name}
52
- defined?(@#{name}) ? @#{name} : singleton_class.#{name}
13
+ if singleton_class?
14
+ class_eval do
15
+ def #{name}
16
+ defined?(@#{name}) ? @#{name} : singleton_class.#{name}
17
+ end
53
18
  end
54
19
  end
20
+ val
55
21
  end
56
- val
57
- end
58
22
  RUBY
59
23
 
60
24
  end
61
25
  end
62
26
 
63
27
  private
28
+
29
+ def singleton_class
30
+ class << self
31
+ self
32
+ end
33
+ end unless respond_to?(:singleton_class) # exists in 1.9.2
34
+
64
35
  def singleton_class?
65
36
  ancestors.first != self
66
37
  end
data/oat.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activesupport"
22
21
  spec.add_development_dependency "bundler", "~> 1.3"
23
22
  spec.add_development_dependency "rake"
24
23
  spec.add_development_dependency "rspec", ">= 3.0"
@@ -74,6 +74,7 @@ describe Oat::Adapters::Siren do
74
74
  )
75
75
 
76
76
  expect(actions.first.fetch(:fields)).to include(
77
+ :class => ['string'],
77
78
  :name => :current_password,
78
79
  :type => :password,
79
80
  :title => 'enter password:'
data/spec/fixtures.rb CHANGED
@@ -41,11 +41,12 @@ module Fixtures
41
41
  if adapter.respond_to?(:action)
42
42
  action :close_account do |action|
43
43
  action.href "http://foo.bar.com/#{item.id}/close_account"
44
- action.class 'danger'
45
- action.class 'irreversible'
44
+ action.klass 'danger'
45
+ action.klass 'irreversible'
46
46
  action.method 'DELETE'
47
47
  action.type 'application/json'
48
48
  action.field :current_password do |field|
49
+ field.klass 'string'
49
50
  field.type :password
50
51
  field.title 'enter password:'
51
52
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2018-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -95,16 +81,8 @@ files:
95
81
  - CHANGELOG.md
96
82
  - Gemfile
97
83
  - LICENSE
98
- - LICENSE.txt
99
84
  - README.md
100
85
  - Rakefile
101
- - gemfiles/Gemfile.as-1.4.4
102
- - gemfiles/Gemfile.as-2.3.x
103
- - gemfiles/Gemfile.as-3.0.x
104
- - gemfiles/Gemfile.as-3.1.x
105
- - gemfiles/Gemfile.as-3.2.x
106
- - gemfiles/Gemfile.as-4.0.x
107
- - gemfiles/Gemfile.as-4.1.x
108
86
  - lib/oat.rb
109
87
  - lib/oat/adapter.rb
110
88
  - lib/oat/adapters/hal.rb
@@ -141,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
119
  version: '0'
142
120
  requirements: []
143
121
  rubyforge_project:
144
- rubygems_version: 2.4.5
122
+ rubygems_version: 2.7.6
145
123
  signing_key:
146
124
  specification_version: 4
147
125
  summary: Adapters-based serializers with Hypermedia support
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 Ismael Celis
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'activesupport', '1.4.4'
5
- gem 'rake', '< 10.2'
6
- gemspec :path => "../"
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'activesupport', '~>2.3.18'
5
- gem 'rake', '< 10.2'
6
- gemspec :path => "../"
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'i18n', '0.6.9'
5
- gem 'activesupport', '~>3.0.20'
6
- gem 'rake', '< 10.2'
7
- gemspec :path => "../"
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'i18n', '0.6.9'
5
- gem 'activesupport', '~>3.1.12'
6
- gem 'rake', '< 10.2'
7
- gemspec :path => "../"
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'i18n', '0.6.9'
5
- gem 'activesupport', '~>3.2.16'
6
- gem 'rake', '< 10.2'
7
- gemspec :path => "../"
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'activesupport', '~>4.0.2'
5
- gemspec :path => "../"
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in oat.gemspec
4
- gem 'activesupport', '~>4.1.4'
5
- gemspec :path => "../"