absorb_api 0.1.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.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +11 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +203 -0
  6. data/Rakefile +2 -0
  7. data/absorb_api.gemspec +25 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/doc/AbsorbApi.html +216 -0
  11. data/doc/AbsorbApi/Base.html +239 -0
  12. data/doc/AbsorbApi/Category.html +173 -0
  13. data/doc/AbsorbApi/Certificate.html +212 -0
  14. data/doc/AbsorbApi/Chapter.html +160 -0
  15. data/doc/AbsorbApi/Collection.html +180 -0
  16. data/doc/AbsorbApi/Configuration.html +188 -0
  17. data/doc/AbsorbApi/Course.html +534 -0
  18. data/doc/AbsorbApi/CourseEnrollment.html +437 -0
  19. data/doc/AbsorbApi/Curriculum.html +498 -0
  20. data/doc/AbsorbApi/Department.html +242 -0
  21. data/doc/AbsorbApi/LessonEnrollment.html +370 -0
  22. data/doc/AbsorbApi/Orm.html +201 -0
  23. data/doc/AbsorbApi/Relations.html +301 -0
  24. data/doc/AbsorbApi/ResourceNotFound.html +102 -0
  25. data/doc/AbsorbApi/RouteNotFound.html +102 -0
  26. data/doc/AbsorbApi/User.html +615 -0
  27. data/doc/AbsorbApi/ValidationError.html +102 -0
  28. data/doc/Gemfile.html +100 -0
  29. data/doc/Gemfile_lock.html +150 -0
  30. data/doc/LICENSE_txt.html +113 -0
  31. data/doc/README_md.html +340 -0
  32. data/doc/Rakefile.html +93 -0
  33. data/doc/absorb_api_gemspec.html +126 -0
  34. data/doc/bin/setup.html +97 -0
  35. data/doc/created.rid +26 -0
  36. data/doc/css/fonts.css +167 -0
  37. data/doc/css/rdoc.css +590 -0
  38. data/doc/fonts/Lato-Light.ttf +0 -0
  39. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  40. data/doc/fonts/Lato-Regular.ttf +0 -0
  41. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  42. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  43. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  44. data/doc/images/add.png +0 -0
  45. data/doc/images/arrow_up.png +0 -0
  46. data/doc/images/brick.png +0 -0
  47. data/doc/images/brick_link.png +0 -0
  48. data/doc/images/bug.png +0 -0
  49. data/doc/images/bullet_black.png +0 -0
  50. data/doc/images/bullet_toggle_minus.png +0 -0
  51. data/doc/images/bullet_toggle_plus.png +0 -0
  52. data/doc/images/date.png +0 -0
  53. data/doc/images/delete.png +0 -0
  54. data/doc/images/find.png +0 -0
  55. data/doc/images/loadingAnimation.gif +0 -0
  56. data/doc/images/macFFBgHack.png +0 -0
  57. data/doc/images/package.png +0 -0
  58. data/doc/images/page_green.png +0 -0
  59. data/doc/images/page_white_text.png +0 -0
  60. data/doc/images/page_white_width.png +0 -0
  61. data/doc/images/plugin.png +0 -0
  62. data/doc/images/ruby.png +0 -0
  63. data/doc/images/tag_blue.png +0 -0
  64. data/doc/images/tag_green.png +0 -0
  65. data/doc/images/transparent.png +0 -0
  66. data/doc/images/wrench.png +0 -0
  67. data/doc/images/wrench_orange.png +0 -0
  68. data/doc/images/zoom.png +0 -0
  69. data/doc/index.html +135 -0
  70. data/doc/js/darkfish.js +161 -0
  71. data/doc/js/jquery.js +4 -0
  72. data/doc/js/navigation.js +142 -0
  73. data/doc/js/navigation.js.gz +0 -0
  74. data/doc/js/search.js +109 -0
  75. data/doc/js/search_index.js +1 -0
  76. data/doc/js/search_index.js.gz +0 -0
  77. data/doc/js/searcher.js +228 -0
  78. data/doc/js/searcher.js.gz +0 -0
  79. data/doc/table_of_contents.html +218 -0
  80. data/lib/absorb_api.rb +26 -0
  81. data/lib/absorb_api/base.rb +31 -0
  82. data/lib/absorb_api/category.rb +7 -0
  83. data/lib/absorb_api/certificate.rb +7 -0
  84. data/lib/absorb_api/chapter.rb +7 -0
  85. data/lib/absorb_api/collection.rb +19 -0
  86. data/lib/absorb_api/configuration.rb +21 -0
  87. data/lib/absorb_api/course.rb +24 -0
  88. data/lib/absorb_api/course_enrollment.rb +33 -0
  89. data/lib/absorb_api/curriculum.rb +7 -0
  90. data/lib/absorb_api/department.rb +10 -0
  91. data/lib/absorb_api/lesson_enrollment.rb +5 -0
  92. data/lib/absorb_api/orm.rb +28 -0
  93. data/lib/absorb_api/relations.rb +62 -0
  94. data/lib/absorb_api/user.rb +27 -0
  95. data/lib/absorb_api/version.rb +3 -0
  96. metadata +168 -0
@@ -0,0 +1,201 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module AbsorbApi::Orm - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ </script>
12
+
13
+ <script src="../js/jquery.js"></script>
14
+ <script src="../js/darkfish.js"></script>
15
+
16
+ <link href="../css/fonts.css" rel="stylesheet">
17
+ <link href="../css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="module">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="../index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="../table_of_contents.html#pages">Pages</a>
31
+ <a href="../table_of_contents.html#classes">Classes</a>
32
+ <a href="../table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+
55
+ <div id="class-metadata">
56
+
57
+
58
+
59
+ <div id="extends-section" class="nav-section">
60
+ <h3>Extended With Modules</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+
65
+ <li><span class="extend">ActiveSupport::Concern</span>
66
+
67
+
68
+ </ul>
69
+ </div>
70
+
71
+ <!-- Method Quickref -->
72
+ <div id="method-list-section" class="nav-section">
73
+ <h3>Methods</h3>
74
+
75
+ <ul class="link-list" role="directory">
76
+
77
+ <li ><a href="#method-i-all">#all</a>
78
+
79
+ <li ><a href="#method-i-find">#find</a>
80
+
81
+ </ul>
82
+ </div>
83
+
84
+ </div>
85
+ </nav>
86
+
87
+ <main role="main" aria-labelledby="module-AbsorbApi::Orm">
88
+ <h1 id="module-AbsorbApi::Orm" class="module">
89
+ module AbsorbApi::Orm
90
+ </h1>
91
+
92
+ <section class="description">
93
+
94
+ </section>
95
+
96
+
97
+
98
+
99
+ <section id="5Buntitled-5D" class="documentation-section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
110
+ <header>
111
+ <h3>Public Instance Methods</h3>
112
+ </header>
113
+
114
+
115
+ <div id="method-i-all" class="method-detail ">
116
+
117
+ <div class="method-heading">
118
+ <span class="method-name">all</span><span
119
+ class="method-args">()</span>
120
+
121
+ <span class="method-click-advice">click to toggle source</span>
122
+
123
+ </div>
124
+
125
+
126
+ <div class="method-description">
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <div class="method-source-code" id="all-source">
134
+ <pre><span class="ruby-comment"># File lib/absorb_api/orm.rb, line 16</span>
135
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">all</span>
136
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{to_s.demodulize.pluralize}&quot;</span>)
137
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">404</span>
138
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RouteNotFound</span>
139
+ <span class="ruby-keyword">else</span>
140
+ <span class="ruby-constant">Collection</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attributes</span><span class="ruby-operator">|</span>
141
+ <span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>)
142
+ <span class="ruby-keyword">end</span>, {<span class="ruby-identifier">klass</span><span class="ruby-operator">:</span> <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">demodulize</span> } )
143
+ <span class="ruby-keyword">end</span>
144
+ <span class="ruby-keyword">end</span></pre>
145
+ </div>
146
+
147
+ </div>
148
+
149
+
150
+
151
+
152
+ </div>
153
+
154
+
155
+ <div id="method-i-find" class="method-detail ">
156
+
157
+ <div class="method-heading">
158
+ <span class="method-name">find</span><span
159
+ class="method-args">(id)</span>
160
+
161
+ <span class="method-click-advice">click to toggle source</span>
162
+
163
+ </div>
164
+
165
+
166
+ <div class="method-description">
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <div class="method-source-code" id="find-source">
174
+ <pre><span class="ruby-comment"># File lib/absorb_api/orm.rb, line 10</span>
175
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">id</span>)
176
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ResourceNotFound</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">id</span>.<span class="ruby-identifier">blank?</span>
177
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{to_s.demodulize.pluralize}/#{id}&quot;</span>)
178
+ <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">404</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ResourceNotFound</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
179
+ <span class="ruby-keyword">end</span></pre>
180
+ </div>
181
+
182
+ </div>
183
+
184
+
185
+
186
+
187
+ </div>
188
+
189
+
190
+ </section>
191
+
192
+ </section>
193
+ </main>
194
+
195
+
196
+ <footer id="validator-badges" role="contentinfo">
197
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
198
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
199
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
200
+ </footer>
201
+
@@ -0,0 +1,301 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module AbsorbApi::Relations - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ </script>
12
+
13
+ <script src="../js/jquery.js"></script>
14
+ <script src="../js/darkfish.js"></script>
15
+
16
+ <link href="../css/fonts.css" rel="stylesheet">
17
+ <link href="../css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="module">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="../index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="../table_of_contents.html#pages">Pages</a>
31
+ <a href="../table_of_contents.html#classes">Classes</a>
32
+ <a href="../table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+
55
+ <div id="class-metadata">
56
+
57
+
58
+
59
+ <div id="extends-section" class="nav-section">
60
+ <h3>Extended With Modules</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+
65
+ <li><span class="extend">ActiveSupport::Concern</span>
66
+
67
+
68
+ </ul>
69
+ </div>
70
+
71
+ <!-- Method Quickref -->
72
+ <div id="method-list-section" class="nav-section">
73
+ <h3>Methods</h3>
74
+
75
+ <ul class="link-list" role="directory">
76
+
77
+ <li ><a href="#method-i-create">#create</a>
78
+
79
+ <li ><a href="#method-i-has_many">#has_many</a>
80
+
81
+ <li ><a href="#method-i-has_one">#has_one</a>
82
+
83
+ <li ><a href="#method-i-where">#where</a>
84
+
85
+ </ul>
86
+ </div>
87
+
88
+ </div>
89
+ </nav>
90
+
91
+ <main role="main" aria-labelledby="module-AbsorbApi::Relations">
92
+ <h1 id="module-AbsorbApi::Relations" class="module">
93
+ module AbsorbApi::Relations
94
+ </h1>
95
+
96
+ <section class="description">
97
+
98
+ </section>
99
+
100
+
101
+
102
+
103
+ <section id="5Buntitled-5D" class="documentation-section">
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
114
+ <header>
115
+ <h3>Public Instance Methods</h3>
116
+ </header>
117
+
118
+
119
+ <div id="method-i-create" class="method-detail ">
120
+
121
+ <div class="method-heading">
122
+ <span class="method-name">create</span><span
123
+ class="method-args">(attributes = []) { |object| ... }</span>
124
+
125
+ <span class="method-click-advice">click to toggle source</span>
126
+
127
+ </div>
128
+
129
+
130
+ <div class="method-description">
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <div class="method-source-code" id="create-source">
138
+ <pre><span class="ruby-comment"># File lib/absorb_api/relations.rb, line 45</span>
139
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">attributes</span> = [], <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
140
+ <span class="ruby-identifier">object</span> = <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">classify</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>)
141
+ <span class="ruby-keyword">yield</span> <span class="ruby-identifier">object</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
142
+ <span class="ruby-identifier">attrs</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_json</span>)
143
+ <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attrs</span>[ <span class="ruby-identifier">k</span>.<span class="ruby-identifier">camelize</span> ] = <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) }
144
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">post</span>(<span class="ruby-node">&quot;#{to_s.demodulize.pluralize}&quot;</span>, <span class="ruby-identifier">attrs</span>)
145
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">500</span>
146
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ValidationError</span>
147
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">405</span>
148
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RouteNotFound</span>
149
+ <span class="ruby-keyword">else</span>
150
+ <span class="ruby-identifier">object</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-string">&quot;Id&quot;</span>]
151
+ <span class="ruby-identifier">object</span>
152
+ <span class="ruby-keyword">end</span>
153
+ <span class="ruby-keyword">end</span></pre>
154
+ </div>
155
+
156
+ </div>
157
+
158
+
159
+
160
+
161
+ </div>
162
+
163
+
164
+ <div id="method-i-has_many" class="method-detail ">
165
+
166
+ <div class="method-heading">
167
+ <span class="method-name">has_many</span><span
168
+ class="method-args">(rel_name, klass = nil)</span>
169
+
170
+ <span class="method-click-advice">click to toggle source</span>
171
+
172
+ </div>
173
+
174
+
175
+ <div class="method-description">
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <div class="method-source-code" id="has_many-source">
183
+ <pre><span class="ruby-comment"># File lib/absorb_api/relations.rb, line 6</span>
184
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">has_many</span>(<span class="ruby-identifier">rel_name</span>, <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">nil</span>)
185
+ <span class="ruby-identifier">klass</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">rel_name</span>
186
+
187
+ <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;#{rel_name.to_s}&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">**</span><span class="ruby-identifier">conditions</span><span class="ruby-operator">|</span>
188
+ <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}&quot;</span>, <span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attributes</span><span class="ruby-operator">|</span>
189
+ <span class="ruby-node">&quot;AbsorbApi::#{klass.to_s.classify}&quot;</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>)
190
+ <span class="ruby-keyword">end</span>
191
+ <span class="ruby-keyword">end</span>
192
+
193
+ <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;find_#{rel_name.to_s.singularize}&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child_id</span><span class="ruby-operator">|</span>
194
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}/#{child_id}&quot;</span>)
195
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">400</span>
196
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ResourceNotFound</span>
197
+ <span class="ruby-keyword">else</span>
198
+ <span class="ruby-node">&quot;AbsorbApi::#{klass.to_s.classify}&quot;</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
199
+ <span class="ruby-keyword">end</span>
200
+ <span class="ruby-keyword">end</span>
201
+
202
+ <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;#{rel_name.to_s.singularize}_ids&quot;</span> <span class="ruby-keyword">do</span>
203
+ <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}&quot;</span>).<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attributes</span><span class="ruby-operator">|</span>
204
+ <span class="ruby-node">&quot;AbsorbApi::#{klass.to_s.classify}&quot;</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>)
205
+ <span class="ruby-keyword">end</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:id</span>)
206
+ <span class="ruby-keyword">end</span>
207
+ <span class="ruby-keyword">end</span></pre>
208
+ </div>
209
+
210
+ </div>
211
+
212
+
213
+
214
+
215
+ </div>
216
+
217
+
218
+ <div id="method-i-has_one" class="method-detail ">
219
+
220
+ <div class="method-heading">
221
+ <span class="method-name">has_one</span><span
222
+ class="method-args">(rel_name, klass = nil)</span>
223
+
224
+ <span class="method-click-advice">click to toggle source</span>
225
+
226
+ </div>
227
+
228
+
229
+ <div class="method-description">
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <div class="method-source-code" id="has_one-source">
237
+ <pre><span class="ruby-comment"># File lib/absorb_api/relations.rb, line 31</span>
238
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">has_one</span>(<span class="ruby-identifier">rel_name</span>, <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">nil</span>)
239
+ <span class="ruby-identifier">klass</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">rel_name</span>
240
+
241
+ <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;#{rel_name.to_s}&quot;</span> <span class="ruby-keyword">do</span>
242
+ <span class="ruby-node">&quot;AbsorbApi::#{klass.to_s.classify}&quot;</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{klass.to_s.pluralize}/&quot;</span><span class="ruby-operator">+</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">rel_name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;_id&quot;</span>)).<span class="ruby-identifier">body</span>)
243
+ <span class="ruby-keyword">end</span>
244
+ <span class="ruby-keyword">end</span></pre>
245
+ </div>
246
+
247
+ </div>
248
+
249
+
250
+
251
+
252
+ </div>
253
+
254
+
255
+ <div id="method-i-where" class="method-detail ">
256
+
257
+ <div class="method-heading">
258
+ <span class="method-name">where</span><span
259
+ class="method-args">(**conditions)</span>
260
+
261
+ <span class="method-click-advice">click to toggle source</span>
262
+
263
+ </div>
264
+
265
+
266
+ <div class="method-description">
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <div class="method-source-code" id="where-source">
274
+ <pre><span class="ruby-comment"># File lib/absorb_api/relations.rb, line 39</span>
275
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">where</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">conditions</span>)
276
+ <span class="ruby-constant">Collection</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">Base</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{to_s.demodulize.pluralize}&quot;</span>, <span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attributes</span><span class="ruby-operator">|</span>
277
+ <span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>)
278
+ <span class="ruby-keyword">end</span>, {<span class="ruby-identifier">klass</span><span class="ruby-operator">:</span> <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">demodulize</span> } )
279
+ <span class="ruby-keyword">end</span></pre>
280
+ </div>
281
+
282
+ </div>
283
+
284
+
285
+
286
+
287
+ </div>
288
+
289
+
290
+ </section>
291
+
292
+ </section>
293
+ </main>
294
+
295
+
296
+ <footer id="validator-badges" role="contentinfo">
297
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
298
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
299
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
300
+ </footer>
301
+