wsc_sdk 1.3.1

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 (265) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +146 -0
  3. data/.circleci/docker/build/Dockerfile +3 -0
  4. data/.circleci/helpers/add_preamble.rb +29 -0
  5. data/.circleci/helpers/build_docs.sh +5 -0
  6. data/.circleci/helpers/build_gem.sh +5 -0
  7. data/.circleci/helpers/debundle-context.sh +14 -0
  8. data/.circleci/helpers/finalize_release.sh +24 -0
  9. data/.circleci/helpers/publish_docs.sh +10 -0
  10. data/.circleci/helpers/release_gem.sh +8 -0
  11. data/.circleci/helpers/setup.sh +11 -0
  12. data/.circleci/helpers/setup_aws.sh +13 -0
  13. data/.circleci/helpers/setup_gem.sh +2 -0
  14. data/.circleci/helpers/setup_git.sh +27 -0
  15. data/.circleci/helpers/setup_rubygems.sh +15 -0
  16. data/.circleci/helpers/test_integration.sh +12 -0
  17. data/.circleci/helpers/test_unit.sh +6 -0
  18. data/.circleci/jobs/publish-production.sh +17 -0
  19. data/.circleci/jobs/publish-staging.sh +17 -0
  20. data/.circleci/jobs/release-production.sh +21 -0
  21. data/.circleci/jobs/test-integration.sh +9 -0
  22. data/.circleci/jobs/test-unit.sh +9 -0
  23. data/.circleci/tag_repo.rb +46 -0
  24. data/.gitignore +28 -0
  25. data/.rspec +2 -0
  26. data/.yard/config +2 -0
  27. data/.yard/template/default/fulldoc/html/css/custom.css +151 -0
  28. data/.yard/template/default/layout/html/footer.erb +0 -0
  29. data/.yard/template/default/layout/html/headers.erb +10 -0
  30. data/.yard/template/default/layout/html/layout.erb +45 -0
  31. data/.yard/template/default/layout/html/setup.rb +24 -0
  32. data/.yardopts +1 -0
  33. data/CODE_OF_CONDUCT.md +74 -0
  34. data/Gemfile +6 -0
  35. data/Gemfile.lock +99 -0
  36. data/LICENSE.txt +28 -0
  37. data/README.md +397 -0
  38. data/Rakefile +2 -0
  39. data/bin/console +14 -0
  40. data/bin/setup +8 -0
  41. data/doc/Hash.html +291 -0
  42. data/doc/WscSdk.html +570 -0
  43. data/doc/WscSdk/ApiResponse.html +242 -0
  44. data/doc/WscSdk/Attributes.html +128 -0
  45. data/doc/WscSdk/Attributes/Mode.html +191 -0
  46. data/doc/WscSdk/Attributes/Type.html +389 -0
  47. data/doc/WscSdk/Client.html +2677 -0
  48. data/doc/WscSdk/Configuration.html +595 -0
  49. data/doc/WscSdk/Endpoint.html +2974 -0
  50. data/doc/WscSdk/Endpoints.html +141 -0
  51. data/doc/WscSdk/Endpoints/CustomStreamTargets.html +383 -0
  52. data/doc/WscSdk/Endpoints/LiveStreams.html +197 -0
  53. data/doc/WscSdk/Endpoints/OutputStreamTargets.html +180 -0
  54. data/doc/WscSdk/Endpoints/Outputs.html +180 -0
  55. data/doc/WscSdk/Endpoints/StreamTargets.html +446 -0
  56. data/doc/WscSdk/Endpoints/Transcoders.html +197 -0
  57. data/doc/WscSdk/Endpoints/UllStreamTargets.html +383 -0
  58. data/doc/WscSdk/Endpoints/WowzaStreamTargets.html +383 -0
  59. data/doc/WscSdk/Enum.html +225 -0
  60. data/doc/WscSdk/Enums.html +321 -0
  61. data/doc/WscSdk/Enums/BillingMode.html +188 -0
  62. data/doc/WscSdk/Enums/BroadcastLocation.html +396 -0
  63. data/doc/WscSdk/Enums/BufferSize.html +301 -0
  64. data/doc/WscSdk/Enums/ClosedCaptionType.html +221 -0
  65. data/doc/WscSdk/Enums/CustomProvider.html +252 -0
  66. data/doc/WscSdk/Enums/DeliveryMethod.html +188 -0
  67. data/doc/WscSdk/Enums/DeliveryType.html +188 -0
  68. data/doc/WscSdk/Enums/Encoder.html +460 -0
  69. data/doc/WscSdk/Enums/Errors.html +555 -0
  70. data/doc/WscSdk/Enums/IdleTimeout.html +398 -0
  71. data/doc/WscSdk/Enums/ImagePosition.html +220 -0
  72. data/doc/WscSdk/Enums/ModelMode.html +175 -0
  73. data/doc/WscSdk/Enums/ModelType.html +373 -0
  74. data/doc/WscSdk/Enums/PlayerType.html +188 -0
  75. data/doc/WscSdk/Enums/Protocol.html +204 -0
  76. data/doc/WscSdk/Enums/TargetDeliveryProtocol.html +188 -0
  77. data/doc/WscSdk/Enums/TranscoderType.html +188 -0
  78. data/doc/WscSdk/Enums/UserRegion.html +383 -0
  79. data/doc/WscSdk/Enums/WowzaProvider.html +188 -0
  80. data/doc/WscSdk/Errors.html +683 -0
  81. data/doc/WscSdk/Loggable.html +346 -0
  82. data/doc/WscSdk/Model.html +3316 -0
  83. data/doc/WscSdk/ModelList.html +442 -0
  84. data/doc/WscSdk/ModelTemplate.html +267 -0
  85. data/doc/WscSdk/Models.html +141 -0
  86. data/doc/WscSdk/Models/CustomStreamTarget.html +192 -0
  87. data/doc/WscSdk/Models/Error.html +351 -0
  88. data/doc/WscSdk/Models/LiveStream.html +601 -0
  89. data/doc/WscSdk/Models/LiveStreamConnectionCode.html +192 -0
  90. data/doc/WscSdk/Models/LiveStreamState.html +200 -0
  91. data/doc/WscSdk/Models/LiveStreamStats.html +200 -0
  92. data/doc/WscSdk/Models/LiveStreamThumbnailUrl.html +200 -0
  93. data/doc/WscSdk/Models/Output.html +294 -0
  94. data/doc/WscSdk/Models/OutputStreamTarget.html +274 -0
  95. data/doc/WscSdk/Models/StreamTarget.html +273 -0
  96. data/doc/WscSdk/Models/Transcoder.html +793 -0
  97. data/doc/WscSdk/Models/TranscoderBooleanStat.html +278 -0
  98. data/doc/WscSdk/Models/TranscoderConnectionCode.html +192 -0
  99. data/doc/WscSdk/Models/TranscoderFloatStat.html +278 -0
  100. data/doc/WscSdk/Models/TranscoderIntegerStat.html +278 -0
  101. data/doc/WscSdk/Models/TranscoderState.html +196 -0
  102. data/doc/WscSdk/Models/TranscoderStats.html +196 -0
  103. data/doc/WscSdk/Models/TranscoderStreamTargetState.html +192 -0
  104. data/doc/WscSdk/Models/TranscoderStringStat.html +278 -0
  105. data/doc/WscSdk/Models/TranscoderThumbnailUrl.html +196 -0
  106. data/doc/WscSdk/Models/UllStreamTarget.html +360 -0
  107. data/doc/WscSdk/Models/WowzaStreamTarget.html +380 -0
  108. data/doc/WscSdk/Pagination.html +1277 -0
  109. data/doc/WscSdk/Schema.html +861 -0
  110. data/doc/WscSdk/SchemaAttribute.html +2400 -0
  111. data/doc/WscSdk/Templates.html +141 -0
  112. data/doc/WscSdk/Templates/CustomStreamTarget.html +1045 -0
  113. data/doc/WscSdk/Templates/LiveStream.html +1432 -0
  114. data/doc/WscSdk/Templates/Output.html +829 -0
  115. data/doc/WscSdk/Templates/Transcoder.html +699 -0
  116. data/doc/WscSdk/Templates/UllStreamTarget.html +411 -0
  117. data/doc/WscSdk/Templates/WowzaStreamTarget.html +447 -0
  118. data/doc/WscSdk/TranscoderSharedMethods.html +1113 -0
  119. data/doc/_index.html +705 -0
  120. data/doc/class_list.html +51 -0
  121. data/doc/css/bootstrap.css +5 -0
  122. data/doc/css/common.css +1 -0
  123. data/doc/css/custom.css +151 -0
  124. data/doc/css/full_list.css +58 -0
  125. data/doc/css/style.css +496 -0
  126. data/doc/file.README.html +570 -0
  127. data/doc/file_list.html +56 -0
  128. data/doc/frames.html +17 -0
  129. data/doc/images/wsc-ruby-1800x400.png +0 -0
  130. data/doc/index.html +570 -0
  131. data/doc/js/app.js +292 -0
  132. data/doc/js/full_list.js +216 -0
  133. data/doc/js/jquery.js +4 -0
  134. data/doc/method_list.html +1731 -0
  135. data/doc/top-level-namespace.html +182 -0
  136. data/examples/client.rb +40 -0
  137. data/examples/helpers.rb +100 -0
  138. data/examples/live_streams/create.rb +39 -0
  139. data/examples/live_streams/delete.rb +32 -0
  140. data/examples/live_streams/find.rb +22 -0
  141. data/examples/live_streams/flood.rb +126 -0
  142. data/examples/live_streams/list.rb +24 -0
  143. data/examples/live_streams/regenerate_connection_code.rb +29 -0
  144. data/examples/live_streams/reset.rb +32 -0
  145. data/examples/live_streams/reset_and_wait.rb +51 -0
  146. data/examples/live_streams/start.rb +33 -0
  147. data/examples/live_streams/start_and_wait.rb +51 -0
  148. data/examples/live_streams/state.rb +33 -0
  149. data/examples/live_streams/stats.rb +43 -0
  150. data/examples/live_streams/stop.rb +33 -0
  151. data/examples/live_streams/stop_and_wait.rb +51 -0
  152. data/examples/live_streams/thumbnail_url.rb +46 -0
  153. data/examples/live_streams/update.rb +43 -0
  154. data/examples/live_streams/workflow.rb +165 -0
  155. data/examples/output_stream_targets/create.rb +56 -0
  156. data/examples/output_stream_targets/delete.rb +45 -0
  157. data/examples/output_stream_targets/find.rb +37 -0
  158. data/examples/output_stream_targets/list.rb +36 -0
  159. data/examples/output_stream_targets/update.rb +56 -0
  160. data/examples/outputs/create.rb +49 -0
  161. data/examples/outputs/delete.rb +39 -0
  162. data/examples/outputs/find.rb +31 -0
  163. data/examples/outputs/list.rb +29 -0
  164. data/examples/outputs/update.rb +50 -0
  165. data/examples/stream_targets/custom/create.rb +42 -0
  166. data/examples/stream_targets/custom/delete.rb +31 -0
  167. data/examples/stream_targets/custom/find.rb +23 -0
  168. data/examples/stream_targets/custom/list.rb +24 -0
  169. data/examples/stream_targets/custom/update.rb +43 -0
  170. data/examples/stream_targets/list.rb +24 -0
  171. data/examples/stream_targets/ull/create.rb +41 -0
  172. data/examples/stream_targets/ull/delete.rb +31 -0
  173. data/examples/stream_targets/ull/find.rb +23 -0
  174. data/examples/stream_targets/ull/list.rb +24 -0
  175. data/examples/stream_targets/ull/update.rb +43 -0
  176. data/examples/stream_targets/wowza/create.rb +42 -0
  177. data/examples/stream_targets/wowza/delete.rb +31 -0
  178. data/examples/stream_targets/wowza/find.rb +23 -0
  179. data/examples/stream_targets/wowza/list.rb +23 -0
  180. data/examples/stream_targets/wowza/update.rb +43 -0
  181. data/examples/transcoders/create.rb +39 -0
  182. data/examples/transcoders/delete.rb +31 -0
  183. data/examples/transcoders/find.rb +23 -0
  184. data/examples/transcoders/list.rb +24 -0
  185. data/examples/transcoders/reset.rb +32 -0
  186. data/examples/transcoders/reset_and_wait.rb +48 -0
  187. data/examples/transcoders/start.rb +33 -0
  188. data/examples/transcoders/start_and_wait.rb +50 -0
  189. data/examples/transcoders/state.rb +33 -0
  190. data/examples/transcoders/stats.rb +43 -0
  191. data/examples/transcoders/stop.rb +33 -0
  192. data/examples/transcoders/stop_and_wait.rb +50 -0
  193. data/examples/transcoders/thumbnail_url.rb +46 -0
  194. data/examples/transcoders/update.rb +43 -0
  195. data/images/wsc-ruby-1800x400.png +0 -0
  196. data/lib/wsc_sdk.rb +81 -0
  197. data/lib/wsc_sdk/client.rb +417 -0
  198. data/lib/wsc_sdk/configuration.rb +21 -0
  199. data/lib/wsc_sdk/constants.rb +29 -0
  200. data/lib/wsc_sdk/endpoint.rb +492 -0
  201. data/lib/wsc_sdk/endpoints/custom_stream_targets.rb +44 -0
  202. data/lib/wsc_sdk/endpoints/live_streams.rb +34 -0
  203. data/lib/wsc_sdk/endpoints/output_stream_targets.rb +17 -0
  204. data/lib/wsc_sdk/endpoints/outputs.rb +17 -0
  205. data/lib/wsc_sdk/endpoints/stream_targets.rb +45 -0
  206. data/lib/wsc_sdk/endpoints/transcoders.rb +38 -0
  207. data/lib/wsc_sdk/endpoints/ull_stream_targets.rb +44 -0
  208. data/lib/wsc_sdk/endpoints/wowza_stream_targets.rb +44 -0
  209. data/lib/wsc_sdk/enums.rb +31 -0
  210. data/lib/wsc_sdk/enums/billing_mode.rb +20 -0
  211. data/lib/wsc_sdk/enums/broadcast_location.rb +58 -0
  212. data/lib/wsc_sdk/enums/buffer_size.rb +41 -0
  213. data/lib/wsc_sdk/enums/closed_caption_type.rb +26 -0
  214. data/lib/wsc_sdk/enums/custom_provider.rb +32 -0
  215. data/lib/wsc_sdk/enums/delivery_method.rb +20 -0
  216. data/lib/wsc_sdk/enums/delivery_type.rb +20 -0
  217. data/lib/wsc_sdk/enums/encoder.rb +71 -0
  218. data/lib/wsc_sdk/enums/idle_timeout.rb +50 -0
  219. data/lib/wsc_sdk/enums/image_position.rb +26 -0
  220. data/lib/wsc_sdk/enums/player_type.rb +20 -0
  221. data/lib/wsc_sdk/enums/protocol.rb +23 -0
  222. data/lib/wsc_sdk/enums/target_delivery_protocol.rb +20 -0
  223. data/lib/wsc_sdk/enums/transcoder_type.rb +20 -0
  224. data/lib/wsc_sdk/enums/wowza_provider.rb +20 -0
  225. data/lib/wsc_sdk/errors.rb +115 -0
  226. data/lib/wsc_sdk/model.rb +515 -0
  227. data/lib/wsc_sdk/model_list.rb +42 -0
  228. data/lib/wsc_sdk/model_template.rb +27 -0
  229. data/lib/wsc_sdk/models/custom_stream_target.rb +34 -0
  230. data/lib/wsc_sdk/models/error.rb +53 -0
  231. data/lib/wsc_sdk/models/live_stream.rb +130 -0
  232. data/lib/wsc_sdk/models/live_stream_connection_code.rb +31 -0
  233. data/lib/wsc_sdk/models/live_stream_state.rb +20 -0
  234. data/lib/wsc_sdk/models/live_stream_stats.rb +20 -0
  235. data/lib/wsc_sdk/models/live_stream_thumbnail_url.rb +20 -0
  236. data/lib/wsc_sdk/models/output.rb +61 -0
  237. data/lib/wsc_sdk/models/output_stream_target.rb +37 -0
  238. data/lib/wsc_sdk/models/stream_target.rb +29 -0
  239. data/lib/wsc_sdk/models/transcoder.rb +135 -0
  240. data/lib/wsc_sdk/models/transcoder_boolean_stat.rb +41 -0
  241. data/lib/wsc_sdk/models/transcoder_connection_code.rb +29 -0
  242. data/lib/wsc_sdk/models/transcoder_float_stat.rb +40 -0
  243. data/lib/wsc_sdk/models/transcoder_integer_stat.rb +40 -0
  244. data/lib/wsc_sdk/models/transcoder_state.rb +31 -0
  245. data/lib/wsc_sdk/models/transcoder_stats.rb +51 -0
  246. data/lib/wsc_sdk/models/transcoder_stream_target_state.rb +29 -0
  247. data/lib/wsc_sdk/models/transcoder_string_stat.rb +40 -0
  248. data/lib/wsc_sdk/models/transcoder_thumbnail_url.rb +29 -0
  249. data/lib/wsc_sdk/models/ull_stream_target.rb +54 -0
  250. data/lib/wsc_sdk/models/wowza_stream_target.rb +60 -0
  251. data/lib/wsc_sdk/modules/api_response.rb +24 -0
  252. data/lib/wsc_sdk/modules/loggable.rb +44 -0
  253. data/lib/wsc_sdk/modules/transcoder_shared_methods.rb +221 -0
  254. data/lib/wsc_sdk/pagination.rb +89 -0
  255. data/lib/wsc_sdk/schema.rb +140 -0
  256. data/lib/wsc_sdk/schema_attribute.rb +349 -0
  257. data/lib/wsc_sdk/templates/custom_stream_target.rb +154 -0
  258. data/lib/wsc_sdk/templates/live_stream.rb +234 -0
  259. data/lib/wsc_sdk/templates/output.rb +133 -0
  260. data/lib/wsc_sdk/templates/transcoder.rb +97 -0
  261. data/lib/wsc_sdk/templates/ull_stream_target.rb +49 -0
  262. data/lib/wsc_sdk/templates/wowza_stream_target.rb +57 -0
  263. data/lib/wsc_sdk/version.rb +7 -0
  264. data/wsc_sdk.gemspec +48 -0
  265. metadata +460 -0
@@ -0,0 +1,2400 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Wowza Streaming Cloud - SDK Code Documentation</title>
7
+
8
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
9
+
10
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
11
+
12
+ <link rel="stylesheet" href="../css/custom.css" type="text/css" charset="utf-8" />
13
+
14
+ <script type="text/javascript" charset="utf-8">
15
+ pathId = "WscSdk::SchemaAttribute";
16
+ relpath = '../';
17
+ </script>
18
+
19
+
20
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
23
+
24
+
25
+ </head>
26
+ <body>
27
+ <div id="wowza-wrapper">
28
+ <header>
29
+ <div class="logo">
30
+ <a href="https://www.wowza.com">
31
+ <img src="https://cloud.wowza.com/apidocs/assets/logo.png" alt="Wowza Logo" />
32
+ </a>
33
+ <h1>Wowza Streaming Cloud<br/>SDK Code Documentation</h1>
34
+ <div class="clearfix"></div>
35
+ </div>
36
+ <div class="links">
37
+ <a href="https://www.wowza.com/">Wowza Home</a>
38
+ <a href="https://www.wowza.com/docs">Docs & APIS</a>
39
+ <a href="https://www.wowza.com/community/index.html">Forums</a>
40
+ <a href="https://www.wowza.com/support">Support</a>
41
+ </div>
42
+ <div class="clearfix"></div>
43
+ </header>
44
+
45
+ <div id="content">
46
+ <div class="nav_wrap">
47
+ <iframe id="nav" src="../class_list.html?1"></iframe>
48
+ <div id="resizer"></div>
49
+ </div>
50
+
51
+ <div id="main" tabindex="-1">
52
+ <div id="header">
53
+ <div id="menu">
54
+
55
+ <a href="../_index.html">Index (S)</a> &raquo;
56
+ <span class='title'><span class='object_link'><a href="../WscSdk.html" title="WscSdk (module)">WscSdk</a></span></span>
57
+ &raquo;
58
+ <span class="title">SchemaAttribute</span>
59
+
60
+ </div>
61
+
62
+ <div id="search">
63
+
64
+ <a class="full_list_link" id="class_list_link"
65
+ href="../class_list.html">
66
+
67
+ <svg width="24" height="24">
68
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
69
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
70
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
71
+ </svg>
72
+ </a>
73
+
74
+ </div>
75
+ <div class="clear"></div>
76
+ </div>
77
+
78
+ <div id="content"><h1>Class: WscSdk::SchemaAttribute
79
+
80
+
81
+
82
+ </h1>
83
+ <div class="box_info">
84
+
85
+ <dl>
86
+ <dt>Inherits:</dt>
87
+ <dd>
88
+ <span class="inheritName">Object</span>
89
+
90
+ <ul class="fullTree">
91
+ <li>Object</li>
92
+
93
+ <li class="next">WscSdk::SchemaAttribute</li>
94
+
95
+ </ul>
96
+ <a href="#" class="inheritanceTree">show all</a>
97
+
98
+ </dd>
99
+ </dl>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <dl>
112
+ <dt>Defined in:</dt>
113
+ <dd>lib/wsc_sdk/schema_attribute.rb</dd>
114
+ </dl>
115
+
116
+ </div>
117
+
118
+ <h2>Overview</h2><div class="docstring">
119
+ <div class="discussion">
120
+
121
+ <p>A class to represent an attribute inside of a model&#39;s data schema.</p>
122
+
123
+
124
+ </div>
125
+ </div>
126
+ <div class="tags">
127
+
128
+
129
+ </div>
130
+
131
+ <h2>
132
+ Constant Summary
133
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
134
+ </h2>
135
+
136
+ <dl class="constants">
137
+
138
+ <dt id="TYPES-constant" class="">TYPES =
139
+ <div class="docstring">
140
+ <div class="discussion">
141
+
142
+ <p>A list of valid types for a schema attribute</p>
143
+
144
+
145
+ </div>
146
+ </div>
147
+ <div class="tags">
148
+
149
+
150
+ </div>
151
+ </dt>
152
+ <dd><pre class="code">[
153
+ <span style="color:#A60">:string</span>,
154
+ <span style="color:#A60">:integer</span>,
155
+ <span style="color:#A60">:float</span>,
156
+ <span style="color:#A60">:boolean</span>,
157
+ <span style="color:#A60">:array</span>,
158
+ <span style="color:#A60">:hash</span>,
159
+ <span style="color:#A60">:datetime</span>
160
+ ]</pre></dd>
161
+
162
+ </dl>
163
+
164
+
165
+
166
+
167
+
168
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
169
+ <ul class="summary">
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#access-instance_method" title="#access (instance method)">#<strong>access</strong> &#x21d2; Object </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+ <span class="note title readonly">readonly</span>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Returns the value of attribute access.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#as-instance_method" title="#as (instance method)">#<strong>as</strong> &#x21d2; Object </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+ <span class="note title readonly">readonly</span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'>
223
+ <p>Returns the value of attribute as.</p>
224
+ </div></span>
225
+
226
+ </li>
227
+
228
+
229
+ <li class="public ">
230
+ <span class="summary_signature">
231
+
232
+ <a href="#default-instance_method" title="#default (instance method)">#<strong>default</strong> &#x21d2; Object </a>
233
+
234
+
235
+
236
+ </span>
237
+
238
+
239
+
240
+
241
+ <span class="note title readonly">readonly</span>
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+ <span class="summary_desc"><div class='inline'>
252
+ <p>Returns the value of attribute default.</p>
253
+ </div></span>
254
+
255
+ </li>
256
+
257
+
258
+ <li class="public ">
259
+ <span class="summary_signature">
260
+
261
+ <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> &#x21d2; Object </a>
262
+
263
+
264
+
265
+ </span>
266
+
267
+
268
+
269
+
270
+ <span class="note title readonly">readonly</span>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+ <span class="summary_desc"><div class='inline'>
281
+ <p>Returns the value of attribute name.</p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#required-instance_method" title="#required (instance method)">#<strong>required</strong> &#x21d2; Object </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+ <span class="note title readonly">readonly</span>
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+ <span class="summary_desc"><div class='inline'>
310
+ <p>Returns the value of attribute required.</p>
311
+ </div></span>
312
+
313
+ </li>
314
+
315
+
316
+ <li class="public ">
317
+ <span class="summary_signature">
318
+
319
+ <a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> &#x21d2; Object </a>
320
+
321
+
322
+
323
+ </span>
324
+
325
+
326
+
327
+
328
+ <span class="note title readonly">readonly</span>
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+ <span class="summary_desc"><div class='inline'>
339
+ <p>Returns the value of attribute type.</p>
340
+ </div></span>
341
+
342
+ </li>
343
+
344
+
345
+ <li class="public ">
346
+ <span class="summary_signature">
347
+
348
+ <a href="#validate-instance_method" title="#validate (instance method)">#<strong>validate</strong> &#x21d2; Object </a>
349
+
350
+
351
+
352
+ </span>
353
+
354
+
355
+
356
+
357
+ <span class="note title readonly">readonly</span>
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+ <span class="summary_desc"><div class='inline'>
368
+ <p>Returns the value of attribute validate.</p>
369
+ </div></span>
370
+
371
+ </li>
372
+
373
+
374
+ </ul>
375
+
376
+
377
+
378
+
379
+
380
+ <h2>
381
+ Instance Method Summary
382
+ <small><a href="#" class="summary_toggle">collapse</a></small>
383
+ </h2>
384
+
385
+ <ul class="summary">
386
+
387
+ <li class="public ">
388
+ <span class="summary_signature">
389
+
390
+ <a href="#attribute_name-instance_method" title="#attribute_name (instance method)">#<strong>attribute_name</strong> &#x21d2; Symbol </a>
391
+
392
+
393
+
394
+ </span>
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+ <span class="summary_desc"><div class='inline'>
405
+ <p>Returns the expected attribute name for the attribute.</p>
406
+ </div></span>
407
+
408
+ </li>
409
+
410
+
411
+ <li class="public ">
412
+ <span class="summary_signature">
413
+
414
+ <a href="#call_proc_or_symbol-instance_method" title="#call_proc_or_symbol (instance method)">#<strong>call_proc_or_symbol</strong>(proc_or_symbol, model) &#x21d2; Any </a>
415
+
416
+
417
+
418
+ </span>
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+ <span class="summary_desc"><div class='inline'>
429
+ <p>Call a Proc or Symbol against a model.</p>
430
+ </div></span>
431
+
432
+ </li>
433
+
434
+
435
+ <li class="public ">
436
+ <span class="summary_signature">
437
+
438
+ <a href="#default_value-instance_method" title="#default_value (instance method)">#<strong>default_value</strong>(model) &#x21d2; Object </a>
439
+
440
+
441
+
442
+ </span>
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+ <span class="summary_desc"><div class='inline'>
453
+ <p>Returns the default value for the attribute.</p>
454
+ </div></span>
455
+
456
+ </li>
457
+
458
+
459
+ <li class="public ">
460
+ <span class="summary_signature">
461
+
462
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, type, options = {}) &#x21d2; SchemaAttribute </a>
463
+
464
+
465
+
466
+ </span>
467
+
468
+
469
+ <span class="note title constructor">constructor</span>
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+ <span class="summary_desc"><div class='inline'>
479
+ <p>Create a new schema attribute.</p>
480
+ </div></span>
481
+
482
+ </li>
483
+
484
+
485
+ <li class="public ">
486
+ <span class="summary_signature">
487
+
488
+ <a href="#read_access%3F-instance_method" title="#read_access? (instance method)">#<strong>read_access?</strong>(model) &#x21d2; Boolean </a>
489
+
490
+
491
+
492
+ </span>
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+ <span class="summary_desc"><div class='inline'>
503
+ <p>Determine if the attribute is readable according to the attribute
504
+ configuration.</p>
505
+ </div></span>
506
+
507
+ </li>
508
+
509
+
510
+ <li class="public ">
511
+ <span class="summary_signature">
512
+
513
+ <a href="#required%3F-instance_method" title="#required? (instance method)">#<strong>required?</strong>(model) &#x21d2; Boolean </a>
514
+
515
+
516
+
517
+ </span>
518
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+ <span class="summary_desc"><div class='inline'>
528
+ <p>Determine if the attribute is required.</p>
529
+ </div></span>
530
+
531
+ </li>
532
+
533
+
534
+ <li class="public ">
535
+ <span class="summary_signature">
536
+
537
+ <a href="#transform_value-instance_method" title="#transform_value (instance method)">#<strong>transform_value</strong>(model, value) &#x21d2; Any </a>
538
+
539
+
540
+
541
+ </span>
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+ <span class="summary_desc"><div class='inline'>
552
+ <p>Converts an inbound value to the appropriate type.</p>
553
+ </div></span>
554
+
555
+ </li>
556
+
557
+
558
+ <li class="public ">
559
+ <span class="summary_signature">
560
+
561
+ <a href="#type_to_class-instance_method" title="#type_to_class (instance method)">#<strong>type_to_class</strong>(attribute_type) &#x21d2; Any </a>
562
+
563
+
564
+
565
+ </span>
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+ <span class="summary_desc"><div class='inline'>
576
+ <p>Converts the specified type to a class.</p>
577
+ </div></span>
578
+
579
+ </li>
580
+
581
+
582
+ <li class="public ">
583
+ <span class="summary_signature">
584
+
585
+ <a href="#valid%3F-instance_method" title="#valid? (instance method)">#<strong>valid?</strong>(model) &#x21d2; String </a>
586
+
587
+
588
+
589
+ </span>
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+ <span class="summary_desc"><div class='inline'>
600
+ <p>Determine if a value is valid according to the attribute configuration.</p>
601
+ </div></span>
602
+
603
+ </li>
604
+
605
+
606
+ <li class="public ">
607
+ <span class="summary_signature">
608
+
609
+ <a href="#valid_model_type%3F-instance_method" title="#valid_model_type? (instance method)">#<strong>valid_model_type?</strong>(attribute_type) &#x21d2; Boolean </a>
610
+
611
+
612
+
613
+ </span>
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+ <span class="summary_desc"><div class='inline'>
624
+ <p>Determines if the specified type of the attribute matches a model.</p>
625
+ </div></span>
626
+
627
+ </li>
628
+
629
+
630
+ <li class="public ">
631
+ <span class="summary_signature">
632
+
633
+ <a href="#valid_type%3F-instance_method" title="#valid_type? (instance method)">#<strong>valid_type?</strong>(value) &#x21d2; Boolean </a>
634
+
635
+
636
+
637
+ </span>
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+ <span class="summary_desc"><div class='inline'>
648
+ <p>Determine if the provided value is of a valid type for the attribute.</p>
649
+ </div></span>
650
+
651
+ </li>
652
+
653
+
654
+ <li class="public ">
655
+ <span class="summary_signature">
656
+
657
+ <a href="#value_or_default-instance_method" title="#value_or_default (instance method)">#<strong>value_or_default</strong>(model) &#x21d2; Object </a>
658
+
659
+
660
+
661
+ </span>
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+ <span class="summary_desc"><div class='inline'>
672
+ <p>Return either the value from the model that is represented by the
673
+ attribute, or the default value if the value is not assigned.</p>
674
+ </div></span>
675
+
676
+ </li>
677
+
678
+
679
+ <li class="public ">
680
+ <span class="summary_signature">
681
+
682
+ <a href="#write_access%3F-instance_method" title="#write_access? (instance method)">#<strong>write_access?</strong>(model) &#x21d2; Boolean </a>
683
+
684
+
685
+
686
+ </span>
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+ <span class="summary_desc"><div class='inline'>
697
+ <p>Determine if the attribute is writable according to the attribute
698
+ configuration.</p>
699
+ </div></span>
700
+
701
+ </li>
702
+
703
+
704
+ </ul>
705
+
706
+
707
+ <div id="constructor_details" class="method_details_list">
708
+ <h2>Constructor Details</h2>
709
+
710
+ <div class="method_details first">
711
+ <h3 class="signature first" id="initialize-instance_method">
712
+
713
+ #<strong>initialize</strong>(name, type, options = {}) &#x21d2; <tt><span class='object_link'><a href="" title="WscSdk::SchemaAttribute (class)">SchemaAttribute</a></span></tt>
714
+
715
+
716
+
717
+
718
+
719
+ </h3><div class="docstring">
720
+ <div class="discussion">
721
+
722
+ <p>Create a new schema attribute.</p>
723
+
724
+
725
+ </div>
726
+ </div>
727
+ <div class="tags">
728
+ <p class="tag_title">Parameters:</p>
729
+ <ul class="param">
730
+
731
+ <li>
732
+
733
+ <span class='name'>name</span>
734
+
735
+
736
+ <span class='type'>(<tt>Symbol</tt>)</span>
737
+
738
+
739
+
740
+ &mdash;
741
+ <div class='inline'>
742
+ <p>The name of the attribute.</p>
743
+ </div>
744
+
745
+ </li>
746
+
747
+ <li>
748
+
749
+ <span class='name'>type</span>
750
+
751
+
752
+ <span class='type'>(<tt>Symbol</tt>)</span>
753
+
754
+
755
+
756
+ &mdash;
757
+ <div class='inline'>
758
+ <p>The type of the attribute. The type must be in the list of
759
+ WscSdk::SchemaAttribute::TYPES</p>
760
+ </div>
761
+
762
+ </li>
763
+
764
+ <li>
765
+
766
+ <span class='name'>options</span>
767
+
768
+
769
+ <span class='type'>(<tt>Hash</tt>)</span>
770
+
771
+
772
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
773
+
774
+
775
+ &mdash;
776
+ <div class='inline'>
777
+ <p>A hash of options</p>
778
+ </div>
779
+
780
+ </li>
781
+
782
+ </ul>
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
792
+ <ul class="option">
793
+
794
+ <li>
795
+ <span class="name">:default</span>
796
+ <span class="type">(<tt>Any</tt>, <tt>Proc</tt>, <tt>Symbol</tt>)</span>
797
+ <span class="default">
798
+
799
+ </span>
800
+
801
+ &mdash; <div class='inline'>
802
+ <p>The default value of the attribute. This value must match the assigned
803
+ type of the attribute. The default value can be determined by a direct
804
+ value, a Proc or a Symbol that represents a method in the model.</p>
805
+
806
+ <p>If a <strong>Proc</strong> is provided it will be passed an instance of the
807
+ model, which can be used to determine the default value for the attribute.
808
+ The Proc should return a value that is the same type as the attribute.</p>
809
+
810
+ <p>If a <strong>Symbol</strong> is provided, the Symbol will be checked
811
+ against the model to determine if there is a method available that has the
812
+ same name. If one exists, that method will be passed an instance of the
813
+ model, which can be used to determine the default value for the attribute.
814
+ The method should return a value that is the same type as the attribute. If
815
+ no method is found that matches the symbol, the symbol itself is used as
816
+ the default.</p>
817
+ </div>
818
+
819
+ </li>
820
+
821
+ <li>
822
+ <span class="name">:required</span>
823
+ <span class="type">(<tt>Array</tt>, <tt>Proc</tt>, <tt>Symbol</tt>)</span>
824
+ <span class="default">
825
+
826
+ </span>
827
+
828
+ &mdash; <div class='inline'>
829
+ <p>Determines if the attribute is required.</p>
830
+
831
+ <p>If a <strong>Proc</strong> is provided it will be passed an instance of the
832
+ model, which can be used to determine if the value is required. The Proc
833
+ should return a boolean value.</p>
834
+
835
+ <p>If a <strong>Symbol</strong> is provided, the Symbol will be checked
836
+ against the model to determine if there is a method available that has the
837
+ same name. If one exists, that method will be called. The method should
838
+ return a boolean value.</p>
839
+ </div>
840
+
841
+ </li>
842
+
843
+ <li>
844
+ <span class="name">:validate</span>
845
+ <span class="type">(<tt>Array</tt>, <tt>Proc</tt>, <tt>Symbol</tt>)</span>
846
+ <span class="default">
847
+
848
+ </span>
849
+
850
+ &mdash; <div class='inline'>
851
+ <p>Determines if the attribute is valid.</p>
852
+
853
+ <p>If a <strong>Proc</strong> is provided it will be passed an instance of the
854
+ model, which can be used to determine if the value is valid. The Proc
855
+ should return a string describing why the attribute is not valid, otherwise
856
+ it should return nil.</p>
857
+
858
+ <p>If a <strong>Symbol</strong> is provided, the Symbol will be checked
859
+ against the model to determine if there is a method available that has the
860
+ same name. If one exists, that method will be passed an instance of the
861
+ model, which can be used to determine if the value is valid. The Proc
862
+ should return a string describing why the attribute is not valid, otherwise
863
+ it should return nil.</p>
864
+ </div>
865
+
866
+ </li>
867
+
868
+ </ul>
869
+
870
+
871
+ <p class="tag_title">Raises:</p>
872
+ <ul class="raise">
873
+
874
+ <li>
875
+
876
+
877
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
878
+
879
+
880
+
881
+ &mdash;
882
+ <div class='inline'>
883
+ <p>If the type is not in the WscSdk::SchemaAttribute::TYPES list.</p>
884
+ </div>
885
+
886
+ </li>
887
+
888
+ </ul>
889
+
890
+ </div><table class="source_code">
891
+ <tr>
892
+ <td>
893
+ <pre class="lines">
894
+
895
+
896
+ 82
897
+ 83
898
+ 84
899
+ 85
900
+ 86
901
+ 87
902
+ 88
903
+ 89
904
+ 90
905
+ 91</pre>
906
+ </td>
907
+ <td>
908
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 82</span>
909
+
910
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">initialize</span>(name, type, options={})
911
+ raise <span style="color:#036;font-weight:bold">ArgumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">Invalid schema attribute type specified: </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>type<span style="font-weight:bold;color:#666">}</span></span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> valid_type?(type)
912
+ <span style="color:#33B">@name</span> = name.to_sym
913
+ <span style="color:#33B">@type</span> = type
914
+ <span style="color:#33B">@access</span> = options.fetch(<span style="color:#A60">:access</span>, <span style="color:#A60">:read_write</span>)
915
+ <span style="color:#33B">@default</span> = options.fetch(<span style="color:#A60">:default</span>, <span style="color:#069">nil</span>)
916
+ <span style="color:#33B">@required</span> = options.fetch(<span style="color:#A60">:required</span>, <span style="color:#069">false</span>)
917
+ <span style="color:#33B">@validate</span> = options.fetch(<span style="color:#A60">:validate</span>, <span style="color:#069">nil</span>)
918
+ <span style="color:#33B">@as</span> = options.fetch(<span style="color:#A60">:as</span>, <span style="color:#069">nil</span>)
919
+ <span style="color:#080;font-weight:bold">end</span></pre>
920
+ </td>
921
+ </tr>
922
+ </table>
923
+ </div>
924
+
925
+ </div>
926
+
927
+ <div id="instance_attr_details" class="attr_details">
928
+ <h2>Instance Attribute Details</h2>
929
+
930
+
931
+ <span id=""></span>
932
+ <div class="method_details first">
933
+ <h3 class="signature first" id="access-instance_method">
934
+
935
+ #<strong>access</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
936
+
937
+
938
+
939
+
940
+
941
+ </h3><div class="docstring">
942
+ <div class="discussion">
943
+
944
+ <p>Returns the value of attribute access</p>
945
+
946
+
947
+ </div>
948
+ </div>
949
+ <div class="tags">
950
+
951
+
952
+ </div><table class="source_code">
953
+ <tr>
954
+ <td>
955
+ <pre class="lines">
956
+
957
+
958
+ 21
959
+ 22
960
+ 23</pre>
961
+ </td>
962
+ <td>
963
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
964
+
965
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">access</span>
966
+ <span style="color:#33B">@access</span>
967
+ <span style="color:#080;font-weight:bold">end</span></pre>
968
+ </td>
969
+ </tr>
970
+ </table>
971
+ </div>
972
+
973
+
974
+ <span id=""></span>
975
+ <div class="method_details ">
976
+ <h3 class="signature " id="as-instance_method">
977
+
978
+ #<strong>as</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
979
+
980
+
981
+
982
+
983
+
984
+ </h3><div class="docstring">
985
+ <div class="discussion">
986
+
987
+ <p>Returns the value of attribute as</p>
988
+
989
+
990
+ </div>
991
+ </div>
992
+ <div class="tags">
993
+
994
+
995
+ </div><table class="source_code">
996
+ <tr>
997
+ <td>
998
+ <pre class="lines">
999
+
1000
+
1001
+ 21
1002
+ 22
1003
+ 23</pre>
1004
+ </td>
1005
+ <td>
1006
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1007
+
1008
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">as</span>
1009
+ <span style="color:#33B">@as</span>
1010
+ <span style="color:#080;font-weight:bold">end</span></pre>
1011
+ </td>
1012
+ </tr>
1013
+ </table>
1014
+ </div>
1015
+
1016
+
1017
+ <span id=""></span>
1018
+ <div class="method_details ">
1019
+ <h3 class="signature " id="default-instance_method">
1020
+
1021
+ #<strong>default</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+ </h3><div class="docstring">
1028
+ <div class="discussion">
1029
+
1030
+ <p>Returns the value of attribute default</p>
1031
+
1032
+
1033
+ </div>
1034
+ </div>
1035
+ <div class="tags">
1036
+
1037
+
1038
+ </div><table class="source_code">
1039
+ <tr>
1040
+ <td>
1041
+ <pre class="lines">
1042
+
1043
+
1044
+ 21
1045
+ 22
1046
+ 23</pre>
1047
+ </td>
1048
+ <td>
1049
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1050
+
1051
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">default</span>
1052
+ <span style="color:#33B">@default</span>
1053
+ <span style="color:#080;font-weight:bold">end</span></pre>
1054
+ </td>
1055
+ </tr>
1056
+ </table>
1057
+ </div>
1058
+
1059
+
1060
+ <span id=""></span>
1061
+ <div class="method_details ">
1062
+ <h3 class="signature " id="name-instance_method">
1063
+
1064
+ #<strong>name</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
1065
+
1066
+
1067
+
1068
+
1069
+
1070
+ </h3><div class="docstring">
1071
+ <div class="discussion">
1072
+
1073
+ <p>Returns the value of attribute name</p>
1074
+
1075
+
1076
+ </div>
1077
+ </div>
1078
+ <div class="tags">
1079
+
1080
+
1081
+ </div><table class="source_code">
1082
+ <tr>
1083
+ <td>
1084
+ <pre class="lines">
1085
+
1086
+
1087
+ 21
1088
+ 22
1089
+ 23</pre>
1090
+ </td>
1091
+ <td>
1092
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1093
+
1094
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">name</span>
1095
+ <span style="color:#33B">@name</span>
1096
+ <span style="color:#080;font-weight:bold">end</span></pre>
1097
+ </td>
1098
+ </tr>
1099
+ </table>
1100
+ </div>
1101
+
1102
+
1103
+ <span id=""></span>
1104
+ <div class="method_details ">
1105
+ <h3 class="signature " id="required-instance_method">
1106
+
1107
+ #<strong>required</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+ </h3><div class="docstring">
1114
+ <div class="discussion">
1115
+
1116
+ <p>Returns the value of attribute required</p>
1117
+
1118
+
1119
+ </div>
1120
+ </div>
1121
+ <div class="tags">
1122
+
1123
+
1124
+ </div><table class="source_code">
1125
+ <tr>
1126
+ <td>
1127
+ <pre class="lines">
1128
+
1129
+
1130
+ 21
1131
+ 22
1132
+ 23</pre>
1133
+ </td>
1134
+ <td>
1135
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1136
+
1137
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">required</span>
1138
+ <span style="color:#33B">@required</span>
1139
+ <span style="color:#080;font-weight:bold">end</span></pre>
1140
+ </td>
1141
+ </tr>
1142
+ </table>
1143
+ </div>
1144
+
1145
+
1146
+ <span id=""></span>
1147
+ <div class="method_details ">
1148
+ <h3 class="signature " id="type-instance_method">
1149
+
1150
+ #<strong>type</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+ </h3><div class="docstring">
1157
+ <div class="discussion">
1158
+
1159
+ <p>Returns the value of attribute type</p>
1160
+
1161
+
1162
+ </div>
1163
+ </div>
1164
+ <div class="tags">
1165
+
1166
+
1167
+ </div><table class="source_code">
1168
+ <tr>
1169
+ <td>
1170
+ <pre class="lines">
1171
+
1172
+
1173
+ 21
1174
+ 22
1175
+ 23</pre>
1176
+ </td>
1177
+ <td>
1178
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1179
+
1180
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">type</span>
1181
+ <span style="color:#33B">@type</span>
1182
+ <span style="color:#080;font-weight:bold">end</span></pre>
1183
+ </td>
1184
+ </tr>
1185
+ </table>
1186
+ </div>
1187
+
1188
+
1189
+ <span id=""></span>
1190
+ <div class="method_details ">
1191
+ <h3 class="signature " id="validate-instance_method">
1192
+
1193
+ #<strong>validate</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+ </h3><div class="docstring">
1200
+ <div class="discussion">
1201
+
1202
+ <p>Returns the value of attribute validate</p>
1203
+
1204
+
1205
+ </div>
1206
+ </div>
1207
+ <div class="tags">
1208
+
1209
+
1210
+ </div><table class="source_code">
1211
+ <tr>
1212
+ <td>
1213
+ <pre class="lines">
1214
+
1215
+
1216
+ 21
1217
+ 22
1218
+ 23</pre>
1219
+ </td>
1220
+ <td>
1221
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 21</span>
1222
+
1223
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">validate</span>
1224
+ <span style="color:#33B">@validate</span>
1225
+ <span style="color:#080;font-weight:bold">end</span></pre>
1226
+ </td>
1227
+ </tr>
1228
+ </table>
1229
+ </div>
1230
+
1231
+ </div>
1232
+
1233
+
1234
+ <div id="instance_method_details" class="method_details_list">
1235
+ <h2>Instance Method Details</h2>
1236
+
1237
+
1238
+ <div class="method_details first">
1239
+ <h3 class="signature first" id="attribute_name-instance_method">
1240
+
1241
+ #<strong>attribute_name</strong> &#x21d2; <tt>Symbol</tt>
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+ </h3><div class="docstring">
1248
+ <div class="discussion">
1249
+
1250
+ <p>Returns the expected attribute name for the attribute. If the `as` value
1251
+ is returned, this is returned, otherwise the attributes `name` value is
1252
+ returned.</p>
1253
+
1254
+
1255
+ </div>
1256
+ </div>
1257
+ <div class="tags">
1258
+
1259
+ <p class="tag_title">Returns:</p>
1260
+ <ul class="return">
1261
+
1262
+ <li>
1263
+
1264
+
1265
+ <span class='type'>(<tt>Symbol</tt>)</span>
1266
+
1267
+
1268
+
1269
+ &mdash;
1270
+ <div class='inline'>
1271
+ <p>The `as` or `name` value for the attribute</p>
1272
+ </div>
1273
+
1274
+ </li>
1275
+
1276
+ </ul>
1277
+
1278
+ </div><table class="source_code">
1279
+ <tr>
1280
+ <td>
1281
+ <pre class="lines">
1282
+
1283
+
1284
+ 100
1285
+ 101
1286
+ 102</pre>
1287
+ </td>
1288
+ <td>
1289
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 100</span>
1290
+
1291
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">attribute_name</span>
1292
+ (<span style="color:#069">self</span>.as || <span style="color:#069">self</span>.name).to_sym
1293
+ <span style="color:#080;font-weight:bold">end</span></pre>
1294
+ </td>
1295
+ </tr>
1296
+ </table>
1297
+ </div>
1298
+
1299
+ <div class="method_details ">
1300
+ <h3 class="signature " id="call_proc_or_symbol-instance_method">
1301
+
1302
+ #<strong>call_proc_or_symbol</strong>(proc_or_symbol, model) &#x21d2; <tt>Any</tt>
1303
+
1304
+
1305
+
1306
+
1307
+
1308
+ </h3><div class="docstring">
1309
+ <div class="discussion">
1310
+
1311
+ <p>Call a Proc or Symbol against a model.</p>
1312
+
1313
+
1314
+ </div>
1315
+ </div>
1316
+ <div class="tags">
1317
+ <p class="tag_title">Parameters:</p>
1318
+ <ul class="param">
1319
+
1320
+ <li>
1321
+
1322
+ <span class='name'>proc_or_symbol</span>
1323
+
1324
+
1325
+ <span class='type'>(<tt>Proc</tt>, <tt>Symbol</tt>)</span>
1326
+
1327
+
1328
+
1329
+ &mdash;
1330
+ <div class='inline'>
1331
+ <p>The Proc or Symbol to attempt to make a call against. If the value
1332
+ provided is Nil, or not a Proc or Symbol, then it is returned directly.</p>
1333
+ </div>
1334
+
1335
+ </li>
1336
+
1337
+ <li>
1338
+
1339
+ <span class='name'>model</span>
1340
+
1341
+
1342
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1343
+
1344
+
1345
+
1346
+ &mdash;
1347
+ <div class='inline'>
1348
+ <p>The model to pass into the Proc or Symbol method if appropriate.</p>
1349
+ </div>
1350
+
1351
+ </li>
1352
+
1353
+ </ul>
1354
+
1355
+ <p class="tag_title">Returns:</p>
1356
+ <ul class="return">
1357
+
1358
+ <li>
1359
+
1360
+
1361
+ <span class='type'>(<tt>Any</tt>)</span>
1362
+
1363
+
1364
+
1365
+ &mdash;
1366
+ <div class='inline'>
1367
+ <p>The results of calling the Proc or Symbol or the value of proc_or_symbol if
1368
+ it isn&#39;t a Proc or Symbol.</p>
1369
+ </div>
1370
+
1371
+ </li>
1372
+
1373
+ </ul>
1374
+ <p class="tag_title">Raises:</p>
1375
+ <ul class="raise">
1376
+
1377
+ <li>
1378
+
1379
+
1380
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1381
+
1382
+
1383
+
1384
+ &mdash;
1385
+ <div class='inline'>
1386
+ <p>If the provided model does not have this attribute configured.</p>
1387
+ </div>
1388
+
1389
+ </li>
1390
+
1391
+ </ul>
1392
+
1393
+ </div><table class="source_code">
1394
+ <tr>
1395
+ <td>
1396
+ <pre class="lines">
1397
+
1398
+
1399
+ 308
1400
+ 309
1401
+ 310
1402
+ 311
1403
+ 312
1404
+ 313</pre>
1405
+ </td>
1406
+ <td>
1407
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 308</span>
1408
+
1409
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">call_proc_or_symbol</span>(proc_or_symbol, model)
1410
+ <span style="color:#080;font-weight:bold">return</span> proc_or_symbol <span style="color:#080;font-weight:bold">if</span> proc_or_symbol.nil?
1411
+ <span style="color:#080;font-weight:bold">return</span> proc_or_symbol.call(model) <span style="color:#080;font-weight:bold">if</span> proc_or_symbol.is_a?(<span style="color:#036;font-weight:bold">Proc</span>)
1412
+ <span style="color:#080;font-weight:bold">return</span> model.send(proc_or_symbol) <span style="color:#080;font-weight:bold">if</span> proc_or_symbol.is_a?(<span style="color:#036;font-weight:bold">Symbol</span>) <span style="color:#080;font-weight:bold">and</span> model.respond_to?(proc_or_symbol)
1413
+ <span style="color:#080;font-weight:bold">return</span> proc_or_symbol
1414
+ <span style="color:#080;font-weight:bold">end</span></pre>
1415
+ </td>
1416
+ </tr>
1417
+ </table>
1418
+ </div>
1419
+
1420
+ <div class="method_details ">
1421
+ <h3 class="signature " id="default_value-instance_method">
1422
+
1423
+ #<strong>default_value</strong>(model) &#x21d2; <tt>Object</tt>
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+ </h3><div class="docstring">
1430
+ <div class="discussion">
1431
+
1432
+ <p>Returns the default value for the attribute</p>
1433
+
1434
+
1435
+ </div>
1436
+ </div>
1437
+ <div class="tags">
1438
+ <p class="tag_title">Parameters:</p>
1439
+ <ul class="param">
1440
+
1441
+ <li>
1442
+
1443
+ <span class='name'>model</span>
1444
+
1445
+
1446
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1447
+
1448
+
1449
+
1450
+ &mdash;
1451
+ <div class='inline'>
1452
+ <p>The model the value comes from.</p>
1453
+ </div>
1454
+
1455
+ </li>
1456
+
1457
+ </ul>
1458
+
1459
+
1460
+ </div><table class="source_code">
1461
+ <tr>
1462
+ <td>
1463
+ <pre class="lines">
1464
+
1465
+
1466
+ 258
1467
+ 259
1468
+ 260</pre>
1469
+ </td>
1470
+ <td>
1471
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 258</span>
1472
+
1473
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">default_value</span>(model)
1474
+ call_proc_or_symbol(default, model)
1475
+ <span style="color:#080;font-weight:bold">end</span></pre>
1476
+ </td>
1477
+ </tr>
1478
+ </table>
1479
+ </div>
1480
+
1481
+ <div class="method_details ">
1482
+ <h3 class="signature " id="read_access?-instance_method">
1483
+
1484
+ #<strong>read_access?</strong>(model) &#x21d2; <tt>Boolean</tt>
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+ </h3><div class="docstring">
1491
+ <div class="discussion">
1492
+
1493
+ <p>Determine if the attribute is readable according to the attribute
1494
+ configuration.</p>
1495
+
1496
+
1497
+ </div>
1498
+ </div>
1499
+ <div class="tags">
1500
+ <p class="tag_title">Parameters:</p>
1501
+ <ul class="param">
1502
+
1503
+ <li>
1504
+
1505
+ <span class='name'>model</span>
1506
+
1507
+
1508
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1509
+
1510
+
1511
+
1512
+ &mdash;
1513
+ <div class='inline'>
1514
+ <p>The model that will determine the access level of the attribute.</p>
1515
+ </div>
1516
+
1517
+ </li>
1518
+
1519
+ </ul>
1520
+
1521
+ <p class="tag_title">Returns:</p>
1522
+ <ul class="return">
1523
+
1524
+ <li>
1525
+
1526
+
1527
+ <span class='type'>(<tt>Boolean</tt>)</span>
1528
+
1529
+
1530
+
1531
+ &mdash;
1532
+ <div class='inline'>
1533
+ <p>An indication if this attribute is readable by the model.</p>
1534
+ </div>
1535
+
1536
+ </li>
1537
+
1538
+ </ul>
1539
+ <p class="tag_title">Raises:</p>
1540
+ <ul class="raise">
1541
+
1542
+ <li>
1543
+
1544
+
1545
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1546
+
1547
+
1548
+
1549
+ &mdash;
1550
+ <div class='inline'>
1551
+ <p>If the provided model does not have this attribute configured.</p>
1552
+ </div>
1553
+
1554
+ </li>
1555
+
1556
+ </ul>
1557
+
1558
+ </div><table class="source_code">
1559
+ <tr>
1560
+ <td>
1561
+ <pre class="lines">
1562
+
1563
+
1564
+ 116
1565
+ 117
1566
+ 118
1567
+ 119
1568
+ 120
1569
+ 121
1570
+ 122</pre>
1571
+ </td>
1572
+ <td>
1573
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 116</span>
1574
+
1575
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">read_access?</span>(model)
1576
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">true</span> <span style="color:#080;font-weight:bold">if</span> access.nil?
1577
+ raise ::<span style="color:#036;font-weight:bold">ArgumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">The provided </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>model.class.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> model does not have the </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> attribute configured</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> model.has_attribute?(<span style="color:#069">self</span>.name)
1578
+
1579
+ current_access = call_proc_or_symbol(access, model)
1580
+ [<span style="color:#A60">:read</span>, <span style="color:#A60">:read_write</span>].include?(current_access)
1581
+ <span style="color:#080;font-weight:bold">end</span></pre>
1582
+ </td>
1583
+ </tr>
1584
+ </table>
1585
+ </div>
1586
+
1587
+ <div class="method_details ">
1588
+ <h3 class="signature " id="required?-instance_method">
1589
+
1590
+ #<strong>required?</strong>(model) &#x21d2; <tt>Boolean</tt>
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+ </h3><div class="docstring">
1597
+ <div class="discussion">
1598
+
1599
+ <p>Determine if the attribute is required.</p>
1600
+
1601
+
1602
+ </div>
1603
+ </div>
1604
+ <div class="tags">
1605
+ <p class="tag_title">Parameters:</p>
1606
+ <ul class="param">
1607
+
1608
+ <li>
1609
+
1610
+ <span class='name'>model</span>
1611
+
1612
+
1613
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1614
+
1615
+
1616
+
1617
+ &mdash;
1618
+ <div class='inline'>
1619
+ <p>The model the value comes from.</p>
1620
+ </div>
1621
+
1622
+ </li>
1623
+
1624
+ </ul>
1625
+
1626
+ <p class="tag_title">Returns:</p>
1627
+ <ul class="return">
1628
+
1629
+ <li>
1630
+
1631
+
1632
+ <span class='type'>(<tt>Boolean</tt>)</span>
1633
+
1634
+
1635
+
1636
+ </li>
1637
+
1638
+ </ul>
1639
+ <p class="tag_title">Raises:</p>
1640
+ <ul class="raise">
1641
+
1642
+ <li>
1643
+
1644
+
1645
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1646
+
1647
+
1648
+
1649
+ &mdash;
1650
+ <div class='inline'>
1651
+ <p>If the provided model does not have this attribute configured.</p>
1652
+ </div>
1653
+
1654
+ </li>
1655
+
1656
+ </ul>
1657
+
1658
+ </div><table class="source_code">
1659
+ <tr>
1660
+ <td>
1661
+ <pre class="lines">
1662
+
1663
+
1664
+ 284
1665
+ 285
1666
+ 286
1667
+ 287
1668
+ 288
1669
+ 289
1670
+ 290</pre>
1671
+ </td>
1672
+ <td>
1673
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 284</span>
1674
+
1675
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">required?</span>(model)
1676
+ raise <span style="color:#036;font-weight:bold">ArugumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">The provided </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>model.class.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> model does not have the </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> attribute configured</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> model.has_attribute?(<span style="color:#069">self</span>.name)
1677
+ <span style="color:#080;font-weight:bold">return</span> required <span style="color:#080;font-weight:bold">if</span> required.is_a?(<span style="color:#036;font-weight:bold">TrueClass</span>) <span style="color:#080;font-weight:bold">or</span> required.is_a?(<span style="color:#036;font-weight:bold">FalseClass</span>)
1678
+ _required = call_proc_or_symbol(required, model)
1679
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">false</span> <span style="color:#080;font-weight:bold">if</span> _required.nil?
1680
+ _required
1681
+ <span style="color:#080;font-weight:bold">end</span></pre>
1682
+ </td>
1683
+ </tr>
1684
+ </table>
1685
+ </div>
1686
+
1687
+ <div class="method_details ">
1688
+ <h3 class="signature " id="transform_value-instance_method">
1689
+
1690
+ #<strong>transform_value</strong>(model, value) &#x21d2; <tt>Any</tt>
1691
+
1692
+
1693
+
1694
+
1695
+
1696
+ </h3><div class="docstring">
1697
+ <div class="discussion">
1698
+
1699
+ <p>Converts an inbound value to the appropriate type.</p>
1700
+
1701
+
1702
+ </div>
1703
+ </div>
1704
+ <div class="tags">
1705
+ <p class="tag_title">Parameters:</p>
1706
+ <ul class="param">
1707
+
1708
+ <li>
1709
+
1710
+ <span class='name'>model</span>
1711
+
1712
+
1713
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1714
+
1715
+
1716
+
1717
+ &mdash;
1718
+ <div class='inline'>
1719
+ <p>The model the value is for.</p>
1720
+ </div>
1721
+
1722
+ </li>
1723
+
1724
+ <li>
1725
+
1726
+ <span class='name'>value</span>
1727
+
1728
+
1729
+ <span class='type'>(<tt>Any</tt>)</span>
1730
+
1731
+
1732
+
1733
+ &mdash;
1734
+ <div class='inline'>
1735
+ <p>The value to be transformed</p>
1736
+ </div>
1737
+
1738
+ </li>
1739
+
1740
+ </ul>
1741
+
1742
+ <p class="tag_title">Returns:</p>
1743
+ <ul class="return">
1744
+
1745
+ <li>
1746
+
1747
+
1748
+ <span class='type'>(<tt>Any</tt>)</span>
1749
+
1750
+
1751
+
1752
+ &mdash;
1753
+ <div class='inline'>
1754
+ <p>The transformed value</p>
1755
+ </div>
1756
+
1757
+ </li>
1758
+
1759
+ </ul>
1760
+
1761
+ </div><table class="source_code">
1762
+ <tr>
1763
+ <td>
1764
+ <pre class="lines">
1765
+
1766
+
1767
+ 234
1768
+ 235
1769
+ 236
1770
+ 237
1771
+ 238
1772
+ 239
1773
+ 240
1774
+ 241
1775
+ 242
1776
+ 243
1777
+ 244
1778
+ 245
1779
+ 246
1780
+ 247
1781
+ 248
1782
+ 249
1783
+ 250
1784
+ 251</pre>
1785
+ </td>
1786
+ <td>
1787
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 234</span>
1788
+
1789
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">transform_value</span>(model, value)
1790
+
1791
+ <span style="color:#777"># Booleans are a special case because they are not represented by a single</span>
1792
+ <span style="color:#777"># class.</span>
1793
+ <span style="color:#080;font-weight:bold">return</span> value.to_s.downcase.start_with?(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">y</span><span style="color:#710">&quot;</span></span>,<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">t</span><span style="color:#710">&quot;</span></span>,<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">1</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">if</span> <span style="color:#069">self</span>.type == <span style="color:#A60">:boolean</span>
1794
+ type_class = type_to_class(<span style="color:#069">self</span>.type)
1795
+ transformed_value = value
1796
+
1797
+ <span style="color:#080;font-weight:bold">if</span> type_class == <span style="color:#036;font-weight:bold">Time</span>
1798
+ current_timezone = <span style="color:#036;font-weight:bold">Time</span>.zone
1799
+ <span style="color:#036;font-weight:bold">Time</span>.zone = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">UTC</span><span style="color:#710">&quot;</span></span>
1800
+ transformed_value = <span style="color:#036;font-weight:bold">Time</span>.zone.parse(value) <span style="color:#777"># =&gt; Tue, 23 Nov 2010 23:29:57 UTC +00:00</span>
1801
+ <span style="color:#036;font-weight:bold">Time</span>.zone = current_timezone
1802
+ <span style="color:#080;font-weight:bold">elsif</span> type_class &lt; <span style="color:#036;font-weight:bold">WscSdk</span>::<span style="color:#036;font-weight:bold">Model</span> <span style="color:#080;font-weight:bold">and</span> value.is_a?(<span style="color:#036;font-weight:bold">Hash</span>)
1803
+ transformed_value = type_class.new(model.endpoint, value)
1804
+ <span style="color:#080;font-weight:bold">end</span>
1805
+ transformed_value
1806
+ <span style="color:#080;font-weight:bold">end</span></pre>
1807
+ </td>
1808
+ </tr>
1809
+ </table>
1810
+ </div>
1811
+
1812
+ <div class="method_details ">
1813
+ <h3 class="signature " id="type_to_class-instance_method">
1814
+
1815
+ #<strong>type_to_class</strong>(attribute_type) &#x21d2; <tt>Any</tt>
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+ </h3><div class="docstring">
1822
+ <div class="discussion">
1823
+
1824
+ <p>Converts the specified type to a class</p>
1825
+
1826
+
1827
+ </div>
1828
+ </div>
1829
+ <div class="tags">
1830
+ <p class="tag_title">Parameters:</p>
1831
+ <ul class="param">
1832
+
1833
+ <li>
1834
+
1835
+ <span class='name'>attribute_type</span>
1836
+
1837
+
1838
+ <span class='type'>(<tt>Symbol</tt>)</span>
1839
+
1840
+
1841
+
1842
+ &mdash;
1843
+ <div class='inline'>
1844
+ <p>The type to check if it&#39;s valid.</p>
1845
+ </div>
1846
+
1847
+ </li>
1848
+
1849
+ </ul>
1850
+
1851
+ <p class="tag_title">Returns:</p>
1852
+ <ul class="return">
1853
+
1854
+ <li>
1855
+
1856
+
1857
+ <span class='type'>(<tt>Any</tt>)</span>
1858
+
1859
+
1860
+
1861
+ &mdash;
1862
+ <div class='inline'>
1863
+ <p>The class represented by the type, or nil if it&#39;s not a valid type.</p>
1864
+ </div>
1865
+
1866
+ </li>
1867
+
1868
+ </ul>
1869
+
1870
+ </div><table class="source_code">
1871
+ <tr>
1872
+ <td>
1873
+ <pre class="lines">
1874
+
1875
+
1876
+ 210
1877
+ 211
1878
+ 212
1879
+ 213
1880
+ 214
1881
+ 215
1882
+ 216
1883
+ 217
1884
+ 218
1885
+ 219
1886
+ 220
1887
+ 221</pre>
1888
+ </td>
1889
+ <td>
1890
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 210</span>
1891
+
1892
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">type_to_class</span>(attribute_type)
1893
+ <span style="color:#777"># Booleans are a special case because they are not represented by a single</span>
1894
+ <span style="color:#777"># class.</span>
1895
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#036;font-weight:bold">String</span> <span style="color:#080;font-weight:bold">if</span> attribute_type == <span style="color:#A60">:boolean</span>
1896
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#036;font-weight:bold">Time</span> <span style="color:#080;font-weight:bold">if</span> attribute_type == <span style="color:#A60">:datetime</span>
1897
+
1898
+ class_name = attribute_type.to_s.camelize
1899
+ <span style="color:#080;font-weight:bold">unless</span> <span style="color:#036;font-weight:bold">TYPES</span>.include?(attribute_type)
1900
+ class_name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">WscSdk::Models::</span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>class_name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#710">&quot;</span></span>
1901
+ <span style="color:#080;font-weight:bold">end</span>
1902
+ <span style="color:#080;font-weight:bold">return</span> (class_name.constantize)
1903
+ <span style="color:#080;font-weight:bold">end</span></pre>
1904
+ </td>
1905
+ </tr>
1906
+ </table>
1907
+ </div>
1908
+
1909
+ <div class="method_details ">
1910
+ <h3 class="signature " id="valid?-instance_method">
1911
+
1912
+ #<strong>valid?</strong>(model) &#x21d2; <tt>String</tt>
1913
+
1914
+
1915
+
1916
+
1917
+
1918
+ </h3><div class="docstring">
1919
+ <div class="discussion">
1920
+
1921
+ <p>Determine if a value is valid according to the attribute configuration.</p>
1922
+
1923
+
1924
+ </div>
1925
+ </div>
1926
+ <div class="tags">
1927
+ <p class="tag_title">Parameters:</p>
1928
+ <ul class="param">
1929
+
1930
+ <li>
1931
+
1932
+ <span class='name'>model</span>
1933
+
1934
+
1935
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
1936
+
1937
+
1938
+
1939
+ &mdash;
1940
+ <div class='inline'>
1941
+ <p>The model the value comes from.</p>
1942
+ </div>
1943
+
1944
+ </li>
1945
+
1946
+ </ul>
1947
+
1948
+ <p class="tag_title">Returns:</p>
1949
+ <ul class="return">
1950
+
1951
+ <li>
1952
+
1953
+
1954
+ <span class='type'>(<tt>String</tt>)</span>
1955
+
1956
+
1957
+
1958
+ &mdash;
1959
+ <div class='inline'>
1960
+ <p>A message of what&#39;s wrong if the value isn&#39;t valid, or nil if the
1961
+ value is valid.</p>
1962
+ </div>
1963
+
1964
+ </li>
1965
+
1966
+ </ul>
1967
+ <p class="tag_title">Raises:</p>
1968
+ <ul class="raise">
1969
+
1970
+ <li>
1971
+
1972
+
1973
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1974
+
1975
+
1976
+
1977
+ &mdash;
1978
+ <div class='inline'>
1979
+ <p>If the provided model does not have this attribute configured.</p>
1980
+ </div>
1981
+
1982
+ </li>
1983
+
1984
+ </ul>
1985
+
1986
+ </div><table class="source_code">
1987
+ <tr>
1988
+ <td>
1989
+ <pre class="lines">
1990
+
1991
+
1992
+ 156
1993
+ 157
1994
+ 158
1995
+ 159
1996
+ 160
1997
+ 161
1998
+ 162
1999
+ 163
2000
+ 164
2001
+ 165
2002
+ 166
2003
+ 167
2004
+ 168
2005
+ 169
2006
+ 170
2007
+ 171
2008
+ 172
2009
+ 173
2010
+ 174</pre>
2011
+ </td>
2012
+ <td>
2013
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 156</span>
2014
+
2015
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">valid?</span>(model)
2016
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">nil</span> <span style="color:#080;font-weight:bold">if</span> validate.nil?
2017
+
2018
+ raise <span style="color:#036;font-weight:bold">ArugumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">The provided </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>model.class.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> model does not have the </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> attribute configured</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> model.has_attribute?(<span style="color:#069">self</span>.name)
2019
+ value = model.attributes[<span style="color:#069">self</span>.name]
2020
+
2021
+ message = <span style="color:#069">nil</span>
2022
+
2023
+ <span style="color:#080;font-weight:bold">if</span> validate.is_a?(<span style="color:#036;font-weight:bold">Array</span>)
2024
+ valid = validate.include?(value)
2025
+ model.add_error(name, <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">value must be one of the following: </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>validate.join(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">, </span><span style="color:#710">&quot;</span></span>)<span style="font-weight:bold;color:#666">}</span></span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> valid
2026
+ <span style="color:#080;font-weight:bold">return</span> valid
2027
+ <span style="color:#080;font-weight:bold">else</span>
2028
+ <span style="color:#080;font-weight:bold">return</span> call_proc_or_symbol(validate, model)
2029
+ <span style="color:#080;font-weight:bold">end</span>
2030
+
2031
+ <span style="color:#777"># Calls should never get here.</span>
2032
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">true</span>
2033
+ <span style="color:#080;font-weight:bold">end</span></pre>
2034
+ </td>
2035
+ </tr>
2036
+ </table>
2037
+ </div>
2038
+
2039
+ <div class="method_details ">
2040
+ <h3 class="signature " id="valid_model_type?-instance_method">
2041
+
2042
+ #<strong>valid_model_type?</strong>(attribute_type) &#x21d2; <tt>Boolean</tt>
2043
+
2044
+
2045
+
2046
+
2047
+
2048
+ </h3><div class="docstring">
2049
+ <div class="discussion">
2050
+
2051
+ <p>Determines if the specified type of the attribute matches a model.</p>
2052
+
2053
+
2054
+ </div>
2055
+ </div>
2056
+ <div class="tags">
2057
+ <p class="tag_title">Parameters:</p>
2058
+ <ul class="param">
2059
+
2060
+ <li>
2061
+
2062
+ <span class='name'>attribute_type</span>
2063
+
2064
+
2065
+ <span class='type'>(<tt>Symbol</tt>)</span>
2066
+
2067
+
2068
+
2069
+ &mdash;
2070
+ <div class='inline'>
2071
+ <p>The type to check if it&#39;s valid.</p>
2072
+ </div>
2073
+
2074
+ </li>
2075
+
2076
+ </ul>
2077
+
2078
+ <p class="tag_title">Returns:</p>
2079
+ <ul class="return">
2080
+
2081
+ <li>
2082
+
2083
+
2084
+ <span class='type'>(<tt>Boolean</tt>)</span>
2085
+
2086
+
2087
+
2088
+ &mdash;
2089
+ <div class='inline'>
2090
+ <p>An indication that the type represents a model.</p>
2091
+ </div>
2092
+
2093
+ </li>
2094
+
2095
+ </ul>
2096
+
2097
+ </div><table class="source_code">
2098
+ <tr>
2099
+ <td>
2100
+ <pre class="lines">
2101
+
2102
+
2103
+ 197
2104
+ 198
2105
+ 199
2106
+ 200</pre>
2107
+ </td>
2108
+ <td>
2109
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 197</span>
2110
+
2111
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">valid_model_type?</span>(attribute_type)
2112
+ type_class = type_to_class(attribute_type)
2113
+ !type_class.nil?
2114
+ <span style="color:#080;font-weight:bold">end</span></pre>
2115
+ </td>
2116
+ </tr>
2117
+ </table>
2118
+ </div>
2119
+
2120
+ <div class="method_details ">
2121
+ <h3 class="signature " id="valid_type?-instance_method">
2122
+
2123
+ #<strong>valid_type?</strong>(value) &#x21d2; <tt>Boolean</tt>
2124
+
2125
+
2126
+
2127
+
2128
+
2129
+ </h3><div class="docstring">
2130
+ <div class="discussion">
2131
+
2132
+ <p>Determine if the provided value is of a valid type for the attribute.</p>
2133
+
2134
+
2135
+ </div>
2136
+ </div>
2137
+ <div class="tags">
2138
+ <p class="tag_title">Parameters:</p>
2139
+ <ul class="param">
2140
+
2141
+ <li>
2142
+
2143
+ <span class='name'>value</span>
2144
+
2145
+
2146
+ <span class='type'>(<tt>Any</tt>)</span>
2147
+
2148
+
2149
+
2150
+ &mdash;
2151
+ <div class='inline'>
2152
+ <p>The value whose type will be compared to the attribute to determine if it
2153
+ is valid.</p>
2154
+ </div>
2155
+
2156
+ </li>
2157
+
2158
+ </ul>
2159
+
2160
+ <p class="tag_title">Returns:</p>
2161
+ <ul class="return">
2162
+
2163
+ <li>
2164
+
2165
+
2166
+ <span class='type'>(<tt>Boolean</tt>)</span>
2167
+
2168
+
2169
+
2170
+ &mdash;
2171
+ <div class='inline'>
2172
+ <p>An indication of whether or not the value&#39;s type matches the attribute
2173
+ type.</p>
2174
+ </div>
2175
+
2176
+ </li>
2177
+
2178
+ </ul>
2179
+
2180
+ </div><table class="source_code">
2181
+ <tr>
2182
+ <td>
2183
+ <pre class="lines">
2184
+
2185
+
2186
+ 184
2187
+ 185
2188
+ 186
2189
+ 187</pre>
2190
+ </td>
2191
+ <td>
2192
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 184</span>
2193
+
2194
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">valid_type?</span>(attribute_type)
2195
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">true</span> <span style="color:#080;font-weight:bold">if</span> <span style="color:#036;font-weight:bold">TYPES</span>.include?(attribute_type)
2196
+ <span style="color:#080;font-weight:bold">return</span> valid_model_type?(attribute_type)
2197
+ <span style="color:#080;font-weight:bold">end</span></pre>
2198
+ </td>
2199
+ </tr>
2200
+ </table>
2201
+ </div>
2202
+
2203
+ <div class="method_details ">
2204
+ <h3 class="signature " id="value_or_default-instance_method">
2205
+
2206
+ #<strong>value_or_default</strong>(model) &#x21d2; <tt>Object</tt>
2207
+
2208
+
2209
+
2210
+
2211
+
2212
+ </h3><div class="docstring">
2213
+ <div class="discussion">
2214
+
2215
+ <p>Return either the value from the model that is represented by the
2216
+ attribute, or the default value if the value is not assigned.</p>
2217
+
2218
+
2219
+ </div>
2220
+ </div>
2221
+ <div class="tags">
2222
+ <p class="tag_title">Parameters:</p>
2223
+ <ul class="param">
2224
+
2225
+ <li>
2226
+
2227
+ <span class='name'>model</span>
2228
+
2229
+
2230
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
2231
+
2232
+
2233
+
2234
+ &mdash;
2235
+ <div class='inline'>
2236
+ <p>The model the value comes from.</p>
2237
+ </div>
2238
+
2239
+ </li>
2240
+
2241
+ </ul>
2242
+
2243
+ <p class="tag_title">Raises:</p>
2244
+ <ul class="raise">
2245
+
2246
+ <li>
2247
+
2248
+
2249
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
2250
+
2251
+
2252
+
2253
+ &mdash;
2254
+ <div class='inline'>
2255
+ <p>If the provided model does not have this attribute configured.</p>
2256
+ </div>
2257
+
2258
+ </li>
2259
+
2260
+ </ul>
2261
+
2262
+ </div><table class="source_code">
2263
+ <tr>
2264
+ <td>
2265
+ <pre class="lines">
2266
+
2267
+
2268
+ 271
2269
+ 272
2270
+ 273
2271
+ 274</pre>
2272
+ </td>
2273
+ <td>
2274
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 271</span>
2275
+
2276
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">value_or_default</span>(model)
2277
+ raise <span style="color:#036;font-weight:bold">ArugumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">The provided </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>model.class.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> model does not have the </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> attribute configured</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> model.has_attribute?(<span style="color:#069">self</span>.name)
2278
+ model.attributes[<span style="color:#069">self</span>.name] || default_value(model)
2279
+ <span style="color:#080;font-weight:bold">end</span></pre>
2280
+ </td>
2281
+ </tr>
2282
+ </table>
2283
+ </div>
2284
+
2285
+ <div class="method_details ">
2286
+ <h3 class="signature " id="write_access?-instance_method">
2287
+
2288
+ #<strong>write_access?</strong>(model) &#x21d2; <tt>Boolean</tt>
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+ </h3><div class="docstring">
2295
+ <div class="discussion">
2296
+
2297
+ <p>Determine if the attribute is writable according to the attribute
2298
+ configuration.</p>
2299
+
2300
+
2301
+ </div>
2302
+ </div>
2303
+ <div class="tags">
2304
+ <p class="tag_title">Parameters:</p>
2305
+ <ul class="param">
2306
+
2307
+ <li>
2308
+
2309
+ <span class='name'>model</span>
2310
+
2311
+
2312
+ <span class='type'>(<tt><span class='object_link'><a href="Model.html" title="WscSdk::Model (class)">WscSdk::Model</a></span></tt>)</span>
2313
+
2314
+
2315
+
2316
+ &mdash;
2317
+ <div class='inline'>
2318
+ <p>The model that will determine the access level of the attribute.</p>
2319
+ </div>
2320
+
2321
+ </li>
2322
+
2323
+ </ul>
2324
+
2325
+ <p class="tag_title">Returns:</p>
2326
+ <ul class="return">
2327
+
2328
+ <li>
2329
+
2330
+
2331
+ <span class='type'>(<tt>Boolean</tt>)</span>
2332
+
2333
+
2334
+
2335
+ &mdash;
2336
+ <div class='inline'>
2337
+ <p>An indication if this attribute is writable by the model.</p>
2338
+ </div>
2339
+
2340
+ </li>
2341
+
2342
+ </ul>
2343
+ <p class="tag_title">Raises:</p>
2344
+ <ul class="raise">
2345
+
2346
+ <li>
2347
+
2348
+
2349
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
2350
+
2351
+
2352
+
2353
+ &mdash;
2354
+ <div class='inline'>
2355
+ <p>If the provided model does not have this attribute configured.</p>
2356
+ </div>
2357
+
2358
+ </li>
2359
+
2360
+ </ul>
2361
+
2362
+ </div><table class="source_code">
2363
+ <tr>
2364
+ <td>
2365
+ <pre class="lines">
2366
+
2367
+
2368
+ 136
2369
+ 137
2370
+ 138
2371
+ 139
2372
+ 140
2373
+ 141
2374
+ 142</pre>
2375
+ </td>
2376
+ <td>
2377
+ <pre class="code"><span class="info file"># File 'lib/wsc_sdk/schema_attribute.rb', line 136</span>
2378
+
2379
+ <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">write_access?</span>(model)
2380
+ <span style="color:#080;font-weight:bold">return</span> <span style="color:#069">true</span> <span style="color:#080;font-weight:bold">if</span> access.nil?
2381
+ raise <span style="color:#036;font-weight:bold">ArugumentError</span>.new(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">&quot;</span><span style="color:#D20">The provided </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span>model.class.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> model does not have the </span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.name<span style="font-weight:bold;color:#666">}</span></span><span style="color:#D20"> attribute configured</span><span style="color:#710">&quot;</span></span>) <span style="color:#080;font-weight:bold">unless</span> model.has_attribute?(<span style="color:#069">self</span>.name)
2382
+
2383
+ current_access = call_proc_or_symbol(access, model)
2384
+ [<span style="color:#A60">:write</span>, <span style="color:#A60">:read_write</span>].include?(current_access)
2385
+ <span style="color:#080;font-weight:bold">end</span></pre>
2386
+ </td>
2387
+ </tr>
2388
+ </table>
2389
+ </div>
2390
+
2391
+ </div>
2392
+
2393
+ </div>
2394
+
2395
+
2396
+ </div>
2397
+ </div>
2398
+ </div>
2399
+ </body>
2400
+ </html>