sword2ruby 1.0.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 (92) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +30 -0
  4. data/LICENCE +35 -0
  5. data/README.md +43 -0
  6. data/Rakefile +53 -0
  7. data/doc/Atom/Collection.html +837 -0
  8. data/doc/Atom/Element.html +197 -0
  9. data/doc/Atom/Entry.html +1795 -0
  10. data/doc/Atom/Feed.html +297 -0
  11. data/doc/Atom/Service.html +363 -0
  12. data/doc/Atom.html +158 -0
  13. data/doc/Gemfile.html +125 -0
  14. data/doc/Object.html +165 -0
  15. data/doc/REXML/Element.html +493 -0
  16. data/doc/REXML.html +158 -0
  17. data/doc/Rakefile.html +123 -0
  18. data/doc/Sword2Ruby/Atom.html +169 -0
  19. data/doc/Sword2Ruby/AutoDiscover.html +327 -0
  20. data/doc/Sword2Ruby/Connection.html +274 -0
  21. data/doc/Sword2Ruby/DepositReceipt.html +331 -0
  22. data/doc/Sword2Ruby/Exception.html +168 -0
  23. data/doc/Sword2Ruby/SwordAccept.html +169 -0
  24. data/doc/Sword2Ruby/SwordStatementOAIORE.html +277 -0
  25. data/doc/Sword2Ruby/User.html +272 -0
  26. data/doc/Sword2Ruby/Utility.html +1101 -0
  27. data/doc/Sword2Ruby.html +213 -0
  28. data/doc/created.rid +29 -0
  29. data/doc/images/add.png +0 -0
  30. data/doc/images/brick.png +0 -0
  31. data/doc/images/brick_link.png +0 -0
  32. data/doc/images/bug.png +0 -0
  33. data/doc/images/bullet_black.png +0 -0
  34. data/doc/images/bullet_toggle_minus.png +0 -0
  35. data/doc/images/bullet_toggle_plus.png +0 -0
  36. data/doc/images/date.png +0 -0
  37. data/doc/images/delete.png +0 -0
  38. data/doc/images/find.png +0 -0
  39. data/doc/images/loadingAnimation.gif +0 -0
  40. data/doc/images/macFFBgHack.png +0 -0
  41. data/doc/images/package.png +0 -0
  42. data/doc/images/page_green.png +0 -0
  43. data/doc/images/page_white_text.png +0 -0
  44. data/doc/images/page_white_width.png +0 -0
  45. data/doc/images/plugin.png +0 -0
  46. data/doc/images/ruby.png +0 -0
  47. data/doc/images/tag_blue.png +0 -0
  48. data/doc/images/tag_green.png +0 -0
  49. data/doc/images/transparent.png +0 -0
  50. data/doc/images/wrench.png +0 -0
  51. data/doc/images/wrench_orange.png +0 -0
  52. data/doc/images/zoom.png +0 -0
  53. data/doc/index.html +118 -0
  54. data/doc/js/darkfish.js +153 -0
  55. data/doc/js/jquery.js +18 -0
  56. data/doc/js/navigation.js +142 -0
  57. data/doc/js/search.js +94 -0
  58. data/doc/js/search_index.js +1 -0
  59. data/doc/js/searcher.js +228 -0
  60. data/doc/rdoc.css +543 -0
  61. data/doc/spec/fixtures/example_txt.html +125 -0
  62. data/doc/table_of_contents.html +267 -0
  63. data/lib/sword2ruby/auto_discover.rb +71 -0
  64. data/lib/sword2ruby/collection.rb +261 -0
  65. data/lib/sword2ruby/connection.rb +37 -0
  66. data/lib/sword2ruby/constant.rb +35 -0
  67. data/lib/sword2ruby/deposit_receipt.rb +52 -0
  68. data/lib/sword2ruby/element.rb +12 -0
  69. data/lib/sword2ruby/entry.rb +602 -0
  70. data/lib/sword2ruby/exception.rb +7 -0
  71. data/lib/sword2ruby/feed.rb +34 -0
  72. data/lib/sword2ruby/rexml_element.rb +79 -0
  73. data/lib/sword2ruby/service.rb +79 -0
  74. data/lib/sword2ruby/sword_accept.rb +10 -0
  75. data/lib/sword2ruby/sword_statement_oai_ore.rb +38 -0
  76. data/lib/sword2ruby/user.rb +25 -0
  77. data/lib/sword2ruby/utility.rb +232 -0
  78. data/lib/sword2ruby/version.rb +4 -0
  79. data/lib/sword2ruby.rb +32 -0
  80. data/spec/auto_discover_spec.rb +30 -0
  81. data/spec/collection_spec.rb +33 -0
  82. data/spec/connection_spec.rb +21 -0
  83. data/spec/end_to_end_spec.rb +235 -0
  84. data/spec/fixtures/example.txt +3 -0
  85. data/spec/fixtures/snowflake.png +0 -0
  86. data/spec/fixtures/zip-test.zip +0 -0
  87. data/spec/service_spec.rb +38 -0
  88. data/spec/statement_spec.rb +53 -0
  89. data/spec/test_constants.rb +32 -0
  90. data/sword2ruby.gemspec +42 -0
  91. data/sword2ruby.tmproj +27 -0
  92. metadata +197 -0
@@ -0,0 +1,297 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Atom::Feed - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/sword2ruby/feed.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link"><a href="Element.html">Atom::Element</a>
63
+
64
+ </nav>
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <nav id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+
71
+ <ul class="link-list">
72
+
73
+ <li><a href="#method-i-sword_state">#sword_state</a>
74
+
75
+ <li><a href="#method-i-sword_state_categories">#sword_state_categories</a>
76
+
77
+ <li><a href="#method-i-sword_state_description">#sword_state_description</a>
78
+
79
+ </ul>
80
+ </nav>
81
+
82
+ </div>
83
+
84
+ <div id="project-metadata">
85
+ <nav id="fileindex-section" class="section project-section">
86
+ <h3 class="section-header">Pages</h3>
87
+
88
+ <ul>
89
+
90
+ <li class="file"><a href="../Gemfile.html">Gemfile</a>
91
+
92
+ <li class="file"><a href="../Rakefile.html">Rakefile</a>
93
+
94
+ <li class="file"><a href="../spec/fixtures/example_txt.html">example</a>
95
+
96
+ </ul>
97
+ </nav>
98
+
99
+ <nav id="classindex-section" class="section project-section">
100
+ <h3 class="section-header">Class and Module Index</h3>
101
+
102
+ <ul class="link-list">
103
+
104
+ <li><a href="../Sword2Ruby.html">Sword2Ruby</a>
105
+
106
+ <li><a href="../Sword2Ruby/Atom.html">Sword2Ruby::Atom</a>
107
+
108
+ <li><a href="../Sword2Ruby/AutoDiscover.html">Sword2Ruby::AutoDiscover</a>
109
+
110
+ <li><a href="../Sword2Ruby/Connection.html">Sword2Ruby::Connection</a>
111
+
112
+ <li><a href="../Sword2Ruby/DepositReceipt.html">Sword2Ruby::DepositReceipt</a>
113
+
114
+ <li><a href="../Sword2Ruby/Exception.html">Sword2Ruby::Exception</a>
115
+
116
+ <li><a href="../Sword2Ruby/SwordAccept.html">Sword2Ruby::SwordAccept</a>
117
+
118
+ <li><a href="../Sword2Ruby/SwordStatementOAIORE.html">Sword2Ruby::SwordStatementOAIORE</a>
119
+
120
+ <li><a href="../Sword2Ruby/User.html">Sword2Ruby::User</a>
121
+
122
+ <li><a href="../Sword2Ruby/Utility.html">Sword2Ruby::Utility</a>
123
+
124
+ <li><a href="../Atom.html">Atom</a>
125
+
126
+ <li><a href="../Atom/Collection.html">Atom::Collection</a>
127
+
128
+ <li><a href="../Atom/Element.html">Atom::Element</a>
129
+
130
+ <li><a href="../Atom/Entry.html">Atom::Entry</a>
131
+
132
+ <li><a href="../Atom/Feed.html">Atom::Feed</a>
133
+
134
+ <li><a href="../Atom/Service.html">Atom::Service</a>
135
+
136
+ <li><a href="../REXML.html">REXML</a>
137
+
138
+ <li><a href="../REXML/Element.html">REXML::Element</a>
139
+
140
+ <li><a href="../Object.html">Object</a>
141
+
142
+ </ul>
143
+ </nav>
144
+
145
+ </div>
146
+ </nav>
147
+
148
+ <div id="documentation">
149
+ <h1 class="class">class Atom::Feed</h1>
150
+
151
+ <div id="description" class="description">
152
+
153
+ <p>Extend existing <a href="Service.html">Atom::Service</a> with Sword methods</p>
154
+
155
+ </div><!-- description -->
156
+
157
+
158
+
159
+
160
+ <section id="5Buntitled-5D" class="documentation-section">
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <!-- Methods -->
170
+
171
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
172
+ <h3 class="section-header">Public Instance Methods</h3>
173
+
174
+
175
+ <div id="method-i-sword_state" class="method-detail ">
176
+
177
+ <div class="method-heading">
178
+ <span class="method-name">sword_state</span><span
179
+ class="method-args">()</span>
180
+ <span class="method-click-advice">click to toggle source</span>
181
+ </div>
182
+
183
+
184
+ <div class="method-description">
185
+
186
+ <p>This method returns the string href of the &lt;sword:state&gt; tag (usually
187
+ contained in the Sword Statement <a href="../Atom.html">Atom</a> <a
188
+ href="Feed.html">Feed</a>), or nil if it is not defined.</p>
189
+
190
+ <p>For more information, see the Sword2 specification: <a
191
+ href="http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/tags/sword-2.0/SWORDProfile.html?revision=377#statement_predicates_state">section
192
+ 11.1.2. “sword:state”</a>.</p>
193
+
194
+
195
+
196
+ <div class="method-source-code" id="sword_state-source">
197
+ <pre><span class="ruby-comment"># File lib/sword2ruby/feed.rb, line 20</span>
198
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sword_state</span>
199
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_element_attribute_value</span>(<span class="ruby-identifier">extensions</span>, <span class="ruby-string">&quot;sword:state&quot;</span>, <span class="ruby-string">&quot;href&quot;</span>)
200
+ <span class="ruby-keyword">end</span></pre>
201
+ </div><!-- sword_state-source -->
202
+
203
+ </div>
204
+
205
+
206
+
207
+
208
+ </div><!-- sword_state-method -->
209
+
210
+
211
+ <div id="method-i-sword_state_categories" class="method-detail ">
212
+
213
+ <div class="method-heading">
214
+ <span class="method-name">sword_state_categories</span><span
215
+ class="method-args">()</span>
216
+ <span class="method-click-advice">click to toggle source</span>
217
+ </div>
218
+
219
+
220
+ <div class="method-description">
221
+
222
+ <p>This method returns an array of Atom::Categories of the original deposit
223
+ (usually contained in the Sword Statement <a href="../Atom.html">Atom</a>
224
+ <a href="Feed.html">Feed</a>), or an empty array [ ] if none are defined.</p>
225
+
226
+ <p>For more information, see the Sword2 specification: <a
227
+ href="http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/tags/sword-2.0/SWORDProfile.html?revision=377#statement_atom">section
228
+ 11.4. “Atom Serialisation”</a>.</p>
229
+
230
+
231
+
232
+ <div class="method-source-code" id="sword_state_categories-source">
233
+ <pre><span class="ruby-comment"># File lib/sword2ruby/feed.rb, line 12</span>
234
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sword_state_categories</span>
235
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_elements_by_scheme</span>(<span class="ruby-identifier">categories</span>, <span class="ruby-string">&quot;http://purl.org/net/sword/terms/state&quot;</span>)
236
+ <span class="ruby-keyword">end</span></pre>
237
+ </div><!-- sword_state_categories-source -->
238
+
239
+ </div>
240
+
241
+
242
+
243
+
244
+ </div><!-- sword_state_categories-method -->
245
+
246
+
247
+ <div id="method-i-sword_state_description" class="method-detail ">
248
+
249
+ <div class="method-heading">
250
+ <span class="method-name">sword_state_description</span><span
251
+ class="method-args">()</span>
252
+ <span class="method-click-advice">click to toggle source</span>
253
+ </div>
254
+
255
+
256
+ <div class="method-description">
257
+
258
+ <p>This method returns the string value of the &lt;sword:stateDescription&gt;
259
+ tag (usually contained in the Sword Statement <a
260
+ href="../Atom.html">Atom</a> <a href="Feed.html">Feed</a>), or nil if it is
261
+ not defined.</p>
262
+
263
+ <p>For more information, see the Sword2 specification: <a
264
+ href="http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/tags/sword-2.0/SWORDProfile.html?revision=377#statement_predicates_description">section
265
+ 11.1.7. “sword:state”</a>.</p>
266
+
267
+
268
+
269
+ <div class="method-source-code" id="sword_state_description-source">
270
+ <pre><span class="ruby-comment"># File lib/sword2ruby/feed.rb, line 28</span>
271
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sword_state_description</span>
272
+ <span class="ruby-identifier">swordstate</span> = <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_element_by_name</span>(<span class="ruby-identifier">extensions</span>, <span class="ruby-string">&quot;sword:state&quot;</span>)
273
+ <span class="ruby-identifier">swordstate</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_element_text</span>(<span class="ruby-identifier">swordstate</span>.<span class="ruby-identifier">elements</span>, <span class="ruby-string">&quot;sword:stateDescription&quot;</span>)
274
+ <span class="ruby-keyword">end</span></pre>
275
+ </div><!-- sword_state_description-source -->
276
+
277
+ </div>
278
+
279
+
280
+
281
+
282
+ </div><!-- sword_state_description-method -->
283
+
284
+
285
+ </section><!-- public-instance-method-details -->
286
+
287
+ </section><!-- 5Buntitled-5D -->
288
+
289
+ </div><!-- documentation -->
290
+
291
+
292
+ <footer id="validator-badges">
293
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
294
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
295
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
296
+ </footer>
297
+
@@ -0,0 +1,363 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Atom::Service - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/sword2ruby/service.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link"><a href="Element.html">Atom::Element</a>
63
+
64
+ </nav>
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <nav id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+
71
+ <ul class="link-list">
72
+
73
+ <li><a href="#method-c-new">::new</a>
74
+
75
+ <li><a href="#method-i-service_document_uri">#service_document_uri</a>
76
+
77
+ <li><a href="#method-i-sword_max_upload_size">#sword_max_upload_size</a>
78
+
79
+ <li><a href="#method-i-sword_version">#sword_version</a>
80
+
81
+ </ul>
82
+ </nav>
83
+
84
+ </div>
85
+
86
+ <div id="project-metadata">
87
+ <nav id="fileindex-section" class="section project-section">
88
+ <h3 class="section-header">Pages</h3>
89
+
90
+ <ul>
91
+
92
+ <li class="file"><a href="../Gemfile.html">Gemfile</a>
93
+
94
+ <li class="file"><a href="../Rakefile.html">Rakefile</a>
95
+
96
+ <li class="file"><a href="../spec/fixtures/example_txt.html">example</a>
97
+
98
+ </ul>
99
+ </nav>
100
+
101
+ <nav id="classindex-section" class="section project-section">
102
+ <h3 class="section-header">Class and Module Index</h3>
103
+
104
+ <ul class="link-list">
105
+
106
+ <li><a href="../Sword2Ruby.html">Sword2Ruby</a>
107
+
108
+ <li><a href="../Sword2Ruby/Atom.html">Sword2Ruby::Atom</a>
109
+
110
+ <li><a href="../Sword2Ruby/AutoDiscover.html">Sword2Ruby::AutoDiscover</a>
111
+
112
+ <li><a href="../Sword2Ruby/Connection.html">Sword2Ruby::Connection</a>
113
+
114
+ <li><a href="../Sword2Ruby/DepositReceipt.html">Sword2Ruby::DepositReceipt</a>
115
+
116
+ <li><a href="../Sword2Ruby/Exception.html">Sword2Ruby::Exception</a>
117
+
118
+ <li><a href="../Sword2Ruby/SwordAccept.html">Sword2Ruby::SwordAccept</a>
119
+
120
+ <li><a href="../Sword2Ruby/SwordStatementOAIORE.html">Sword2Ruby::SwordStatementOAIORE</a>
121
+
122
+ <li><a href="../Sword2Ruby/User.html">Sword2Ruby::User</a>
123
+
124
+ <li><a href="../Sword2Ruby/Utility.html">Sword2Ruby::Utility</a>
125
+
126
+ <li><a href="../Atom.html">Atom</a>
127
+
128
+ <li><a href="../Atom/Collection.html">Atom::Collection</a>
129
+
130
+ <li><a href="../Atom/Element.html">Atom::Element</a>
131
+
132
+ <li><a href="../Atom/Entry.html">Atom::Entry</a>
133
+
134
+ <li><a href="../Atom/Feed.html">Atom::Feed</a>
135
+
136
+ <li><a href="../Atom/Service.html">Atom::Service</a>
137
+
138
+ <li><a href="../REXML.html">REXML</a>
139
+
140
+ <li><a href="../REXML/Element.html">REXML::Element</a>
141
+
142
+ <li><a href="../Object.html">Object</a>
143
+
144
+ </ul>
145
+ </nav>
146
+
147
+ </div>
148
+ </nav>
149
+
150
+ <div id="documentation">
151
+ <h1 class="class">class Atom::Service</h1>
152
+
153
+ <div id="description" class="description">
154
+
155
+ <p>Extend existing <a href="Service.html">Atom::Service</a> with Sword methods</p>
156
+
157
+ <p>For more information, see the Sword2 specification: <a
158
+ href="http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/tags/sword-2.0/SWORDProfile.html?revision=377#protocoloperations_retreivingservicedocument">section
159
+ 6.1. “Retrieving a Service Document”</a>.</p>
160
+
161
+ </div><!-- description -->
162
+
163
+
164
+
165
+
166
+ <section id="5Buntitled-5D" class="documentation-section">
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ <!-- Methods -->
176
+
177
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
178
+ <h3 class="section-header">Public Class Methods</h3>
179
+
180
+
181
+ <div id="method-c-new" class="method-detail ">
182
+
183
+ <div class="method-heading">
184
+ <span class="method-name">new</span><span
185
+ class="method-args">(service_uri, connection = Connection.new())</span>
186
+ <span class="method-click-advice">click to toggle source</span>
187
+ </div>
188
+
189
+
190
+ <div class="method-description">
191
+
192
+ <p>Retrieves and parses an <a href="../Atom.html">Atom</a> service document.</p>
193
+
194
+ <h3 id="method-c-new-label-Parameters">Parameters</h3>
195
+ <dl class="rdoc-list note-list"><dt>:service_uri
196
+ <dd>
197
+ <p>The URI to the Sword <a href="Service.html">Service</a> Document.</p>
198
+ </dd><dt>:connection
199
+ <dd>
200
+ <p>(optional) <a
201
+ href="../Sword2Ruby/Connection.html">Sword2Ruby::Connection</a> object used
202
+ to perform the operation. If not supplied, a new Connection object will be
203
+ created.</p>
204
+ </dd></dl>
205
+
206
+
207
+
208
+ <div class="method-source-code" id="new-source">
209
+ <pre><span class="ruby-comment"># File lib/sword2ruby/service.rb, line 31</span>
210
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">service_uri</span>, <span class="ruby-identifier">connection</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span>())
211
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">check_argument_class</span>(<span class="ruby-string">'service_uri'</span>, <span class="ruby-identifier">service_uri</span>, <span class="ruby-constant">String</span>)
212
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">check_uri</span>(<span class="ruby-identifier">service_uri</span>)
213
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">check_argument_class</span>(<span class="ruby-string">'connection'</span>, <span class="ruby-identifier">connection</span>, <span class="ruby-constant">Connection</span>)
214
+
215
+
216
+ <span class="ruby-keyword">super</span>()
217
+
218
+ <span class="ruby-ivar">@http</span> = <span class="ruby-identifier">connection</span>
219
+
220
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">service_uri</span>.<span class="ruby-identifier">empty?</span>
221
+
222
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">service_uri</span>)
223
+
224
+ <span class="ruby-identifier">rxml</span> = <span class="ruby-keyword">nil</span>
225
+
226
+ <span class="ruby-identifier">res</span> = <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">base</span>, <span class="ruby-string">&quot;Accept&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;application/atomsvc+xml&quot;</span>)
227
+ <span class="ruby-identifier">res</span>.<span class="ruby-identifier">validate_content_type</span>([<span class="ruby-string">&quot;application/atomsvc+xml&quot;</span>])
228
+
229
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span>
230
+ <span class="ruby-identifier">service</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>, <span class="ruby-identifier">base</span>, <span class="ruby-keyword">self</span>)
231
+
232
+ <span class="ruby-comment">#Update workspaces, collections and their feeds to use the Service's http connection</span>
233
+ <span class="ruby-identifier">set_http</span>(<span class="ruby-identifier">connection</span>)
234
+
235
+ <span class="ruby-identifier">service</span>
236
+ <span class="ruby-keyword">else</span>
237
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Sword2Ruby</span><span class="ruby-operator">::</span><span class="ruby-constant">Exception</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Failed to do get(#{service_uri}): server returned #{res.code} #{res.message}&quot;</span>)
238
+ <span class="ruby-keyword">end</span>
239
+
240
+ <span class="ruby-keyword">end</span></pre>
241
+ </div><!-- new-source -->
242
+
243
+ </div>
244
+
245
+
246
+
247
+
248
+ </div><!-- new-method -->
249
+
250
+
251
+ </section><!-- public-class-method-details -->
252
+
253
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
254
+ <h3 class="section-header">Public Instance Methods</h3>
255
+
256
+
257
+ <div id="method-i-service_document_uri" class="method-detail ">
258
+
259
+ <div class="method-heading">
260
+ <span class="method-name">service_document_uri</span><span
261
+ class="method-args">()</span>
262
+ <span class="method-click-advice">click to toggle source</span>
263
+ </div>
264
+
265
+
266
+ <div class="method-description">
267
+
268
+ <p>This method returns the URI object of the service document.</p>
269
+
270
+
271
+
272
+ <div class="method-source-code" id="service_document_uri-source">
273
+ <pre><span class="ruby-comment"># File lib/sword2ruby/service.rb, line 11</span>
274
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">service_document_uri</span>
275
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">to_s</span>
276
+ <span class="ruby-keyword">end</span></pre>
277
+ </div><!-- service_document_uri-source -->
278
+
279
+ </div>
280
+
281
+
282
+
283
+
284
+ </div><!-- service_document_uri-method -->
285
+
286
+
287
+ <div id="method-i-sword_max_upload_size" class="method-detail ">
288
+
289
+ <div class="method-heading">
290
+ <span class="method-name">sword_max_upload_size</span><span
291
+ class="method-args">()</span>
292
+ <span class="method-click-advice">click to toggle source</span>
293
+ </div>
294
+
295
+
296
+ <div class="method-description">
297
+
298
+ <p>This method returns the integer value of the &lt;sword:maxUploadSize&gt;
299
+ tag (usually contained in the <a href="Service.html">Service</a> Document),
300
+ or 0 if it is not defined.</p>
301
+
302
+
303
+
304
+ <div class="method-source-code" id="sword_max_upload_size-source">
305
+ <pre><span class="ruby-comment"># File lib/sword2ruby/service.rb, line 23</span>
306
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sword_max_upload_size</span>
307
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_element_integer</span>(<span class="ruby-identifier">extensions</span>, <span class="ruby-string">&quot;sword:maxUploadSize&quot;</span>)
308
+ <span class="ruby-keyword">end</span></pre>
309
+ </div><!-- sword_max_upload_size-source -->
310
+
311
+ </div>
312
+
313
+
314
+
315
+
316
+ </div><!-- sword_max_upload_size-method -->
317
+
318
+
319
+ <div id="method-i-sword_version" class="method-detail ">
320
+
321
+ <div class="method-heading">
322
+ <span class="method-name">sword_version</span><span
323
+ class="method-args">()</span>
324
+ <span class="method-click-advice">click to toggle source</span>
325
+ </div>
326
+
327
+
328
+ <div class="method-description">
329
+
330
+ <p>This method returns the string value of the &lt;sword:version&gt; tag
331
+ (usually contained in the <a href="Service.html">Service</a> Document), or
332
+ nil if it is not defined.</p>
333
+
334
+
335
+
336
+ <div class="method-source-code" id="sword_version-source">
337
+ <pre><span class="ruby-comment"># File lib/sword2ruby/service.rb, line 17</span>
338
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sword_version</span>
339
+ <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_element_text</span>(<span class="ruby-identifier">extensions</span>, <span class="ruby-string">&quot;sword:version&quot;</span>)
340
+ <span class="ruby-keyword">end</span></pre>
341
+ </div><!-- sword_version-source -->
342
+
343
+ </div>
344
+
345
+
346
+
347
+
348
+ </div><!-- sword_version-method -->
349
+
350
+
351
+ </section><!-- public-instance-method-details -->
352
+
353
+ </section><!-- 5Buntitled-5D -->
354
+
355
+ </div><!-- documentation -->
356
+
357
+
358
+ <footer id="validator-badges">
359
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
360
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
361
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
362
+ </footer>
363
+