active_cached_resource 0.0.1.pre → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/lib/active_cached_resource/caching.rb +104 -1
  5. data/lib/active_cached_resource/configuration.rb +22 -1
  6. data/lib/active_cached_resource/logger.rb +14 -0
  7. data/lib/active_cached_resource/model.rb +18 -0
  8. data/lib/active_cached_resource/version.rb +1 -8
  9. data/lib/activeresource/lib/active_resource/collection.rb +14 -1
  10. data/lib/activeresource/lib/active_resource/railtie.rb +2 -2
  11. data/lib/activeresource/lib/active_resource.rb +1 -1
  12. metadata +5 -401
  13. data/.rspec +0 -3
  14. data/.rubocop.yml +0 -22
  15. data/.standard.yml +0 -2
  16. data/Rakefile +0 -21
  17. data/example/consumer/.dockerignore +0 -41
  18. data/example/consumer/.gitattributes +0 -9
  19. data/example/consumer/.gitignore +0 -36
  20. data/example/consumer/.kamal/hooks/docker-setup.sample +0 -3
  21. data/example/consumer/.kamal/hooks/post-deploy.sample +0 -14
  22. data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +0 -3
  23. data/example/consumer/.kamal/hooks/pre-build.sample +0 -51
  24. data/example/consumer/.kamal/hooks/pre-connect.sample +0 -47
  25. data/example/consumer/.kamal/hooks/pre-deploy.sample +0 -109
  26. data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  27. data/example/consumer/.kamal/secrets +0 -17
  28. data/example/consumer/Dockerfile +0 -65
  29. data/example/consumer/Gemfile +0 -17
  30. data/example/consumer/Rakefile +0 -6
  31. data/example/consumer/app/controllers/application_controller.rb +0 -2
  32. data/example/consumer/app/controllers/concerns/.keep +0 -0
  33. data/example/consumer/app/jobs/application_job.rb +0 -7
  34. data/example/consumer/app/mailers/application_mailer.rb +0 -4
  35. data/example/consumer/app/models/application_record.rb +0 -3
  36. data/example/consumer/app/models/concerns/.keep +0 -0
  37. data/example/consumer/app/models/person.rb +0 -9
  38. data/example/consumer/app/views/layouts/mailer.html.erb +0 -13
  39. data/example/consumer/app/views/layouts/mailer.text.erb +0 -1
  40. data/example/consumer/bin/brakeman +0 -7
  41. data/example/consumer/bin/bundle +0 -109
  42. data/example/consumer/bin/dev +0 -2
  43. data/example/consumer/bin/docker-entrypoint +0 -14
  44. data/example/consumer/bin/jobs +0 -6
  45. data/example/consumer/bin/kamal +0 -27
  46. data/example/consumer/bin/rails +0 -4
  47. data/example/consumer/bin/rake +0 -4
  48. data/example/consumer/bin/rubocop +0 -8
  49. data/example/consumer/bin/setup +0 -34
  50. data/example/consumer/bin/thrust +0 -5
  51. data/example/consumer/config/application.rb +0 -20
  52. data/example/consumer/config/boot.rb +0 -3
  53. data/example/consumer/config/cache.yml +0 -16
  54. data/example/consumer/config/credentials.yml.enc +0 -1
  55. data/example/consumer/config/database.yml +0 -14
  56. data/example/consumer/config/deploy.yml +0 -116
  57. data/example/consumer/config/environment.rb +0 -5
  58. data/example/consumer/config/environments/development.rb +0 -64
  59. data/example/consumer/config/environments/production.rb +0 -85
  60. data/example/consumer/config/environments/test.rb +0 -50
  61. data/example/consumer/config/initializers/cors.rb +0 -16
  62. data/example/consumer/config/initializers/filter_parameter_logging.rb +0 -8
  63. data/example/consumer/config/initializers/inflections.rb +0 -16
  64. data/example/consumer/config/locales/en.yml +0 -31
  65. data/example/consumer/config/puma.rb +0 -41
  66. data/example/consumer/config/queue.yml +0 -18
  67. data/example/consumer/config/recurring.yml +0 -10
  68. data/example/consumer/config/routes.rb +0 -10
  69. data/example/consumer/config.ru +0 -6
  70. data/example/consumer/db/cache_schema.rb +0 -14
  71. data/example/consumer/db/queue_schema.rb +0 -129
  72. data/example/consumer/db/seeds.rb +0 -0
  73. data/example/consumer/lib/tasks/.keep +0 -0
  74. data/example/consumer/log/.keep +0 -0
  75. data/example/consumer/public/robots.txt +0 -1
  76. data/example/consumer/script/.keep +0 -0
  77. data/example/consumer/storage/.keep +0 -0
  78. data/example/consumer/tmp/.keep +0 -0
  79. data/example/consumer/tmp/cache/.keep +0 -0
  80. data/example/consumer/tmp/pids/.keep +0 -0
  81. data/example/consumer/tmp/storage/.keep +0 -0
  82. data/example/consumer/vendor/.keep +0 -0
  83. data/example/provider/.dockerignore +0 -41
  84. data/example/provider/.gitattributes +0 -9
  85. data/example/provider/.gitignore +0 -32
  86. data/example/provider/.kamal/hooks/docker-setup.sample +0 -3
  87. data/example/provider/.kamal/hooks/post-deploy.sample +0 -14
  88. data/example/provider/.kamal/hooks/post-proxy-reboot.sample +0 -3
  89. data/example/provider/.kamal/hooks/pre-build.sample +0 -51
  90. data/example/provider/.kamal/hooks/pre-connect.sample +0 -47
  91. data/example/provider/.kamal/hooks/pre-deploy.sample +0 -109
  92. data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  93. data/example/provider/.kamal/secrets +0 -17
  94. data/example/provider/Dockerfile +0 -65
  95. data/example/provider/Gemfile +0 -14
  96. data/example/provider/Rakefile +0 -6
  97. data/example/provider/app/controllers/application_controller.rb +0 -2
  98. data/example/provider/app/controllers/concerns/.keep +0 -0
  99. data/example/provider/app/controllers/people_controller.rb +0 -68
  100. data/example/provider/app/jobs/application_job.rb +0 -7
  101. data/example/provider/app/mailers/application_mailer.rb +0 -4
  102. data/example/provider/app/models/address.rb +0 -3
  103. data/example/provider/app/models/application_record.rb +0 -3
  104. data/example/provider/app/models/company.rb +0 -3
  105. data/example/provider/app/models/concerns/.keep +0 -0
  106. data/example/provider/app/models/person.rb +0 -6
  107. data/example/provider/app/views/layouts/mailer.html.erb +0 -13
  108. data/example/provider/app/views/layouts/mailer.text.erb +0 -1
  109. data/example/provider/bin/brakeman +0 -7
  110. data/example/provider/bin/bundle +0 -109
  111. data/example/provider/bin/dev +0 -2
  112. data/example/provider/bin/docker-entrypoint +0 -14
  113. data/example/provider/bin/jobs +0 -6
  114. data/example/provider/bin/kamal +0 -27
  115. data/example/provider/bin/rails +0 -4
  116. data/example/provider/bin/rake +0 -4
  117. data/example/provider/bin/rubocop +0 -8
  118. data/example/provider/bin/setup +0 -34
  119. data/example/provider/bin/thrust +0 -5
  120. data/example/provider/config/application.rb +0 -44
  121. data/example/provider/config/boot.rb +0 -3
  122. data/example/provider/config/cache.yml +0 -16
  123. data/example/provider/config/credentials.yml.enc +0 -1
  124. data/example/provider/config/database.yml +0 -20
  125. data/example/provider/config/deploy.yml +0 -116
  126. data/example/provider/config/environment.rb +0 -5
  127. data/example/provider/config/environments/development.rb +0 -64
  128. data/example/provider/config/environments/production.rb +0 -85
  129. data/example/provider/config/environments/test.rb +0 -50
  130. data/example/provider/config/initializers/cors.rb +0 -16
  131. data/example/provider/config/initializers/filter_parameter_logging.rb +0 -8
  132. data/example/provider/config/initializers/inflections.rb +0 -16
  133. data/example/provider/config/locales/en.yml +0 -31
  134. data/example/provider/config/puma.rb +0 -41
  135. data/example/provider/config/queue.yml +0 -18
  136. data/example/provider/config/recurring.yml +0 -10
  137. data/example/provider/config/routes.rb +0 -4
  138. data/example/provider/config.ru +0 -6
  139. data/example/provider/db/cache_schema.rb +0 -14
  140. data/example/provider/db/migrate/20241202183937_create_people.rb +0 -11
  141. data/example/provider/db/migrate/20241202183955_create_addresses.rb +0 -13
  142. data/example/provider/db/migrate/20241202184017_create_companies.rb +0 -14
  143. data/example/provider/db/queue_schema.rb +0 -129
  144. data/example/provider/db/schema.rb +0 -47
  145. data/example/provider/db/seeds.rb +0 -18
  146. data/example/provider/lib/tasks/.keep +0 -0
  147. data/example/provider/log/.keep +0 -0
  148. data/example/provider/public/robots.txt +0 -1
  149. data/example/provider/script/.keep +0 -0
  150. data/example/provider/storage/.keep +0 -0
  151. data/example/provider/tmp/.keep +0 -0
  152. data/example/provider/tmp/pids/.keep +0 -0
  153. data/example/provider/tmp/storage/.keep +0 -0
  154. data/example/provider/vendor/.keep +0 -0
  155. data/lib/activeresource/.gitignore +0 -15
  156. data/lib/activeresource/examples/performance.rb +0 -72
  157. data/lib/activeresource/test/abstract_unit.rb +0 -153
  158. data/lib/activeresource/test/cases/active_job_serializer_test.rb +0 -53
  159. data/lib/activeresource/test/cases/association_test.rb +0 -104
  160. data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +0 -42
  161. data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +0 -28
  162. data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +0 -28
  163. data/lib/activeresource/test/cases/authorization_test.rb +0 -276
  164. data/lib/activeresource/test/cases/base/custom_methods_test.rb +0 -155
  165. data/lib/activeresource/test/cases/base/equality_test.rb +0 -53
  166. data/lib/activeresource/test/cases/base/load_test.rb +0 -249
  167. data/lib/activeresource/test/cases/base/schema_test.rb +0 -428
  168. data/lib/activeresource/test/cases/base_errors_test.rb +0 -129
  169. data/lib/activeresource/test/cases/base_test.rb +0 -1622
  170. data/lib/activeresource/test/cases/callbacks_test.rb +0 -155
  171. data/lib/activeresource/test/cases/collection_test.rb +0 -172
  172. data/lib/activeresource/test/cases/connection_test.rb +0 -357
  173. data/lib/activeresource/test/cases/finder_test.rb +0 -217
  174. data/lib/activeresource/test/cases/format_test.rb +0 -137
  175. data/lib/activeresource/test/cases/http_mock_test.rb +0 -213
  176. data/lib/activeresource/test/cases/inheritence_test.rb +0 -19
  177. data/lib/activeresource/test/cases/inheriting_hash_test.rb +0 -25
  178. data/lib/activeresource/test/cases/log_subscriber_test.rb +0 -63
  179. data/lib/activeresource/test/cases/reflection_test.rb +0 -65
  180. data/lib/activeresource/test/cases/validations_test.rb +0 -78
  181. data/lib/activeresource/test/fixtures/address.rb +0 -20
  182. data/lib/activeresource/test/fixtures/beast.rb +0 -16
  183. data/lib/activeresource/test/fixtures/comment.rb +0 -5
  184. data/lib/activeresource/test/fixtures/customer.rb +0 -5
  185. data/lib/activeresource/test/fixtures/inventory.rb +0 -14
  186. data/lib/activeresource/test/fixtures/person.rb +0 -15
  187. data/lib/activeresource/test/fixtures/pet.rb +0 -6
  188. data/lib/activeresource/test/fixtures/post.rb +0 -5
  189. data/lib/activeresource/test/fixtures/product.rb +0 -11
  190. data/lib/activeresource/test/fixtures/project.rb +0 -19
  191. data/lib/activeresource/test/fixtures/proxy.rb +0 -6
  192. data/lib/activeresource/test/fixtures/sound.rb +0 -11
  193. data/lib/activeresource/test/fixtures/street_address.rb +0 -6
  194. data/lib/activeresource/test/fixtures/subscription_plan.rb +0 -7
  195. data/lib/activeresource/test/fixtures/weather.rb +0 -21
  196. data/lib/activeresource/test/setter_trap.rb +0 -28
  197. data/lib/activeresource/test/singleton_test.rb +0 -138
  198. data/lib/activeresource/test/threadsafe_attributes_test.rb +0 -91
  199. data/sorbet/config +0 -4
  200. data/sorbet/rbi/annotations/.gitattributes +0 -1
  201. data/sorbet/rbi/annotations/activemodel.rbi +0 -89
  202. data/sorbet/rbi/annotations/activesupport.rbi +0 -457
  203. data/sorbet/rbi/annotations/minitest.rbi +0 -119
  204. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  205. data/sorbet/rbi/dsl/.gitattributes +0 -1
  206. data/sorbet/rbi/dsl/active_support/callbacks.rbi +0 -21
  207. data/sorbet/rbi/gems/.gitattributes +0 -1
  208. data/sorbet/rbi/gems/actioncable@8.0.0.rbi +0 -252
  209. data/sorbet/rbi/gems/actionmailbox@8.0.0.rbi +0 -9
  210. data/sorbet/rbi/gems/actionmailer@8.0.0.rbi +0 -9
  211. data/sorbet/rbi/gems/actionpack@8.0.0.rbi +0 -20909
  212. data/sorbet/rbi/gems/actiontext@8.0.0.rbi +0 -9
  213. data/sorbet/rbi/gems/actionview@8.0.0.rbi +0 -16207
  214. data/sorbet/rbi/gems/activejob@8.0.0.rbi +0 -9
  215. data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +0 -166
  216. data/sorbet/rbi/gems/activemodel@8.0.0.rbi +0 -6857
  217. data/sorbet/rbi/gems/activerecord@8.0.0.rbi +0 -42896
  218. data/sorbet/rbi/gems/activeresource@6.1.4.rbi +0 -3944
  219. data/sorbet/rbi/gems/activestorage@8.0.0.rbi +0 -9
  220. data/sorbet/rbi/gems/activesupport@8.0.0.rbi +0 -21251
  221. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -585
  222. data/sorbet/rbi/gems/base64@0.2.0.rbi +0 -509
  223. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +0 -618
  224. data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +0 -78
  225. data/sorbet/rbi/gems/builder@3.3.0.rbi +0 -9
  226. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -169
  227. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3607
  228. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3427
  229. data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +0 -11645
  230. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +0 -9
  231. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -623
  232. data/sorbet/rbi/gems/date@3.4.0.rbi +0 -75
  233. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +0 -1131
  234. data/sorbet/rbi/gems/docile@1.4.1.rbi +0 -377
  235. data/sorbet/rbi/gems/drb@2.2.1.rbi +0 -1347
  236. data/sorbet/rbi/gems/erubi@1.13.0.rbi +0 -150
  237. data/sorbet/rbi/gems/globalid@1.2.1.rbi +0 -9
  238. data/sorbet/rbi/gems/i18n@1.14.6.rbi +0 -2359
  239. data/sorbet/rbi/gems/io-console@0.7.2.rbi +0 -9
  240. data/sorbet/rbi/gems/json@2.8.2.rbi +0 -1901
  241. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14238
  242. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +0 -240
  243. data/sorbet/rbi/gems/logger@1.6.1.rbi +0 -920
  244. data/sorbet/rbi/gems/loofah@2.23.1.rbi +0 -1081
  245. data/sorbet/rbi/gems/mail@2.8.1.rbi +0 -9
  246. data/sorbet/rbi/gems/marcel@1.0.4.rbi +0 -9
  247. data/sorbet/rbi/gems/method_source@1.1.0.rbi +0 -304
  248. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +0 -9
  249. data/sorbet/rbi/gems/minitest@5.25.2.rbi +0 -1547
  250. data/sorbet/rbi/gems/net-imap@0.5.1.rbi +0 -9
  251. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +0 -9
  252. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +0 -292
  253. data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +0 -9
  254. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
  255. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +0 -9
  256. data/sorbet/rbi/gems/nokogiri@1.16.7.rbi +0 -7311
  257. data/sorbet/rbi/gems/parallel@1.26.3.rbi +0 -291
  258. data/sorbet/rbi/gems/parser@3.3.6.0.rbi +0 -5519
  259. data/sorbet/rbi/gems/prism@1.2.0.rbi +0 -39085
  260. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1151
  261. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10076
  262. data/sorbet/rbi/gems/psych@5.2.0.rbi +0 -1785
  263. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -162
  264. data/sorbet/rbi/gems/rack-session@2.0.0.rbi +0 -727
  265. data/sorbet/rbi/gems/rack-test@2.1.0.rbi +0 -747
  266. data/sorbet/rbi/gems/rack@3.1.8.rbi +0 -4905
  267. data/sorbet/rbi/gems/rackup@2.2.1.rbi +0 -230
  268. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +0 -758
  269. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +0 -785
  270. data/sorbet/rbi/gems/rails@8.0.0.rbi +0 -9
  271. data/sorbet/rbi/gems/railties@8.0.0.rbi +0 -6287
  272. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
  273. data/sorbet/rbi/gems/rake@13.2.1.rbi +0 -3091
  274. data/sorbet/rbi/gems/rbi@0.2.1.rbi +0 -4535
  275. data/sorbet/rbi/gems/rdoc@6.8.1.rbi +0 -12572
  276. data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +0 -3772
  277. data/sorbet/rbi/gems/reline@0.5.12.rbi +0 -2416
  278. data/sorbet/rbi/gems/rexml@3.3.9.rbi +0 -4858
  279. data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +0 -11287
  280. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +0 -8183
  281. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +0 -5341
  282. data/sorbet/rbi/gems/rspec-support@3.13.1.rbi +0 -1630
  283. data/sorbet/rbi/gems/rspec@3.13.0.rbi +0 -83
  284. data/sorbet/rbi/gems/rubocop-ast@1.36.1.rbi +0 -7303
  285. data/sorbet/rbi/gems/rubocop-performance@1.21.1.rbi +0 -9
  286. data/sorbet/rbi/gems/rubocop@1.65.1.rbi +0 -58170
  287. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
  288. data/sorbet/rbi/gems/securerandom@0.3.2.rbi +0 -395
  289. data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +0 -225
  290. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +0 -2149
  291. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -9
  292. data/sorbet/rbi/gems/spoom@1.5.0.rbi +0 -4932
  293. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +0 -9
  294. data/sorbet/rbi/gems/standard-performance@1.4.0.rbi +0 -9
  295. data/sorbet/rbi/gems/standard@1.40.0.rbi +0 -929
  296. data/sorbet/rbi/gems/stringio@3.1.2.rbi +0 -9
  297. data/sorbet/rbi/gems/tapioca@0.16.4.rbi +0 -3597
  298. data/sorbet/rbi/gems/thor@1.3.2.rbi +0 -4378
  299. data/sorbet/rbi/gems/timeout@0.4.2.rbi +0 -151
  300. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5918
  301. data/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi +0 -66
  302. data/sorbet/rbi/gems/uri@1.0.2.rbi +0 -2377
  303. data/sorbet/rbi/gems/useragent@0.16.10.rbi +0 -9
  304. data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +0 -9
  305. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -9
  306. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  307. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18504
  308. data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +0 -9
  309. data/sorbet/tapioca/config.yml +0 -13
  310. data/sorbet/tapioca/require.rb +0 -12
@@ -1,3944 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `activeresource` gem.
5
- # Please instead update this file by running `bin/tapioca gem activeresource`.
6
-
7
-
8
- # source://activeresource//lib/active_resource/exceptions.rb#3
9
- module ActiveResource
10
- extend ::ActiveSupport::Autoload
11
-
12
- class << self
13
- # source://activeresource//lib/active_resource.rb#51
14
- def deprecator; end
15
- end
16
- end
17
-
18
- # source://activeresource//lib/active_resource/associations.rb#3
19
- module ActiveResource::Associations
20
- # Specifies a one-to-one association with another class. This class should only be used
21
- # if this class contains the foreign key.
22
- #
23
- # Methods will be added for retrieval and query for a single associated object, for which
24
- # this object holds an id:
25
- #
26
- # [association(force_reload = false)]
27
- # Returns the associated object. +nil+ is returned if the foreign key is +nil+.
28
- # Throws a ActiveResource::ResourceNotFound exception if the foreign key is not +nil+
29
- # and the resource is not found.
30
- #
31
- # (+association+ is replaced with the symbol passed as the first argument, so
32
- # <tt>belongs_to :post</tt> would add among others <tt>post.nil?</tt>.
33
- #
34
- # === Example
35
- #
36
- # A Comment class declares <tt>belongs_to :post</tt>, which will add:
37
- # * <tt>Comment#post</tt> (similar to <tt>Post.find(post_id)</tt>)
38
- # The declaration can also include an options hash to specialize the behavior of the association.
39
- #
40
- # === Options
41
- # [:class_name]
42
- # Specify the class name for the association. Use it only if that name can't be inferred from association name.
43
- # So <tt>belongs_to :post</tt> will by default be linked to the Post class, but if the real class name is Article,
44
- # you'll have to specify it with this option.
45
- # [:foreign_key]
46
- # Specify the foreign key used for the association. By default this is guessed to be the name
47
- # of the association with an "_id" suffix. So a class that defines a <tt>belongs_to :post</tt>
48
- # association will use "post_id" as the default <tt>:foreign_key</tt>. Similarly,
49
- # <tt>belongs_to :article, :class_name => "Post"</tt> will use a foreign key
50
- # of "article_id".
51
- #
52
- # Option examples:
53
- # <tt>belongs_to :customer, :class_name => 'User'</tt>
54
- # Creates a belongs_to association called customer which is represented through the <tt>User</tt> class.
55
- #
56
- # <tt>belongs_to :customer, :foreign_key => 'user_id'</tt>
57
- # Creates a belongs_to association called customer which would be resolved by the foreign_key <tt>user_id</tt> instead of <tt>customer_id</tt>
58
- #
59
- # source://activeresource//lib/active_resource/associations.rb#116
60
- def belongs_to(name, options = T.unsafe(nil)); end
61
-
62
- # Defines the belongs_to association finder method
63
- #
64
- # source://activeresource//lib/active_resource/associations.rb#121
65
- def defines_belongs_to_finder_method(reflection); end
66
-
67
- # source://activeresource//lib/active_resource/associations.rb#141
68
- def defines_has_many_finder_method(reflection); end
69
-
70
- # Defines the has_one association
71
- #
72
- # source://activeresource//lib/active_resource/associations.rb#159
73
- def defines_has_one_finder_method(reflection); end
74
-
75
- # Specifies a one-to-many association.
76
- #
77
- # === Options
78
- # [:class_name]
79
- # Specify the class name of the association. This class name would
80
- # be used for resolving the association class.
81
- #
82
- # ==== Example for [:class_name] - option
83
- # GET /posts/123.json delivers following response body:
84
- # {
85
- # title: "ActiveResource now has associations",
86
- # body: "Lorem Ipsum"
87
- # comments: [
88
- # {
89
- # content: "..."
90
- # },
91
- # {
92
- # content: "..."
93
- # }
94
- # ]
95
- # }
96
- # ====
97
- #
98
- # <tt>has_many :comments, :class_name => 'myblog/comment'</tt>
99
- # Would resolve those comments into the <tt>Myblog::Comment</tt> class.
100
- #
101
- # If the response body does not contain an attribute matching the association name
102
- # a request sent to the index action under the current resource.
103
- # For the example above, if the comments are not present the requested path would be:
104
- # GET /posts/123/comments.xml
105
- #
106
- # source://activeresource//lib/active_resource/associations.rb#43
107
- def has_many(name, options = T.unsafe(nil)); end
108
-
109
- # Specifies a one-to-one association.
110
- #
111
- # === Options
112
- # [:class_name]
113
- # Specify the class name of the association. This class name would
114
- # be used for resolving the association class.
115
- #
116
- # ==== Example for [:class_name] - option
117
- # GET /posts/1.json delivers following response body:
118
- # {
119
- # title: "ActiveResource now has associations",
120
- # body: "Lorem Ipsum",
121
- # author: {
122
- # name: "Gabby Blogger",
123
- # }
124
- # }
125
- # ====
126
- #
127
- # <tt>has_one :author, :class_name => 'myblog/author'</tt>
128
- # Would resolve this author into the <tt>Myblog::Author</tt> class.
129
- #
130
- # If the response body does not contain an attribute matching the association name
131
- # a request is sent to a singleton path under the current resource.
132
- # For example, if a Product class <tt>has_one :inventory</tt> calling <tt>Product#inventory</tt>
133
- # will generate a request on /products/:product_id/inventory.json.
134
- #
135
- # source://activeresource//lib/active_resource/associations.rb#73
136
- def has_one(name, options = T.unsafe(nil)); end
137
- end
138
-
139
- # source://activeresource//lib/active_resource/associations.rb#4
140
- module ActiveResource::Associations::Builder; end
141
-
142
- # source://activeresource//lib/active_resource/associations/builder/association.rb#4
143
- class ActiveResource::Associations::Builder::Association
144
- # @return [Association] a new instance of Association
145
- #
146
- # source://activeresource//lib/active_resource/associations/builder/association.rb#18
147
- def initialize(model, name, options); end
148
-
149
- # source://activeresource//lib/active_resource/associations/builder/association.rb#22
150
- def build; end
151
-
152
- # Returns the value of attribute klass.
153
- #
154
- # source://activeresource//lib/active_resource/associations/builder/association.rb#12
155
- def klass; end
156
-
157
- # source://activeresource//lib/active_resource/associations/builder/association.rb#10
158
- def macro; end
159
-
160
- # source://activeresource//lib/active_resource/associations/builder/association.rb#10
161
- def macro=(_arg0); end
162
-
163
- # source://activeresource//lib/active_resource/associations/builder/association.rb#10
164
- def macro?; end
165
-
166
- # Returns the value of attribute model.
167
- #
168
- # source://activeresource//lib/active_resource/associations/builder/association.rb#12
169
- def model; end
170
-
171
- # Returns the value of attribute name.
172
- #
173
- # source://activeresource//lib/active_resource/associations/builder/association.rb#12
174
- def name; end
175
-
176
- # Returns the value of attribute options.
177
- #
178
- # source://activeresource//lib/active_resource/associations/builder/association.rb#12
179
- def options; end
180
-
181
- # source://activeresource//lib/active_resource/associations/builder/association.rb#6
182
- def valid_options; end
183
-
184
- # source://activeresource//lib/active_resource/associations/builder/association.rb#6
185
- def valid_options=(_arg0); end
186
-
187
- # source://activeresource//lib/active_resource/associations/builder/association.rb#6
188
- def valid_options?; end
189
-
190
- private
191
-
192
- # source://activeresource//lib/active_resource/associations/builder/association.rb#28
193
- def validate_options; end
194
-
195
- class << self
196
- # source://activeresource//lib/active_resource/associations/builder/association.rb#14
197
- def build(model, name, options); end
198
-
199
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
200
- def macro; end
201
-
202
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
203
- def macro=(new_value); end
204
-
205
- # source://activeresource//lib/active_resource/associations/builder/association.rb#10
206
- def macro?; end
207
-
208
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
209
- def valid_options; end
210
-
211
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
212
- def valid_options=(new_value); end
213
-
214
- # source://activeresource//lib/active_resource/associations/builder/association.rb#6
215
- def valid_options?; end
216
- end
217
- end
218
-
219
- # source://activeresource//lib/active_resource/associations/builder/belongs_to.rb#4
220
- class ActiveResource::Associations::Builder::BelongsTo < ::ActiveResource::Associations::Builder::Association
221
- # source://activeresource//lib/active_resource/associations/builder/belongs_to.rb#9
222
- def build; end
223
-
224
- class << self
225
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
226
- def macro; end
227
-
228
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
229
- def macro=(new_value); end
230
-
231
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
232
- def valid_options; end
233
-
234
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
235
- def valid_options=(new_value); end
236
- end
237
- end
238
-
239
- # source://activeresource//lib/active_resource/associations/builder/has_many.rb#4
240
- class ActiveResource::Associations::Builder::HasMany < ::ActiveResource::Associations::Builder::Association
241
- # source://activeresource//lib/active_resource/associations/builder/has_many.rb#7
242
- def build; end
243
-
244
- class << self
245
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
246
- def macro; end
247
-
248
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
249
- def macro=(new_value); end
250
- end
251
- end
252
-
253
- # source://activeresource//lib/active_resource/associations/builder/has_one.rb#4
254
- class ActiveResource::Associations::Builder::HasOne < ::ActiveResource::Associations::Builder::Association
255
- # source://activeresource//lib/active_resource/associations/builder/has_one.rb#7
256
- def build; end
257
-
258
- class << self
259
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
260
- def macro; end
261
-
262
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
263
- def macro=(new_value); end
264
- end
265
- end
266
-
267
- # 400 Bad Request
268
- #
269
- # source://activeresource//lib/active_resource/exceptions.rb#53
270
- class ActiveResource::BadRequest < ::ActiveResource::ClientError; end
271
-
272
- # ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.
273
- #
274
- # For an outline of what Active Resource is capable of, see its {README}[link:files/activeresource/README_rdoc.html].
275
- #
276
- # == Automated mapping
277
- #
278
- # Active Resource objects represent your RESTful resources as manipulatable Ruby objects. To map resources
279
- # to Ruby objects, Active Resource only needs a class name that corresponds to the resource name (e.g., the class
280
- # Person maps to the resources people, very similarly to Active Record) and a +site+ value, which holds the
281
- # URI of the resources.
282
- #
283
- # class Person < ActiveResource::Base
284
- # self.site = "https://api.people.com"
285
- # end
286
- #
287
- # Now the Person class is mapped to RESTful resources located at <tt>https://api.people.com/people/</tt>, and
288
- # you can now use Active Resource's life cycle methods to manipulate resources. In the case where you already have
289
- # an existing model with the same name as the desired RESTful resource you can set the +element_name+ value.
290
- #
291
- # class PersonResource < ActiveResource::Base
292
- # self.site = "https://api.people.com"
293
- # self.element_name = "person"
294
- # end
295
- #
296
- # If your Active Resource object is required to use an HTTP proxy you can set the +proxy+ value which holds a URI.
297
- #
298
- # class PersonResource < ActiveResource::Base
299
- # self.site = "https://api.people.com"
300
- # self.proxy = "https://user:password@proxy.people.com:8080"
301
- # end
302
- #
303
- #
304
- # == Life cycle methods
305
- #
306
- # Active Resource exposes methods for creating, finding, updating, and deleting resources
307
- # from REST web services.
308
- #
309
- # ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
310
- # ryan.save # => true
311
- # ryan.id # => 2
312
- # Person.exists?(ryan.id) # => true
313
- # ryan.exists? # => true
314
- #
315
- # ryan = Person.find(1)
316
- # # Resource holding our newly created Person object
317
- #
318
- # ryan.first = 'Rizzle'
319
- # ryan.save # => true
320
- #
321
- # ryan.destroy # => true
322
- #
323
- # As you can see, these are very similar to Active Record's life cycle methods for database records.
324
- # You can read more about each of these methods in their respective documentation.
325
- #
326
- # === Custom REST methods
327
- #
328
- # Since simple CRUD/life cycle methods can't accomplish every task, Active Resource also supports
329
- # defining your own custom REST methods. To invoke them, Active Resource provides the <tt>get</tt>,
330
- # <tt>post</tt>, <tt>put</tt> and <tt>delete</tt> methods where you can specify a custom REST method
331
- # name to invoke.
332
- #
333
- # # POST to the custom 'register' REST method, i.e. POST /people/new/register.json.
334
- # Person.new(:name => 'Ryan').post(:register)
335
- # # => { :id => 1, :name => 'Ryan', :position => 'Clerk' }
336
- #
337
- # # PUT an update by invoking the 'promote' REST method, i.e. PUT /people/1/promote.json?position=Manager.
338
- # Person.find(1).put(:promote, :position => 'Manager')
339
- # # => { :id => 1, :name => 'Ryan', :position => 'Manager' }
340
- #
341
- # # GET all the positions available, i.e. GET /people/positions.json.
342
- # Person.get(:positions)
343
- # # => [{:name => 'Manager'}, {:name => 'Clerk'}]
344
- #
345
- # # DELETE to 'fire' a person, i.e. DELETE /people/1/fire.json.
346
- # Person.find(1).delete(:fire)
347
- #
348
- # For more information on using custom REST methods, see the
349
- # ActiveResource::CustomMethods documentation.
350
- #
351
- # == Validations
352
- #
353
- # You can validate resources client side by overriding validation methods in the base class.
354
- #
355
- # class Person < ActiveResource::Base
356
- # self.site = "https://api.people.com"
357
- # protected
358
- # def validate
359
- # errors.add("last", "has invalid characters") unless last =~ /[a-zA-Z]*/
360
- # end
361
- # end
362
- #
363
- # See the ActiveResource::Validations documentation for more information.
364
- #
365
- # == Authentication
366
- #
367
- # Many REST APIs require authentication. The HTTP spec describes two ways to
368
- # make requests with a username and password (see RFC 2617).
369
- #
370
- # Basic authentication simply sends a username and password along with HTTP
371
- # requests. These sensitive credentials are sent unencrypted, visible to
372
- # any onlooker, so this scheme should only be used with SSL.
373
- #
374
- # Digest authentication sends a cryptographic hash of the username, password,
375
- # HTTP method, URI, and a single-use secret key provided by the server.
376
- # Sensitive credentials aren't visible to onlookers, so digest authentication
377
- # doesn't require SSL. However, this doesn't mean the connection is secure!
378
- # Just the username and password.
379
- #
380
- # Another common way to authenticate requests is via bearer tokens, a scheme
381
- # originally created as part of the OAuth 2.0 protocol (see RFC 6750).
382
- #
383
- # Bearer authentication sends a token, that can maybe only be a short string
384
- # of hexadecimal characters or even a JWT Token. Similarly to the Basic
385
- # authentication, this scheme should only be used with SSL.
386
- #
387
- # (You really, really want to use SSL. There's little reason not to.)
388
- #
389
- # === Picking an authentication scheme
390
- #
391
- # Basic authentication is the default. To switch to digest or bearer token authentication,
392
- # set +auth_type+ to +:digest+ or +:bearer+:
393
- #
394
- # class Person < ActiveResource::Base
395
- # self.auth_type = :digest
396
- # end
397
- #
398
- # === Setting the username and password
399
- #
400
- # Set +user+ and +password+ on the class, or include them in the +site+ URL.
401
- #
402
- # class Person < ActiveResource::Base
403
- # # Set user and password directly:
404
- # self.user = "ryan"
405
- # self.password = "password"
406
- #
407
- # # Or include them in the site:
408
- # self.site = "https://ryan:password@api.people.com"
409
- # end
410
- #
411
- # === Setting the bearer token
412
- #
413
- # Set +bearer_token+ on the class:
414
- #
415
- # class Person < ActiveResource::Base
416
- # # Set bearer token directly:
417
- # self.auth_type = :bearer
418
- # self.bearer_token = "my-bearer-token"
419
- # end
420
- #
421
- # === Certificate Authentication
422
- #
423
- # You can also authenticate using an X509 certificate. <tt>See ssl_options=</tt> for all options.
424
- #
425
- # class Person < ActiveResource::Base
426
- # self.site = "https://secure.api.people.com/"
427
- #
428
- # File.open(pem_file_path, 'rb') do |pem_file|
429
- # self.ssl_options = {
430
- # cert: OpenSSL::X509::Certificate.new(pem_file),
431
- # key: OpenSSL::PKey::RSA.new(pem_file),
432
- # ca_path: "/path/to/OpenSSL/formatted/CA_Certs",
433
- # verify_mode: OpenSSL::SSL::VERIFY_PEER }
434
- # end
435
- # end
436
- #
437
- #
438
- # == Errors & Validation
439
- #
440
- # Error handling and validation is handled in much the same manner as you're used to seeing in
441
- # Active Record. Both the response code in the HTTP response and the body of the response are used to
442
- # indicate that an error occurred.
443
- #
444
- # === Resource errors
445
- #
446
- # When a GET is requested for a resource that does not exist, the HTTP <tt>404</tt> (Resource Not Found)
447
- # response code will be returned from the server which will raise an ActiveResource::ResourceNotFound
448
- # exception.
449
- #
450
- # # GET https://api.people.com/people/999.json
451
- # ryan = Person.find(999) # 404, raises ActiveResource::ResourceNotFound
452
- #
453
- #
454
- # <tt>404</tt> is just one of the HTTP error response codes that Active Resource will handle with its own exception. The
455
- # following HTTP response codes will also result in these exceptions:
456
- #
457
- # * 200..399 - Valid response. No exceptions, other than these redirects:
458
- # * 301, 302, 303, 307 - ActiveResource::Redirection
459
- # * 400 - ActiveResource::BadRequest
460
- # * 401 - ActiveResource::UnauthorizedAccess
461
- # * 402 - ActiveResource::PaymentRequired
462
- # * 403 - ActiveResource::ForbiddenAccess
463
- # * 404 - ActiveResource::ResourceNotFound
464
- # * 405 - ActiveResource::MethodNotAllowed
465
- # * 409 - ActiveResource::ResourceConflict
466
- # * 410 - ActiveResource::ResourceGone
467
- # * 412 - ActiveResource::PreconditionFailed
468
- # * 422 - ActiveResource::ResourceInvalid (rescued by save as validation errors)
469
- # * 429 - ActiveResource::TooManyRequests
470
- # * 401..499 - ActiveResource::ClientError
471
- # * 500..599 - ActiveResource::ServerError
472
- # * Other - ActiveResource::ConnectionError
473
- #
474
- # These custom exceptions allow you to deal with resource errors more naturally and with more precision
475
- # rather than returning a general HTTP error. For example:
476
- #
477
- # begin
478
- # ryan = Person.find(my_id)
479
- # rescue ActiveResource::ResourceNotFound
480
- # redirect_to :action => 'not_found'
481
- # rescue ActiveResource::ResourceConflict, ActiveResource::ResourceInvalid
482
- # redirect_to :action => 'new'
483
- # end
484
- #
485
- # When a GET is requested for a nested resource and you don't provide the prefix_param
486
- # an ActiveResource::MissingPrefixParam will be raised.
487
- #
488
- # class Comment < ActiveResource::Base
489
- # self.site = "https://someip.com/posts/:post_id"
490
- # end
491
- #
492
- # Comment.find(1)
493
- # # => ActiveResource::MissingPrefixParam: post_id prefix_option is missing
494
- #
495
- # === Validation errors
496
- #
497
- # Active Resource supports validations on resources and will return errors if any of these validations fail
498
- # (e.g., "First name can not be blank" and so on). These types of errors are denoted in the response by
499
- # a response code of <tt>422</tt> and an JSON or XML representation of the validation errors. The save operation will
500
- # then fail (with a <tt>false</tt> return value) and the validation errors can be accessed on the resource in question.
501
- #
502
- # ryan = Person.find(1)
503
- # ryan.first # => ''
504
- # ryan.save # => false
505
- #
506
- # # When
507
- # # PUT https://api.people.com/people/1.xml
508
- # # or
509
- # # PUT https://api.people.com/people/1.json
510
- # # is requested with invalid values, the response is:
511
- # #
512
- # # Response (422):
513
- # # <errors><error>First cannot be empty</error></errors>
514
- # # or
515
- # # {"errors":{"first":["cannot be empty"]}}
516
- # #
517
- #
518
- # ryan.errors.invalid?(:first) # => true
519
- # ryan.errors.full_messages # => ['First cannot be empty']
520
- #
521
- # For backwards-compatibility with older endpoints, the following formats are also supported in JSON responses:
522
- #
523
- # # {"errors":['First cannot be empty']}
524
- # # This was the required format for previous versions of ActiveResource
525
- # # {"first":["cannot be empty"]}
526
- # # This was the default format produced by respond_with in ActionController <3.2.1
527
- #
528
- # Parsing either of these formats will result in a deprecation warning.
529
- #
530
- # Learn more about Active Resource's validation features in the ActiveResource::Validations documentation.
531
- #
532
- # === Timeouts
533
- #
534
- # Active Resource relies on HTTP to access RESTful APIs and as such is inherently susceptible to slow or
535
- # unresponsive servers. In such cases, your Active Resource method calls could \timeout. You can control the
536
- # amount of time before Active Resource times out with the +timeout+ variable.
537
- #
538
- # class Person < ActiveResource::Base
539
- # self.site = "https://api.people.com"
540
- # self.timeout = 5
541
- # end
542
- #
543
- # This sets the +timeout+ to 5 seconds. You can adjust the +timeout+ to a value suitable for the RESTful API
544
- # you are accessing. It is recommended to set this to a reasonably low value to allow your Active Resource
545
- # clients (especially if you are using Active Resource in a Rails application) to fail-fast (see
546
- # http://en.wikipedia.org/wiki/Fail-fast) rather than cause cascading failures that could incapacitate your
547
- # server.
548
- #
549
- # When a \timeout occurs, an ActiveResource::TimeoutError is raised. You should rescue from
550
- # ActiveResource::TimeoutError in your Active Resource method calls.
551
- #
552
- # Internally, Active Resource relies on Ruby's Net::HTTP library to make HTTP requests. Setting +timeout+
553
- # sets the <tt>read_timeout</tt> of the internal Net::HTTP instance to the same value. The default
554
- # <tt>read_timeout</tt> is 60 seconds on most Ruby implementations.
555
- #
556
- # Active Resource also supports distinct +open_timeout+ (time to connect) and +read_timeout+ (how long to
557
- # wait for an upstream response). This is inline with supported +Net::HTTP+ timeout configuration and allows
558
- # for finer control of client timeouts depending on context.
559
- #
560
- # class Person < ActiveResource::Base
561
- # self.site = "https://api.people.com"
562
- # self.open_timeout = 2
563
- # self.read_timeout = 10
564
- # end
565
- #
566
- # source://activeresource//lib/active_resource/base.rb#319
567
- class ActiveResource::Base
568
- include ::ActiveModel::Validations
569
- include ::ActiveSupport::Callbacks
570
- include ::ActiveModel::Validations::HelperMethods
571
- include ::ActiveResource::Validations
572
- include ::ActiveResource::CustomMethods
573
- include ::ActiveResource::Callbacks
574
- include ::ActiveModel::Validations::Callbacks
575
- include ::ActiveModel::Conversion
576
- include ::ActiveModel::Serialization
577
- include ::ActiveModel::Serializers::JSON
578
- include ::ActiveModel::Serializers::Xml
579
- include ::ActiveResource::Reflection
580
- extend ::ThreadsafeAttributes
581
- extend ::ActiveModel::Naming
582
- extend ::ActiveResource::Associations
583
- extend ::ActiveModel::Validations::ClassMethods
584
- extend ::ActiveModel::Callbacks
585
- extend ::ActiveSupport::Callbacks::ClassMethods
586
- extend ::ActiveSupport::DescendantsTracker
587
- extend ::ActiveModel::Translation
588
- extend ::ActiveModel::Validations::HelperMethods
589
- extend ::ActiveResource::CustomMethods::ClassMethods
590
- extend ::ActiveModel::Validations::Callbacks::ClassMethods
591
- extend ::ActiveModel::Conversion::ClassMethods
592
- extend ::ActiveResource::Reflection::ClassMethods
593
-
594
- # Constructor method for \new resources; the optional +attributes+ parameter takes a \hash
595
- # of attributes for the \new resource.
596
- #
597
- # ==== Examples
598
- # my_course = Course.new
599
- # my_course.name = "Western Civilization"
600
- # my_course.lecturer = "Don Trotter"
601
- # my_course.save
602
- #
603
- # my_other_course = Course.new(:name => "Philosophy: Reason and Being", :lecturer => "Ralph Cling")
604
- # my_other_course.save
605
- #
606
- # @return [Base] a new instance of Base
607
- #
608
- # source://activeresource//lib/active_resource/base.rb#1213
609
- def initialize(attributes = T.unsafe(nil), persisted = T.unsafe(nil)); end
610
-
611
- # Test for equality. Resource are equal if and only if +other+ is the same object or
612
- # is an instance of the same class, is not <tt>new?</tt>, and has the same +id+.
613
- #
614
- # ==== Examples
615
- # ryan = Person.create(:name => 'Ryan')
616
- # jamie = Person.create(:name => 'Jamie')
617
- #
618
- # ryan == jamie
619
- # # => false (Different name attribute and id)
620
- #
621
- # ryan_again = Person.new(:name => 'Ryan')
622
- # ryan == ryan_again
623
- # # => false (ryan_again is new?)
624
- #
625
- # ryans_clone = Person.create(:name => 'Ryan')
626
- # ryan == ryans_clone
627
- # # => false (Different id attributes)
628
- #
629
- # ryans_twin = Person.find(ryan.id)
630
- # ryan == ryans_twin
631
- # # => true
632
- #
633
- # source://activeresource//lib/active_resource/base.rb#1318
634
- def ==(other); end
635
-
636
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#69
637
- def __callbacks; end
638
-
639
- # source://activeresource//lib/active_resource/base.rb#331
640
- def _collection_parser; end
641
-
642
- # source://activeresource//lib/active_resource/base.rb#331
643
- def _collection_parser=(_arg0); end
644
-
645
- # source://activeresource//lib/active_resource/base.rb#331
646
- def _collection_parser?; end
647
-
648
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
649
- def _create_callbacks; end
650
-
651
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
652
- def _destroy_callbacks; end
653
-
654
- # source://activeresource//lib/active_resource/base.rb#330
655
- def _format; end
656
-
657
- # source://activeresource//lib/active_resource/base.rb#330
658
- def _format=(_arg0); end
659
-
660
- # source://activeresource//lib/active_resource/base.rb#330
661
- def _format?; end
662
-
663
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
664
- def _run_create_callbacks(&block); end
665
-
666
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
667
- def _run_destroy_callbacks(&block); end
668
-
669
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
670
- def _run_save_callbacks(&block); end
671
-
672
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
673
- def _run_update_callbacks(&block); end
674
-
675
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
676
- def _run_validate_callbacks(&block); end
677
-
678
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#911
679
- def _run_validation_callbacks(&block); end
680
-
681
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
682
- def _save_callbacks; end
683
-
684
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
685
- def _update_callbacks; end
686
-
687
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
688
- def _validate_callbacks; end
689
-
690
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#923
691
- def _validation_callbacks; end
692
-
693
- # source://activemodel/8.0.0/lib/active_model/validations.rb#50
694
- def _validators; end
695
-
696
- # source://activemodel/8.0.0/lib/active_model/validations.rb#50
697
- def _validators?; end
698
-
699
- # source://activeresource//lib/active_resource/base.rb#1184
700
- def attributes; end
701
-
702
- # source://activeresource//lib/active_resource/base.rb#1184
703
- def attributes=(_arg0); end
704
-
705
- # Returns a \clone of the resource that hasn't been assigned an +id+ yet and
706
- # is treated as a \new resource.
707
- #
708
- # ryan = Person.find(1)
709
- # not_ryan = ryan.clone
710
- # not_ryan.new? # => true
711
- #
712
- # Any active resource member attributes will NOT be cloned, though all other
713
- # attributes are. This is to prevent the conflict between any +prefix_options+
714
- # that refer to the original parent resource and the newly cloned parent
715
- # resource that does not exist.
716
- #
717
- # ryan = Person.find(1)
718
- # ryan.address = StreetAddress.find(1, :person_id => ryan.id)
719
- # ryan.hash = {:not => "an ARes instance"}
720
- #
721
- # not_ryan = ryan.clone
722
- # not_ryan.new? # => true
723
- # not_ryan.address # => NoMethodError
724
- # not_ryan.hash # => {:not => "an ARes instance"}
725
- #
726
- # source://activeresource//lib/active_resource/base.rb#1240
727
- def clone; end
728
-
729
- # source://activeresource//lib/active_resource/base.rb#335
730
- def connection_class; end
731
-
732
- # source://activeresource//lib/active_resource/base.rb#335
733
- def connection_class=(_arg0); end
734
-
735
- # source://activeresource//lib/active_resource/base.rb#335
736
- def connection_class?; end
737
-
738
- # Deletes the resource from the remote service.
739
- #
740
- # ==== Examples
741
- # my_id = 3
742
- # my_person = Person.find(my_id)
743
- # my_person.destroy
744
- # Person.find(my_id) # 404 (Resource Not Found)
745
- #
746
- # new_person = Person.create(:name => 'James')
747
- # new_id = new_person.id # => 7
748
- # new_person.destroy
749
- # Person.find(new_id) # 404 (Resource Not Found)
750
- #
751
- # source://activeresource//lib/active_resource/base.rb#1400
752
- def destroy; end
753
-
754
- # Duplicates the current resource without saving it.
755
- #
756
- # ==== Examples
757
- # my_invoice = Invoice.create(:customer => 'That Company')
758
- # next_invoice = my_invoice.dup
759
- # next_invoice.new? # => true
760
- #
761
- # next_invoice.save
762
- # next_invoice == my_invoice # => false (different id attributes)
763
- #
764
- # my_invoice.customer # => That Company
765
- # next_invoice.customer # => That Company
766
- #
767
- # source://activeresource//lib/active_resource/base.rb#1345
768
- def dup; end
769
-
770
- # Returns the serialized string representation of the resource in the configured
771
- # serialization format specified in ActiveResource::Base.format. The options
772
- # applicable depend on the configured encoding format.
773
- #
774
- # source://activeresource//lib/active_resource/base.rb#1429
775
- def encode(options = T.unsafe(nil)); end
776
-
777
- # Tests for equality (delegates to ==).
778
- #
779
- # @return [Boolean]
780
- #
781
- # source://activeresource//lib/active_resource/base.rb#1323
782
- def eql?(other); end
783
-
784
- # Evaluates to <tt>true</tt> if this resource is not <tt>new?</tt> and is
785
- # found on the remote service. Using this method, you can check for
786
- # resources that may have been deleted between the object's instantiation
787
- # and actions on it.
788
- #
789
- # ==== Examples
790
- # Person.create(:name => 'Theodore Roosevelt')
791
- # that_guy = Person.find(:first)
792
- # that_guy.exists? # => true
793
- #
794
- # that_lady = Person.new(:name => 'Paul Bean')
795
- # that_lady.exists? # => false
796
- #
797
- # guys_id = that_guy.id
798
- # Person.delete(guys_id)
799
- # that_guy.exists? # => false
800
- #
801
- # @return [Boolean]
802
- #
803
- # source://activeresource//lib/active_resource/base.rb#1422
804
- def exists?; end
805
-
806
- # Delegates to id in order to allow two resources of the same type and \id to work with something like:
807
- # [(a = Person.find 1), (b = Person.find 2)] & [(c = Person.find 1), (d = Person.find 4)] # => [a]
808
- #
809
- # source://activeresource//lib/active_resource/base.rb#1329
810
- def hash; end
811
-
812
- # Gets the <tt>\id</tt> attribute of the resource.
813
- #
814
- # source://activeresource//lib/active_resource/base.rb#1287
815
- def id; end
816
-
817
- # Sets the <tt>\id</tt> attribute of the resource.
818
- #
819
- # source://activeresource//lib/active_resource/base.rb#1292
820
- def id=(id); end
821
-
822
- # source://activeresource//lib/active_resource/base.rb#332
823
- def include_format_in_path; end
824
-
825
- # source://activeresource//lib/active_resource/base.rb#332
826
- def include_format_in_path=(_arg0); end
827
-
828
- # source://activeresource//lib/active_resource/base.rb#332
829
- def include_format_in_path?; end
830
-
831
- # source://activemodel/8.0.0/lib/active_model/serializers/json.rb#15
832
- def include_root_in_json; end
833
-
834
- # source://activemodel/8.0.0/lib/active_model/serializers/json.rb#15
835
- def include_root_in_json?; end
836
-
837
- # This is a list of known attributes for this resource. Either
838
- # gathered from the provided <tt>schema</tt>, or from the attributes
839
- # set on this instance after it has been fetched from the remote system.
840
- #
841
- # source://activeresource//lib/active_resource/base.rb#1197
842
- def known_attributes; end
843
-
844
- # A method to manually load attributes from a \hash. Recursively loads collections of
845
- # resources. This method is called in +initialize+ and +create+ when a \hash of attributes
846
- # is provided.
847
- #
848
- # ==== Examples
849
- # my_attrs = {:name => 'J&J Textiles', :industry => 'Cloth and textiles'}
850
- # my_attrs = {:name => 'Marty', :colors => ["red", "green", "blue"]}
851
- #
852
- # the_supplier = Supplier.find(:first)
853
- # the_supplier.name # => 'J&M Textiles'
854
- # the_supplier.load(my_attrs)
855
- # the_supplier.name('J&J Textiles')
856
- #
857
- # # These two calls are the same as Supplier.new(my_attrs)
858
- # my_supplier = Supplier.new
859
- # my_supplier.load(my_attrs)
860
- #
861
- # # These three calls are the same as Supplier.create(my_attrs)
862
- # your_supplier = Supplier.new
863
- # your_supplier.load(my_attrs)
864
- # your_supplier.save
865
- #
866
- # source://activeresource//lib/active_resource/base.rb#1469
867
- def load(attributes, remove_root = T.unsafe(nil), persisted = T.unsafe(nil)); end
868
-
869
- # :singleton-method:
870
- # The logger for diagnosing and tracing Active Resource calls.
871
- #
872
- # source://activeresource//lib/active_resource/base.rb#323
873
- def logger; end
874
-
875
- # source://activemodel/8.0.0/lib/active_model/naming.rb#255
876
- def model_name(&_arg0); end
877
-
878
- # Returns +true+ if this object hasn't yet been saved, otherwise, returns +false+.
879
- #
880
- # ==== Examples
881
- # not_new = Computer.create(:brand => 'Apple', :make => 'MacBook', :vendor => 'MacMall')
882
- # not_new.new? # => false
883
- #
884
- # is_new = Computer.new(:brand => 'IBM', :make => 'Thinkpad', :vendor => 'IBM')
885
- # is_new.new? # => true
886
- #
887
- # is_new.save
888
- # is_new.new? # => false
889
- #
890
- # @return [Boolean]
891
- #
892
- # source://activeresource//lib/active_resource/base.rb#1265
893
- def new?; end
894
-
895
- # Returns +true+ if this object hasn't yet been saved, otherwise, returns +false+.
896
- #
897
- # ==== Examples
898
- # not_new = Computer.create(:brand => 'Apple', :make => 'MacBook', :vendor => 'MacMall')
899
- # not_new.new? # => false
900
- #
901
- # is_new = Computer.new(:brand => 'IBM', :make => 'Thinkpad', :vendor => 'IBM')
902
- # is_new.new? # => true
903
- #
904
- # is_new.save
905
- # is_new.new? # => false
906
- #
907
- # @return [Boolean]
908
- #
909
- # source://activeresource//lib/active_resource/base.rb#1265
910
- def new_record?; end
911
-
912
- # source://activemodel/8.0.0/lib/active_model/conversion.rb#32
913
- def param_delimiter=(_arg0); end
914
-
915
- # Returns +true+ if this object has been saved, otherwise returns +false+.
916
- #
917
- # ==== Examples
918
- # persisted = Computer.create(:brand => 'Apple', :make => 'MacBook', :vendor => 'MacMall')
919
- # persisted.persisted? # => true
920
- #
921
- # not_persisted = Computer.new(:brand => 'IBM', :make => 'Thinkpad', :vendor => 'IBM')
922
- # not_persisted.persisted? # => false
923
- #
924
- # not_persisted.save
925
- # not_persisted.persisted? # => true
926
- #
927
- # @return [Boolean]
928
- #
929
- # source://activeresource//lib/active_resource/base.rb#1282
930
- def persisted?; end
931
-
932
- # source://activeresource//lib/active_resource/base.rb#1185
933
- def prefix_options; end
934
-
935
- # source://activeresource//lib/active_resource/base.rb#1185
936
- def prefix_options=(_arg0); end
937
-
938
- # source://activeresource//lib/active_resource/base.rb#1565
939
- def read_attribute_for_serialization(n); end
940
-
941
- # source://activeresource//lib/active_resource/reflection.rb#16
942
- def reflections; end
943
-
944
- # source://activeresource//lib/active_resource/reflection.rb#16
945
- def reflections=(_arg0); end
946
-
947
- # source://activeresource//lib/active_resource/reflection.rb#16
948
- def reflections?; end
949
-
950
- # A method to \reload the attributes of this object from the remote web service.
951
- #
952
- # ==== Examples
953
- # my_branch = Branch.find(:first)
954
- # my_branch.name # => "Wislon Raod"
955
- #
956
- # # Another client fixes the typo...
957
- #
958
- # my_branch.name # => "Wislon Raod"
959
- # my_branch.reload
960
- # my_branch.name # => "Wilson Road"
961
- #
962
- # source://activeresource//lib/active_resource/base.rb#1444
963
- def reload; end
964
-
965
- # For checking <tt>respond_to?</tt> without searching the attributes (which is faster).
966
- def respond_to_without_attributes?(*_arg0); end
967
-
968
- # Saves (+POST+) or \updates (+PUT+) a resource. Delegates to +create+ if the object is \new,
969
- # +update+ if it exists. If the response to the \save includes a body, it will be assumed that this body
970
- # is Json for the final object as it looked after the \save (which would include attributes like +created_at+
971
- # that weren't part of the original submit).
972
- #
973
- # ==== Examples
974
- # my_company = Company.new(:name => 'RoleModel Software', :owner => 'Ken Auer', :size => 2)
975
- # my_company.new? # => true
976
- # my_company.save # sends POST /companies/ (create)
977
- #
978
- # my_company.new? # => false
979
- # my_company.size = 10
980
- # my_company.save # sends PUT /companies/1 (update)
981
- #
982
- # source://activeresource//lib/active_resource/validations.rb#111
983
- def save(options = T.unsafe(nil)); end
984
-
985
- # Saves the resource.
986
- #
987
- # If the resource is new, it is created via +POST+, otherwise the
988
- # existing resource is updated via +PUT+.
989
- #
990
- # With <tt>save!</tt> validations always run. If any of them fail
991
- # ActiveResource::ResourceInvalid gets raised, and nothing is POSTed to
992
- # the remote system.
993
- # See ActiveResource::Validations for more information.
994
- #
995
- # There's a series of callbacks associated with <tt>save!</tt>. If any
996
- # of the <tt>before_*</tt> callbacks return +false+ the action is
997
- # cancelled and <tt>save!</tt> raises ActiveResource::ResourceInvalid.
998
- #
999
- # source://activeresource//lib/active_resource/base.rb#1384
1000
- def save!; end
1001
-
1002
- # source://activeresource//lib/active_resource/base.rb#1365
1003
- def save_without_validation; end
1004
-
1005
- # If no schema has been defined for the class (see
1006
- # <tt>ActiveResource::schema=</tt>), the default automatic schema is
1007
- # generated from the current instance's attributes
1008
- #
1009
- # source://activeresource//lib/active_resource/base.rb#1190
1010
- def schema; end
1011
-
1012
- # source://activeresource//lib/active_resource/base.rb#1557
1013
- def to_json(options = T.unsafe(nil)); end
1014
-
1015
- # source://activeresource//lib/active_resource/base.rb#1561
1016
- def to_xml(options = T.unsafe(nil)); end
1017
-
1018
- # Updates a single attribute and then saves the object.
1019
- #
1020
- # Note: <tt>Unlike ActiveRecord::Base.update_attribute</tt>, this method <b>is</b>
1021
- # subject to normal validation routines as an update sends the whole body
1022
- # of the resource in the request. (See Validations).
1023
- #
1024
- # As such, this method is equivalent to calling update_attributes with a single attribute/value pair.
1025
- #
1026
- # If the saving fails because of a connection or remote service error, an
1027
- # exception will be raised. If saving fails because the resource is
1028
- # invalid then <tt>false</tt> will be returned.
1029
- #
1030
- # source://activeresource//lib/active_resource/base.rb#1517
1031
- def update_attribute(name, value); end
1032
-
1033
- # Updates this resource with all the attributes from the passed-in Hash
1034
- # and requests that the record be saved.
1035
- #
1036
- # If the saving fails because of a connection or remote service error, an
1037
- # exception will be raised. If saving fails because the resource is
1038
- # invalid then <tt>false</tt> will be returned.
1039
- #
1040
- # Note: Though this request can be made with a partial set of the
1041
- # resource's attributes, the full body of the request will still be sent
1042
- # in the save request to the remote service.
1043
- #
1044
- # source://activeresource//lib/active_resource/base.rb#1532
1045
- def update_attributes(attributes); end
1046
-
1047
- protected
1048
-
1049
- # source://activeresource//lib/active_resource/base.rb#1623
1050
- def collection_path(options = T.unsafe(nil)); end
1051
-
1052
- # source://activeresource//lib/active_resource/base.rb#1574
1053
- def connection(refresh = T.unsafe(nil)); end
1054
-
1055
- # Create (i.e., \save to the remote service) the \new resource.
1056
- #
1057
- # source://activeresource//lib/active_resource/base.rb#1588
1058
- def create; end
1059
-
1060
- # source://activeresource//lib/active_resource/base.rb#1611
1061
- def element_path(options = T.unsafe(nil)); end
1062
-
1063
- # source://activeresource//lib/active_resource/base.rb#1615
1064
- def element_url(options = T.unsafe(nil)); end
1065
-
1066
- # Takes a response from a typical create post and pulls the ID out
1067
- #
1068
- # source://activeresource//lib/active_resource/base.rb#1607
1069
- def id_from_response(response); end
1070
-
1071
- # source://activeresource//lib/active_resource/base.rb#1597
1072
- def load_attributes_from_response(response); end
1073
-
1074
- # source://activeresource//lib/active_resource/base.rb#1619
1075
- def new_element_path; end
1076
-
1077
- # Update the resource on the remote service.
1078
- #
1079
- # source://activeresource//lib/active_resource/base.rb#1579
1080
- def update; end
1081
-
1082
- private
1083
-
1084
- # @return [Boolean]
1085
- #
1086
- # source://activeresource//lib/active_resource/base.rb#1680
1087
- def const_valid?(*const_args); end
1088
-
1089
- # Create and return a class definition for a resource inside the current resource
1090
- #
1091
- # source://activeresource//lib/active_resource/base.rb#1688
1092
- def create_resource_for(resource_name); end
1093
-
1094
- # Tries to find a resource for a given name; if it fails, then the resource is created
1095
- #
1096
- # source://activeresource//lib/active_resource/base.rb#1655
1097
- def find_or_create_resource_for(name); end
1098
-
1099
- # Tries to find a resource for a given collection name; if it fails, then the resource is created
1100
- #
1101
- # source://activeresource//lib/active_resource/base.rb#1634
1102
- def find_or_create_resource_for_collection(name); end
1103
-
1104
- # Tries to find a resource in a non empty list of nested modules
1105
- # if it fails, then the resource is created
1106
- #
1107
- # source://activeresource//lib/active_resource/base.rb#1641
1108
- def find_or_create_resource_in_modules(resource_name, module_names); end
1109
-
1110
- # source://activeresource//lib/active_resource/base.rb#1701
1111
- def method_missing(method_symbol, *arguments); end
1112
-
1113
- # A method to determine if an object responds to a message (e.g., a method call). In Active Resource, a Person object with a
1114
- # +name+ attribute can answer <tt>true</tt> to <tt>my_person.respond_to?(:name)</tt>, <tt>my_person.respond_to?(:name=)</tt>, and
1115
- # <tt>my_person.respond_to?(:name?)</tt>.
1116
- #
1117
- # @return [Boolean]
1118
- #
1119
- # source://activeresource//lib/active_resource/base.rb#1542
1120
- def respond_to_missing?(method, include_priv = T.unsafe(nil)); end
1121
-
1122
- # Determine whether the response is allowed to have a body per HTTP 1.1 spec section 4.4.1
1123
- #
1124
- # @return [Boolean]
1125
- #
1126
- # source://activeresource//lib/active_resource/base.rb#1629
1127
- def response_code_allows_body?(c); end
1128
-
1129
- # source://activeresource//lib/active_resource/base.rb#1697
1130
- def split_options(options = T.unsafe(nil)); end
1131
-
1132
- class << self
1133
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1134
- def __callbacks; end
1135
-
1136
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1137
- def __callbacks=(new_value); end
1138
-
1139
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1140
- def _bearer_token; end
1141
-
1142
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1143
- def _bearer_token=(value); end
1144
-
1145
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1146
- def _bearer_token_defined?; end
1147
-
1148
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1149
- def _collection_parser; end
1150
-
1151
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1152
- def _collection_parser=(new_value); end
1153
-
1154
- # source://activeresource//lib/active_resource/base.rb#331
1155
- def _collection_parser?; end
1156
-
1157
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1158
- def _connection; end
1159
-
1160
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1161
- def _connection=(value); end
1162
-
1163
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1164
- def _connection_defined?; end
1165
-
1166
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1167
- def _create_callbacks; end
1168
-
1169
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1170
- def _create_callbacks=(value); end
1171
-
1172
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1173
- def _destroy_callbacks; end
1174
-
1175
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1176
- def _destroy_callbacks=(value); end
1177
-
1178
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1179
- def _format; end
1180
-
1181
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1182
- def _format=(new_value); end
1183
-
1184
- # source://activeresource//lib/active_resource/base.rb#330
1185
- def _format?; end
1186
-
1187
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1188
- def _headers; end
1189
-
1190
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1191
- def _headers=(value); end
1192
-
1193
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1194
- def _headers_defined?; end
1195
-
1196
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1197
- def _password; end
1198
-
1199
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1200
- def _password=(value); end
1201
-
1202
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1203
- def _password_defined?; end
1204
-
1205
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1206
- def _proxy; end
1207
-
1208
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1209
- def _proxy=(value); end
1210
-
1211
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1212
- def _proxy_defined?; end
1213
-
1214
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1215
- def _save_callbacks; end
1216
-
1217
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1218
- def _save_callbacks=(value); end
1219
-
1220
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1221
- def _site; end
1222
-
1223
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1224
- def _site=(value); end
1225
-
1226
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1227
- def _site_defined?; end
1228
-
1229
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1230
- def _update_callbacks; end
1231
-
1232
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1233
- def _update_callbacks=(value); end
1234
-
1235
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#15
1236
- def _user; end
1237
-
1238
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#19
1239
- def _user=(value); end
1240
-
1241
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#23
1242
- def _user_defined?; end
1243
-
1244
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1245
- def _validate_callbacks; end
1246
-
1247
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1248
- def _validate_callbacks=(value); end
1249
-
1250
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#915
1251
- def _validation_callbacks; end
1252
-
1253
- # source://activesupport/8.0.0/lib/active_support/callbacks.rb#919
1254
- def _validation_callbacks=(value); end
1255
-
1256
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1257
- def _validators; end
1258
-
1259
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1260
- def _validators=(new_value); end
1261
-
1262
- # source://activemodel/8.0.0/lib/active_model/validations.rb#50
1263
- def _validators?; end
1264
-
1265
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#144
1266
- def after_create(*args, **options, &block); end
1267
-
1268
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#144
1269
- def after_destroy(*args, **options, &block); end
1270
-
1271
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#144
1272
- def after_save(*args, **options, &block); end
1273
-
1274
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#144
1275
- def after_update(*args, **options, &block); end
1276
-
1277
- # This is an alias for find(:all). You can pass in all the same
1278
- # arguments to this method as you can to <tt>find(:all)</tt>
1279
- #
1280
- # source://activeresource//lib/active_resource/base.rb#1039
1281
- def all(*args); end
1282
-
1283
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#137
1284
- def around_create(*args, **options, &block); end
1285
-
1286
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#137
1287
- def around_destroy(*args, **options, &block); end
1288
-
1289
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#137
1290
- def around_save(*args, **options, &block); end
1291
-
1292
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#137
1293
- def around_update(*args, **options, &block); end
1294
-
1295
- # source://activeresource//lib/active_resource/base.rb#562
1296
- def auth_type; end
1297
-
1298
- # source://activeresource//lib/active_resource/base.rb#568
1299
- def auth_type=(auth_type); end
1300
-
1301
- # Gets the \bearer_token for REST HTTP authentication.
1302
- #
1303
- # source://activeresource//lib/active_resource/base.rb#547
1304
- def bearer_token; end
1305
-
1306
- # Sets the \bearer_token for REST HTTP authentication.
1307
- #
1308
- # source://activeresource//lib/active_resource/base.rb#557
1309
- def bearer_token=(bearer_token); end
1310
-
1311
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#130
1312
- def before_create(*args, **options, &block); end
1313
-
1314
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#130
1315
- def before_destroy(*args, **options, &block); end
1316
-
1317
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#130
1318
- def before_save(*args, **options, &block); end
1319
-
1320
- # source://activemodel/8.0.0/lib/active_model/callbacks.rb#130
1321
- def before_update(*args, **options, &block); end
1322
-
1323
- # Builds a new, unsaved record using the default values from the remote server so
1324
- # that it can be used with RESTful forms.
1325
- #
1326
- # ==== Options
1327
- # * +attributes+ - A hash that overrides the default values from the server.
1328
- #
1329
- # Returns the new resource instance.
1330
- #
1331
- # source://activeresource//lib/active_resource/base.rb#899
1332
- def build(attributes = T.unsafe(nil)); end
1333
-
1334
- # source://active_cached_resource/0.1.0/lib/active_cached_resource/model.rb#11
1335
- def cached_resource(options = T.unsafe(nil)); end
1336
-
1337
- # source://active_cached_resource/0.1.0/lib/active_cached_resource/model.rb#9
1338
- def cached_resource=(_arg0); end
1339
-
1340
- # source://activeresource//lib/active_resource/base.rb#714
1341
- def collection_name; end
1342
-
1343
- # Sets the attribute collection_name
1344
- #
1345
- # @param value the value to set the attribute collection_name to.
1346
- #
1347
- # source://activeresource//lib/active_resource/base.rb#712
1348
- def collection_name=(_arg0); end
1349
-
1350
- # source://activeresource//lib/active_resource/base.rb#601
1351
- def collection_parser; end
1352
-
1353
- # Sets the parser to use when a collection is returned. The parser must be Enumerable.
1354
- #
1355
- # source://activeresource//lib/active_resource/base.rb#596
1356
- def collection_parser=(parser_instance); end
1357
-
1358
- # Gets the collection path for the REST resources. If the +query_options+ parameter is omitted, Rails
1359
- # will split from the +prefix_options+.
1360
- #
1361
- # ==== Options
1362
- # * +prefix_options+ - A hash to add a prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
1363
- # would yield a URL like <tt>/accounts/19/purchases.json</tt>).
1364
- # * +query_options+ - A hash to add items to the query string for the request.
1365
- #
1366
- # ==== Examples
1367
- # Post.collection_path
1368
- # # => /posts.json
1369
- #
1370
- # Comment.collection_path(:post_id => 5)
1371
- # # => /posts/5/comments.json
1372
- #
1373
- # Comment.collection_path(:post_id => 5, :active => 1)
1374
- # # => /posts/5/comments.json?active=1
1375
- #
1376
- # Comment.collection_path({:post_id => 5}, {:active => 1})
1377
- # # => /posts/5/comments.json?active=1
1378
- #
1379
- # source://activeresource//lib/active_resource/base.rb#883
1380
- def collection_path(prefix_options = T.unsafe(nil), query_options = T.unsafe(nil)); end
1381
-
1382
- # An instance of ActiveResource::Connection that is the base \connection to the remote service.
1383
- # The +refresh+ parameter toggles whether or not the \connection is refreshed at every request
1384
- # or not (defaults to <tt>false</tt>).
1385
- #
1386
- # source://activeresource//lib/active_resource/base.rb#678
1387
- def connection(refresh = T.unsafe(nil)); end
1388
-
1389
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1390
- def connection_class; end
1391
-
1392
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1393
- def connection_class=(new_value); end
1394
-
1395
- # source://activeresource//lib/active_resource/base.rb#335
1396
- def connection_class?; end
1397
-
1398
- # Creates a new resource instance and makes a request to the remote service
1399
- # that it be saved, making it equivalent to the following simultaneous calls:
1400
- #
1401
- # ryan = Person.new(:first => 'ryan')
1402
- # ryan.save
1403
- #
1404
- # Returns the newly created resource. If a failure has occurred an
1405
- # exception will be raised (see <tt>save</tt>). If the resource is invalid and
1406
- # has not been saved then <tt>valid?</tt> will return <tt>false</tt>,
1407
- # while <tt>new?</tt> will still return <tt>true</tt>.
1408
- #
1409
- # ==== Examples
1410
- # Person.create(:name => 'Jeremy', :email => 'myname@nospam.com', :enabled => true)
1411
- # my_person = Person.find(:first)
1412
- # my_person.email # => myname@nospam.com
1413
- #
1414
- # dhh = Person.create(:name => 'David', :email => 'dhh@nospam.com', :enabled => true)
1415
- # dhh.valid? # => true
1416
- # dhh.new? # => false
1417
- #
1418
- # # We'll assume that there's a validation that requires the name attribute
1419
- # that_guy = Person.create(:name => '', :email => 'thatguy@nospam.com', :enabled => true)
1420
- # that_guy.valid? # => false
1421
- # that_guy.new? # => true
1422
- #
1423
- # source://activeresource//lib/active_resource/base.rb#928
1424
- def create(attributes = T.unsafe(nil)); end
1425
-
1426
- # Creates a new resource (just like <tt>create</tt>) and makes a request to the
1427
- # remote service that it be saved, but runs validations and raises
1428
- # <tt>ActiveResource::ResourceInvalid</tt>, making it equivalent to the following
1429
- # simultaneous calls:
1430
- #
1431
- # ryan = Person.new(:first => 'ryan')
1432
- # ryan.save!
1433
- #
1434
- # source://activeresource//lib/active_resource/base.rb#939
1435
- def create!(attributes = T.unsafe(nil)); end
1436
-
1437
- # Deletes the resources with the ID in the +id+ parameter.
1438
- #
1439
- # ==== Options
1440
- # All options specify \prefix and query parameters.
1441
- #
1442
- # ==== Examples
1443
- # Event.delete(2) # sends DELETE /events/2
1444
- #
1445
- # Event.create(:name => 'Free Concert', :location => 'Community Center')
1446
- # my_event = Event.find(:first) # let's assume this is event with ID 7
1447
- # Event.delete(my_event.id) # sends DELETE /events/7
1448
- #
1449
- # # Let's assume a request to events/5/cancel.json
1450
- # Event.delete(params[:id]) # sends DELETE /events/5
1451
- #
1452
- # source://activeresource//lib/active_resource/custom_methods.rb#76
1453
- def delete(custom_method_name, options = T.unsafe(nil)); end
1454
-
1455
- # source://activeresource//lib/active_resource/base.rb#708
1456
- def element_name; end
1457
-
1458
- # Sets the attribute element_name
1459
- #
1460
- # @param value the value to set the attribute element_name to.
1461
- #
1462
- # source://activeresource//lib/active_resource/base.rb#706
1463
- def element_name=(_arg0); end
1464
-
1465
- # Gets the element path for the given ID in +id+. If the +query_options+ parameter is omitted, Rails
1466
- # will split from the \prefix options.
1467
- #
1468
- # ==== Options
1469
- # +prefix_options+ - A \hash to add a \prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
1470
- # would yield a URL like <tt>/accounts/19/purchases.json</tt>).
1471
- #
1472
- # +query_options+ - A \hash to add items to the query string for the request.
1473
- #
1474
- # ==== Examples
1475
- # Post.element_path(1)
1476
- # # => /posts/1.json
1477
- #
1478
- # class Comment < ActiveResource::Base
1479
- # self.site = "https://37s.sunrise.com/posts/:post_id"
1480
- # end
1481
- #
1482
- # Comment.element_path(1, :post_id => 5)
1483
- # # => /posts/5/comments/1.json
1484
- #
1485
- # Comment.element_path(1, :post_id => 5, :active => 1)
1486
- # # => /posts/5/comments/1.json?active=1
1487
- #
1488
- # Comment.element_path(1, {:post_id => 5}, {:active => 1})
1489
- # # => /posts/5/comments/1.json?active=1
1490
- #
1491
- # source://activeresource//lib/active_resource/base.rb#805
1492
- def element_path(id, prefix_options = T.unsafe(nil), query_options = T.unsafe(nil)); end
1493
-
1494
- # Gets the element url for the given ID in +id+. If the +query_options+ parameter is omitted, Rails
1495
- # will split from the \prefix options.
1496
- #
1497
- # ==== Options
1498
- # +prefix_options+ - A \hash to add a \prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
1499
- # would yield a URL like <tt>https://37s.sunrise.com/accounts/19/purchases.json</tt>).
1500
- #
1501
- # +query_options+ - A \hash to add items to the query string for the request.
1502
- #
1503
- # ==== Examples
1504
- # Post.element_url(1)
1505
- # # => https://37s.sunrise.com/posts/1.json
1506
- #
1507
- # class Comment < ActiveResource::Base
1508
- # self.site = "https://37s.sunrise.com/posts/:post_id"
1509
- # end
1510
- #
1511
- # Comment.element_url(1, :post_id => 5)
1512
- # # => https://37s.sunrise.com/posts/5/comments/1.json
1513
- #
1514
- # Comment.element_url(1, :post_id => 5, :active => 1)
1515
- # # => https://37s.sunrise.com/posts/5/comments/1.json?active=1
1516
- #
1517
- # Comment.element_url(1, {:post_id => 5}, {:active => 1})
1518
- # # => https://37s.sunrise.com/posts/5/comments/1.json?active=1
1519
- #
1520
- # source://activeresource//lib/active_resource/base.rb#838
1521
- def element_url(id, prefix_options = T.unsafe(nil), query_options = T.unsafe(nil)); end
1522
-
1523
- # Asserts the existence of a resource, returning <tt>true</tt> if the resource is found.
1524
- #
1525
- # ==== Examples
1526
- # Note.create(:title => 'Hello, world.', :body => 'Nothing more for now...')
1527
- # Note.exists?(1) # => true
1528
- #
1529
- # Note.exists(1349) # => false
1530
- #
1531
- # @return [Boolean]
1532
- #
1533
- # source://activeresource//lib/active_resource/base.rb#1074
1534
- def exists?(id, options = T.unsafe(nil)); end
1535
-
1536
- # Core method for finding resources. Used similarly to Active Record's +find+ method.
1537
- #
1538
- # ==== Arguments
1539
- # The first argument is considered to be the scope of the query. That is, how many
1540
- # resources are returned from the request. It can be one of the following.
1541
- #
1542
- # * <tt>:one</tt> - Returns a single resource.
1543
- # * <tt>:first</tt> - Returns the first resource found.
1544
- # * <tt>:last</tt> - Returns the last resource found.
1545
- # * <tt>:all</tt> - Returns every resource that matches the request.
1546
- #
1547
- # ==== Options
1548
- #
1549
- # * <tt>:from</tt> - Sets the path or custom method that resources will be fetched from.
1550
- # * <tt>:params</tt> - Sets query and \prefix (nested URL) parameters.
1551
- #
1552
- # ==== Examples
1553
- # Person.find(1)
1554
- # # => GET /people/1.json
1555
- #
1556
- # Person.find(:all)
1557
- # # => GET /people.json
1558
- #
1559
- # Person.find(:all, :params => { :title => "CEO" })
1560
- # # => GET /people.json?title=CEO
1561
- #
1562
- # Person.find(:first, :from => :managers)
1563
- # # => GET /people/managers.json
1564
- #
1565
- # Person.find(:last, :from => :managers)
1566
- # # => GET /people/managers.json
1567
- #
1568
- # Person.find(:all, :from => "/companies/1/people.json")
1569
- # # => GET /companies/1/people.json
1570
- #
1571
- # Person.find(:one, :from => :leader)
1572
- # # => GET /people/leader.json
1573
- #
1574
- # Person.find(:all, :from => :developers, :params => { :language => 'ruby' })
1575
- # # => GET /people/developers.json?language=ruby
1576
- #
1577
- # Person.find(:one, :from => "/companies/1/manager.json")
1578
- # # => GET /companies/1/manager.json
1579
- #
1580
- # StreetAddress.find(1, :params => { :person_id => 1 })
1581
- # # => GET /people/1/street_addresses/1.json
1582
- #
1583
- # == Failure or missing data
1584
- # A failure to find the requested object raises a ResourceNotFound
1585
- # exception if the find was called with an id.
1586
- # With any other scope, find returns nil when no data is returned.
1587
- #
1588
- # Person.find(1)
1589
- # # => raises ResourceNotFound
1590
- #
1591
- # Person.find(:all)
1592
- # Person.find(:first)
1593
- # Person.find(:last)
1594
- # # => nil
1595
- #
1596
- # source://activeresource//lib/active_resource/base.rb#1002
1597
- def find(*arguments); end
1598
-
1599
- # A convenience wrapper for <tt>find(:first, *args)</tt>. You can pass
1600
- # in all the same arguments to this method as you can to
1601
- # <tt>find(:first)</tt>.
1602
- #
1603
- # source://activeresource//lib/active_resource/base.rb#1026
1604
- def first(*args); end
1605
-
1606
- # Returns the current format, default is ActiveResource::Formats::JsonFormat.
1607
- #
1608
- # source://activeresource//lib/active_resource/base.rb#591
1609
- def format; end
1610
-
1611
- # Sets the format that attributes are sent and received in from a mime type reference:
1612
- #
1613
- # Person.format = :json
1614
- # Person.find(1) # => GET /people/1.json
1615
- #
1616
- # Person.format = ActiveResource::Formats::XmlFormat
1617
- # Person.find(1) # => GET /people/1.xml
1618
- #
1619
- # Default format is <tt>:json</tt>.
1620
- #
1621
- # source://activeresource//lib/active_resource/base.rb#582
1622
- def format=(mime_type_reference_or_format); end
1623
-
1624
- # source://activeresource//lib/active_resource/base.rb#775
1625
- def format_extension; end
1626
-
1627
- # source://activeresource//lib/active_resource/custom_methods.rb#58
1628
- def get(custom_method_name, options = T.unsafe(nil)); end
1629
-
1630
- # source://activeresource//lib/active_resource/base.rb#698
1631
- def headers; end
1632
-
1633
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1634
- def include_format_in_path; end
1635
-
1636
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1637
- def include_format_in_path=(new_value); end
1638
-
1639
- # source://activeresource//lib/active_resource/base.rb#332
1640
- def include_format_in_path?; end
1641
-
1642
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1643
- def include_root_in_json; end
1644
-
1645
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1646
- def include_root_in_json=(new_value); end
1647
-
1648
- # source://activemodel/8.0.0/lib/active_model/serializers/json.rb#15
1649
- def include_root_in_json?; end
1650
-
1651
- # Returns the list of known attributes for this resource, gathered
1652
- # from the provided <tt>schema</tt>
1653
- # Attributes that are known will cause your resource to return 'true'
1654
- # when <tt>respond_to?</tt> is called on them. A known attribute will
1655
- # return nil if not set (rather than <tt>MethodNotFound</tt>); thus
1656
- # known attributes can be used with <tt>validates_presence_of</tt>
1657
- # without a getter-method.
1658
- #
1659
- # source://activeresource//lib/active_resource/base.rb#456
1660
- def known_attributes; end
1661
-
1662
- # A convenience wrapper for <tt>find(:last, *args)</tt>. You can pass
1663
- # in all the same arguments to this method as you can to
1664
- # <tt>find(:last)</tt>.
1665
- #
1666
- # source://activeresource//lib/active_resource/base.rb#1033
1667
- def last(*args); end
1668
-
1669
- # source://activeresource//lib/active_resource/base.rb#323
1670
- def logger; end
1671
-
1672
- # source://activeresource//lib/active_resource/base.rb#325
1673
- def logger=(logger); end
1674
-
1675
- # Gets the new element path for REST resources.
1676
- #
1677
- # ==== Options
1678
- # * +prefix_options+ - A hash to add a prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
1679
- # would yield a URL like <tt>/accounts/19/purchases/new.json</tt>).
1680
- #
1681
- # ==== Examples
1682
- # Post.new_element_path
1683
- # # => /posts/new.json
1684
- #
1685
- # class Comment < ActiveResource::Base
1686
- # self.site = "https://37s.sunrise.com/posts/:post_id"
1687
- # end
1688
- #
1689
- # Comment.collection_path(:post_id => 5)
1690
- # # => /posts/5/comments/new.json
1691
- #
1692
- # source://activeresource//lib/active_resource/base.rb#858
1693
- def new_element_path(prefix_options = T.unsafe(nil)); end
1694
-
1695
- # Gets the number of seconds after which connection attempts to the REST API should time out.
1696
- #
1697
- # source://activeresource//lib/active_resource/base.rb#633
1698
- def open_timeout; end
1699
-
1700
- # Sets the number of seconds after which connection attempts to the REST API should time out.
1701
- #
1702
- # source://activeresource//lib/active_resource/base.rb#612
1703
- def open_timeout=(timeout); end
1704
-
1705
- # source://activeresource//lib/active_resource/base.rb#1063
1706
- def orig_delete(id, options = T.unsafe(nil)); end
1707
-
1708
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1709
- def param_delimiter; end
1710
-
1711
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1712
- def param_delimiter=(new_value); end
1713
-
1714
- # source://activemodel/8.0.0/lib/active_model/conversion.rb#32
1715
- def param_delimiter?; end
1716
-
1717
- # Gets the \password for REST HTTP authentication.
1718
- #
1719
- # source://activeresource//lib/active_resource/base.rb#531
1720
- def password; end
1721
-
1722
- # Sets the \password for REST HTTP authentication.
1723
- #
1724
- # source://activeresource//lib/active_resource/base.rb#541
1725
- def password=(password); end
1726
-
1727
- # source://activeresource//lib/active_resource/custom_methods.rb#68
1728
- def patch(custom_method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
1729
-
1730
- # source://activeresource//lib/active_resource/custom_methods.rb#64
1731
- def post(custom_method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
1732
-
1733
- # Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>)
1734
- # This method is regenerated at runtime based on what the \prefix is set to.
1735
- #
1736
- # source://activeresource//lib/active_resource/base.rb#734
1737
- def prefix(options = T.unsafe(nil)); end
1738
-
1739
- # Sets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>).
1740
- # Default value is <tt>site.path</tt>.
1741
- #
1742
- # source://activeresource//lib/active_resource/base.rb#751
1743
- def prefix=(value = T.unsafe(nil)); end
1744
-
1745
- # An attribute reader for the source string for the resource path \prefix. This
1746
- # method is regenerated at runtime based on what the \prefix is set to.
1747
- #
1748
- # source://activeresource//lib/active_resource/base.rb#744
1749
- def prefix_source; end
1750
-
1751
- # source://activeresource//lib/active_resource/base.rb#720
1752
- def primary_key; end
1753
-
1754
- # Sets the attribute primary_key
1755
- #
1756
- # @param value the value to set the attribute primary_key to.
1757
- #
1758
- # source://activeresource//lib/active_resource/base.rb#718
1759
- def primary_key=(_arg0); end
1760
-
1761
- # Gets the \proxy variable if a proxy is required
1762
- #
1763
- # source://activeresource//lib/active_resource/base.rb#499
1764
- def proxy; end
1765
-
1766
- # Sets the URI of the http proxy to the value in the +proxy+ argument.
1767
- #
1768
- # source://activeresource//lib/active_resource/base.rb#509
1769
- def proxy=(proxy); end
1770
-
1771
- # source://activeresource//lib/active_resource/custom_methods.rb#72
1772
- def put(custom_method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
1773
-
1774
- # Gets the number of seconds after which reads to the REST API should time out.
1775
- #
1776
- # source://activeresource//lib/active_resource/base.rb#642
1777
- def read_timeout; end
1778
-
1779
- # Sets the number of seconds after which reads to the REST API should time out.
1780
- #
1781
- # source://activeresource//lib/active_resource/base.rb#618
1782
- def read_timeout=(timeout); end
1783
-
1784
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#12
1785
- def reflections; end
1786
-
1787
- # source://activesupport/8.0.0/lib/active_support/class_attribute.rb#15
1788
- def reflections=(new_value); end
1789
-
1790
- # source://activeresource//lib/active_resource/reflection.rb#16
1791
- def reflections?; end
1792
-
1793
- # Creates a schema for this resource - setting the attributes that are
1794
- # known prior to fetching an instance from the remote system.
1795
- #
1796
- # The schema helps define the set of <tt>known_attributes</tt> of the
1797
- # current resource.
1798
- #
1799
- # There is no need to specify a schema for your Active Resource. If
1800
- # you do not, the <tt>known_attributes</tt> will be guessed from the
1801
- # instance attributes returned when an instance is fetched from the
1802
- # remote system.
1803
- #
1804
- # example:
1805
- # class Person < ActiveResource::Base
1806
- # schema do
1807
- # # define each attribute separately
1808
- # attribute 'name', :string
1809
- #
1810
- # # or use the convenience methods and pass >=1 attribute names
1811
- # string 'eye_color', 'hair_color'
1812
- # integer 'age'
1813
- # float 'height', 'weight'
1814
- #
1815
- # # unsupported types should be left as strings
1816
- # # overload the accessor methods if you need to convert them
1817
- # attribute 'created_at', 'string'
1818
- # end
1819
- # end
1820
- #
1821
- # p = Person.new
1822
- # p.respond_to? :name # => true
1823
- # p.respond_to? :age # => true
1824
- # p.name # => nil
1825
- # p.age # => nil
1826
- #
1827
- # j = Person.find_by_name('John')
1828
- # <person><name>John</name><age>34</age><num_children>3</num_children></person>
1829
- # j.respond_to? :name # => true
1830
- # j.respond_to? :age # => true
1831
- # j.name # => 'John'
1832
- # j.age # => '34' # note this is a string!
1833
- # j.num_children # => '3' # note this is a string!
1834
- #
1835
- # p.num_children # => NoMethodError
1836
- #
1837
- # Attribute-types must be one of: <tt>string, text, integer, float, decimal, datetime, timestamp, time, date, binary, boolean</tt>
1838
- #
1839
- # Note: at present the attribute-type doesn't do anything, but stay
1840
- # tuned...
1841
- # Shortly it will also *cast* the value of the returned attribute.
1842
- # ie:
1843
- # j.age # => 34 # cast to an integer
1844
- # j.weight # => '65' # still a string!
1845
- #
1846
- # source://activeresource//lib/active_resource/base.rb#395
1847
- def schema(&block); end
1848
-
1849
- # Alternative, direct way to specify a <tt>schema</tt> for this
1850
- # Resource. <tt>schema</tt> is more flexible, but this is quick
1851
- # for a very simple schema.
1852
- #
1853
- # Pass the schema as a hash with the keys being the attribute-names
1854
- # and the value being one of the accepted attribute types (as defined
1855
- # in <tt>schema</tt>)
1856
- #
1857
- # example:
1858
- #
1859
- # class Person < ActiveResource::Base
1860
- # self.schema = {'name' => :string, 'age' => :integer }
1861
- # end
1862
- #
1863
- # The keys/values can be strings or symbols. They will be converted to
1864
- # strings.
1865
- #
1866
- # @raise [ArgumentError]
1867
- #
1868
- # source://activeresource//lib/active_resource/base.rb#434
1869
- def schema=(the_schema); end
1870
-
1871
- # Sets the attribute collection_name
1872
- #
1873
- # @param value the value to set the attribute collection_name to.
1874
- #
1875
- # source://activeresource//lib/active_resource/base.rb#712
1876
- def set_collection_name(_arg0); end
1877
-
1878
- # Sets the attribute element_name
1879
- #
1880
- # @param value the value to set the attribute element_name to.
1881
- #
1882
- # source://activeresource//lib/active_resource/base.rb#706
1883
- def set_element_name(_arg0); end
1884
-
1885
- # Sets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>).
1886
- # Default value is <tt>site.path</tt>.
1887
- #
1888
- # source://activeresource//lib/active_resource/base.rb#751
1889
- def set_prefix(value = T.unsafe(nil)); end
1890
-
1891
- # Sets the attribute primary_key
1892
- #
1893
- # @param value the value to set the attribute primary_key to.
1894
- #
1895
- # source://activeresource//lib/active_resource/base.rb#718
1896
- def set_primary_key(_arg0); end
1897
-
1898
- # source://active_cached_resource/0.1.0/lib/active_cached_resource/model.rb#15
1899
- def setup_cached_resource!(options); end
1900
-
1901
- # Gets the URI of the REST resources to map for this class. The site variable is required for
1902
- # Active Resource's mapping to work.
1903
- #
1904
- # source://activeresource//lib/active_resource/base.rb#462
1905
- def site; end
1906
-
1907
- # Sets the URI of the REST resources to map for this class to the value in the +site+ argument.
1908
- # The site variable is required for Active Resource's mapping to work.
1909
- #
1910
- # source://activeresource//lib/active_resource/base.rb#487
1911
- def site=(site); end
1912
-
1913
- # Returns the SSL options hash.
1914
- #
1915
- # source://activeresource//lib/active_resource/base.rb#667
1916
- def ssl_options; end
1917
-
1918
- # Options that will get applied to an SSL connection.
1919
- #
1920
- # * <tt>:key</tt> - An OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
1921
- # * <tt>:cert</tt> - An OpenSSL::X509::Certificate object as client certificate
1922
- # * <tt>:ca_file</tt> - Path to a CA certification file in PEM format. The file can contain several CA certificates.
1923
- # * <tt>:ca_path</tt> - Path of a CA certification directory containing certifications in PEM format.
1924
- # * <tt>:verify_mode</tt> - Flags for server the certification verification at beginning of SSL/TLS session. (OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable)
1925
- # * <tt>:verify_callback</tt> - The verify callback for the server certification verification.
1926
- # * <tt>:verify_depth</tt> - The maximum depth for the certificate chain verification.
1927
- # * <tt>:cert_store</tt> - OpenSSL::X509::Store to verify peer certificate.
1928
- # * <tt>:ssl_timeout</tt> -The SSL timeout in seconds.
1929
- #
1930
- # source://activeresource//lib/active_resource/base.rb#661
1931
- def ssl_options=(options); end
1932
-
1933
- # Gets the number of seconds after which requests to the REST API should time out.
1934
- #
1935
- # source://activeresource//lib/active_resource/base.rb#624
1936
- def timeout; end
1937
-
1938
- # Sets the number of seconds after which requests to the REST API should time out.
1939
- #
1940
- # source://activeresource//lib/active_resource/base.rb#606
1941
- def timeout=(timeout); end
1942
-
1943
- # Gets the \user for REST HTTP authentication.
1944
- #
1945
- # source://activeresource//lib/active_resource/base.rb#515
1946
- def user; end
1947
-
1948
- # Sets the \user for REST HTTP authentication.
1949
- #
1950
- # source://activeresource//lib/active_resource/base.rb#525
1951
- def user=(user); end
1952
-
1953
- # @raise [ArgumentError]
1954
- #
1955
- # source://activeresource//lib/active_resource/base.rb#1043
1956
- def where(clauses = T.unsafe(nil)); end
1957
-
1958
- private
1959
-
1960
- # source://activeresource//lib/active_resource/base.rb#1087
1961
- def check_prefix_options(prefix_options); end
1962
-
1963
- # Accepts a URI and creates the proxy URI from that.
1964
- #
1965
- # source://activeresource//lib/active_resource/base.rb#1156
1966
- def create_proxy_uri_from(proxy); end
1967
-
1968
- # Accepts a URI and creates the site URI from that.
1969
- #
1970
- # source://activeresource//lib/active_resource/base.rb#1151
1971
- def create_site_uri_from(site); end
1972
-
1973
- # Find every resource
1974
- #
1975
- # source://activeresource//lib/active_resource/base.rb#1095
1976
- def find_every(options); end
1977
-
1978
- # Find a single resource from a one-off URL
1979
- #
1980
- # source://activeresource//lib/active_resource/base.rb#1119
1981
- def find_one(options); end
1982
-
1983
- # Find a single resource from the default URL
1984
- #
1985
- # source://activeresource//lib/active_resource/base.rb#1130
1986
- def find_single(scope, options); end
1987
-
1988
- # source://activeresource//lib/active_resource/base.rb#1136
1989
- def instantiate_collection(collection, original_params = T.unsafe(nil), prefix_options = T.unsafe(nil)); end
1990
-
1991
- # source://activeresource//lib/active_resource/base.rb#1143
1992
- def instantiate_record(record, prefix_options = T.unsafe(nil)); end
1993
-
1994
- # contains a set of the current prefix parameters.
1995
- #
1996
- # source://activeresource//lib/active_resource/base.rb#1161
1997
- def prefix_parameters; end
1998
-
1999
- # Builds the query string for the request.
2000
- #
2001
- # source://activeresource//lib/active_resource/base.rb#1166
2002
- def query_string(options); end
2003
-
2004
- # split an option hash into two hashes, one containing the prefix options,
2005
- # and the other containing the leftovers.
2006
- #
2007
- # source://activeresource//lib/active_resource/base.rb#1172
2008
- def split_options(options = T.unsafe(nil)); end
2009
- end
2010
- end
2011
-
2012
- # source://activeresource//lib/active_resource/callbacks.rb#6
2013
- module ActiveResource::Callbacks
2014
- extend ::ActiveSupport::Concern
2015
- include GeneratedInstanceMethods
2016
- include ::ActiveSupport::Callbacks
2017
- include ::ActiveModel::Validations::Callbacks
2018
-
2019
- mixes_in_class_methods GeneratedClassMethods
2020
- mixes_in_class_methods ::ActiveModel::Callbacks
2021
- mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods
2022
- mixes_in_class_methods ::ActiveSupport::DescendantsTracker
2023
- mixes_in_class_methods ::ActiveModel::Validations::Callbacks::ClassMethods
2024
-
2025
- module GeneratedClassMethods
2026
- def __callbacks; end
2027
- def __callbacks=(value); end
2028
- end
2029
-
2030
- module GeneratedInstanceMethods
2031
- def __callbacks; end
2032
- end
2033
- end
2034
-
2035
- # source://activeresource//lib/active_resource/callbacks.rb#9
2036
- ActiveResource::Callbacks::CALLBACKS = T.let(T.unsafe(nil), Array)
2037
-
2038
- # 4xx Client Error
2039
- #
2040
- # source://activeresource//lib/active_resource/exceptions.rb#49
2041
- class ActiveResource::ClientError < ::ActiveResource::ConnectionError; end
2042
-
2043
- # source://activeresource//lib/active_resource/collection.rb#7
2044
- class ActiveResource::Collection
2045
- include ::Enumerable
2046
-
2047
- # ActiveResource::Collection is a wrapper to handle parsing index responses that
2048
- # do not directly map to Rails conventions.
2049
- #
2050
- # You can define a custom class that inherits from ActiveResource::Collection
2051
- # in order to to set the elements instance.
2052
- #
2053
- # GET /posts.json delivers following response body:
2054
- # {
2055
- # posts: [
2056
- # {
2057
- # title: "ActiveResource now has associations",
2058
- # body: "Lorem Ipsum"
2059
- # },
2060
- # {...}
2061
- # ],
2062
- # next_page: "/posts.json?page=2"
2063
- # }
2064
- #
2065
- # A Post class can be setup to handle it with:
2066
- #
2067
- # class Post < ActiveResource::Base
2068
- # self.site = "http://example.com"
2069
- # self.collection_parser = PostCollection
2070
- # end
2071
- #
2072
- # And the collection parser:
2073
- #
2074
- # class PostCollection < ActiveResource::Collection
2075
- # attr_accessor :next_page
2076
- # def initialize(parsed = {})
2077
- # @elements = parsed['posts']
2078
- # @next_page = parsed['next_page']
2079
- # end
2080
- # end
2081
- #
2082
- # The result from a find method that returns multiple entries will now be a
2083
- # PostParser instance. ActiveResource::Collection includes Enumerable and
2084
- # instances can be iterated over just like an array.
2085
- # @posts = Post.find(:all) # => PostCollection:xxx
2086
- # @posts.next_page # => "/posts.json?page=2"
2087
- # @posts.map(&:id) # =>[1, 3, 5 ...]
2088
- #
2089
- # The initialize method will receive the ActiveResource::Formats parsed result
2090
- # and should set @elements.
2091
- #
2092
- # @return [Collection] a new instance of Collection
2093
- #
2094
- # source://activeresource//lib/active_resource/collection.rb#59
2095
- def initialize(elements = T.unsafe(nil)); end
2096
-
2097
- # source://activeresource//lib/active_resource/collection.rb#10
2098
- def &(*_arg0, **_arg1, &_arg2); end
2099
-
2100
- # source://activeresource//lib/active_resource/collection.rb#10
2101
- def *(*_arg0, **_arg1, &_arg2); end
2102
-
2103
- # source://activeresource//lib/active_resource/collection.rb#10
2104
- def +(*_arg0, **_arg1, &_arg2); end
2105
-
2106
- # source://activeresource//lib/active_resource/collection.rb#10
2107
- def -(*_arg0, **_arg1, &_arg2); end
2108
-
2109
- # source://activeresource//lib/active_resource/collection.rb#10
2110
- def <<(*_arg0, **_arg1, &_arg2); end
2111
-
2112
- # source://activeresource//lib/active_resource/collection.rb#10
2113
- def <=>(*_arg0, **_arg1, &_arg2); end
2114
-
2115
- # source://activeresource//lib/active_resource/collection.rb#10
2116
- def ==(arg); end
2117
-
2118
- # source://activeresource//lib/active_resource/collection.rb#10
2119
- def [](*_arg0, **_arg1, &_arg2); end
2120
-
2121
- # source://activeresource//lib/active_resource/collection.rb#10
2122
- def []=(*_arg0, **_arg1, &_arg2); end
2123
-
2124
- # source://activeresource//lib/active_resource/collection.rb#10
2125
- def all?(*_arg0, **_arg1, &_arg2); end
2126
-
2127
- # source://activeresource//lib/active_resource/collection.rb#10
2128
- def any?(*_arg0, **_arg1, &_arg2); end
2129
-
2130
- # source://activeresource//lib/active_resource/collection.rb#10
2131
- def append(*_arg0, **_arg1, &_arg2); end
2132
-
2133
- # source://activeresource//lib/active_resource/collection.rb#10
2134
- def as_json(*_arg0, **_arg1, &_arg2); end
2135
-
2136
- # source://activeresource//lib/active_resource/collection.rb#10
2137
- def assoc(*_arg0, **_arg1, &_arg2); end
2138
-
2139
- # source://activeresource//lib/active_resource/collection.rb#10
2140
- def at(*_arg0, **_arg1, &_arg2); end
2141
-
2142
- # source://activeresource//lib/active_resource/collection.rb#10
2143
- def blank?(*_arg0, **_arg1, &_arg2); end
2144
-
2145
- # source://activeresource//lib/active_resource/collection.rb#10
2146
- def bsearch(*_arg0, **_arg1, &_arg2); end
2147
-
2148
- # source://activeresource//lib/active_resource/collection.rb#10
2149
- def bsearch_index(*_arg0, **_arg1, &_arg2); end
2150
-
2151
- # source://activeresource//lib/active_resource/collection.rb#10
2152
- def clear(*_arg0, **_arg1, &_arg2); end
2153
-
2154
- # source://activeresource//lib/active_resource/collection.rb#10
2155
- def collect(*_arg0, **_arg1, &_arg2); end
2156
-
2157
- # source://activeresource//lib/active_resource/collection.rb#67
2158
- def collect!; end
2159
-
2160
- # source://activeresource//lib/active_resource/collection.rb#10
2161
- def combination(*_arg0, **_arg1, &_arg2); end
2162
-
2163
- # source://activeresource//lib/active_resource/collection.rb#10
2164
- def compact(*_arg0, **_arg1, &_arg2); end
2165
-
2166
- # source://activeresource//lib/active_resource/collection.rb#10
2167
- def compact!(*_arg0, **_arg1, &_arg2); end
2168
-
2169
- # source://activeresource//lib/active_resource/collection.rb#10
2170
- def compact_blank!(*_arg0, **_arg1, &_arg2); end
2171
-
2172
- # source://activeresource//lib/active_resource/collection.rb#10
2173
- def concat(*_arg0, **_arg1, &_arg2); end
2174
-
2175
- # source://activeresource//lib/active_resource/collection.rb#10
2176
- def count(*_arg0, **_arg1, &_arg2); end
2177
-
2178
- # source://activeresource//lib/active_resource/collection.rb#10
2179
- def cycle(*_arg0, **_arg1, &_arg2); end
2180
-
2181
- # source://activeresource//lib/active_resource/collection.rb#10
2182
- def deconstruct(*_arg0, **_arg1, &_arg2); end
2183
-
2184
- # source://activeresource//lib/active_resource/collection.rb#10
2185
- def deep_dup(*_arg0, **_arg1, &_arg2); end
2186
-
2187
- # source://activeresource//lib/active_resource/collection.rb#10
2188
- def delete(*_arg0, **_arg1, &_arg2); end
2189
-
2190
- # source://activeresource//lib/active_resource/collection.rb#10
2191
- def delete_at(*_arg0, **_arg1, &_arg2); end
2192
-
2193
- # source://activeresource//lib/active_resource/collection.rb#10
2194
- def delete_if(*_arg0, **_arg1, &_arg2); end
2195
-
2196
- # source://activeresource//lib/active_resource/collection.rb#10
2197
- def difference(*_arg0, **_arg1, &_arg2); end
2198
-
2199
- # source://activeresource//lib/active_resource/collection.rb#10
2200
- def dig(*_arg0, **_arg1, &_arg2); end
2201
-
2202
- # source://activeresource//lib/active_resource/collection.rb#10
2203
- def drop(*_arg0, **_arg1, &_arg2); end
2204
-
2205
- # source://activeresource//lib/active_resource/collection.rb#10
2206
- def drop_while(*_arg0, **_arg1, &_arg2); end
2207
-
2208
- # source://activeresource//lib/active_resource/collection.rb#10
2209
- def each(*_arg0, **_arg1, &_arg2); end
2210
-
2211
- # source://activeresource//lib/active_resource/collection.rb#10
2212
- def each_index(*_arg0, **_arg1, &_arg2); end
2213
-
2214
- # The array of actual elements returned by index actions
2215
- #
2216
- # source://activeresource//lib/active_resource/collection.rb#13
2217
- def elements; end
2218
-
2219
- # The array of actual elements returned by index actions
2220
- #
2221
- # source://activeresource//lib/active_resource/collection.rb#13
2222
- def elements=(_arg0); end
2223
-
2224
- # source://activeresource//lib/active_resource/collection.rb#10
2225
- def empty?(*_arg0, **_arg1, &_arg2); end
2226
-
2227
- # source://activeresource//lib/active_resource/collection.rb#10
2228
- def eql?(*_arg0, **_arg1, &_arg2); end
2229
-
2230
- # source://activeresource//lib/active_resource/collection.rb#10
2231
- def excluding(*_arg0, **_arg1, &_arg2); end
2232
-
2233
- # source://activeresource//lib/active_resource/collection.rb#10
2234
- def extract!(*_arg0, **_arg1, &_arg2); end
2235
-
2236
- # source://activeresource//lib/active_resource/collection.rb#10
2237
- def extract_options!(*_arg0, **_arg1, &_arg2); end
2238
-
2239
- # source://activeresource//lib/active_resource/collection.rb#10
2240
- def fetch(*_arg0, **_arg1, &_arg2); end
2241
-
2242
- # source://activeresource//lib/active_resource/collection.rb#10
2243
- def fifth(*_arg0, **_arg1, &_arg2); end
2244
-
2245
- # source://activeresource//lib/active_resource/collection.rb#10
2246
- def fill(*_arg0, **_arg1, &_arg2); end
2247
-
2248
- # source://activeresource//lib/active_resource/collection.rb#10
2249
- def filter(*_arg0, **_arg1, &_arg2); end
2250
-
2251
- # source://activeresource//lib/active_resource/collection.rb#10
2252
- def filter!(*_arg0, **_arg1, &_arg2); end
2253
-
2254
- # source://activeresource//lib/active_resource/collection.rb#10
2255
- def find_index(*_arg0, **_arg1, &_arg2); end
2256
-
2257
- # source://activeresource//lib/active_resource/collection.rb#10
2258
- def first(*_arg0, **_arg1, &_arg2); end
2259
-
2260
- # source://activeresource//lib/active_resource/collection.rb#76
2261
- def first_or_create(attributes = T.unsafe(nil)); end
2262
-
2263
- # source://activeresource//lib/active_resource/collection.rb#82
2264
- def first_or_initialize(attributes = T.unsafe(nil)); end
2265
-
2266
- # source://activeresource//lib/active_resource/collection.rb#10
2267
- def flatten(*_arg0, **_arg1, &_arg2); end
2268
-
2269
- # source://activeresource//lib/active_resource/collection.rb#10
2270
- def flatten!(*_arg0, **_arg1, &_arg2); end
2271
-
2272
- # source://activeresource//lib/active_resource/collection.rb#10
2273
- def forty_two(*_arg0, **_arg1, &_arg2); end
2274
-
2275
- # source://activeresource//lib/active_resource/collection.rb#10
2276
- def fourth(*_arg0, **_arg1, &_arg2); end
2277
-
2278
- # source://activeresource//lib/active_resource/collection.rb#10
2279
- def from(*_arg0, **_arg1, &_arg2); end
2280
-
2281
- # source://activeresource//lib/active_resource/collection.rb#10
2282
- def hash(*_arg0, **_arg1, &_arg2); end
2283
-
2284
- # source://activeresource//lib/active_resource/collection.rb#10
2285
- def in_groups(*_arg0, **_arg1, &_arg2); end
2286
-
2287
- # source://activeresource//lib/active_resource/collection.rb#10
2288
- def in_groups_of(*_arg0, **_arg1, &_arg2); end
2289
-
2290
- # source://activeresource//lib/active_resource/collection.rb#10
2291
- def include?(*_arg0, **_arg1, &_arg2); end
2292
-
2293
- # source://activeresource//lib/active_resource/collection.rb#10
2294
- def including(*_arg0, **_arg1, &_arg2); end
2295
-
2296
- # source://activeresource//lib/active_resource/collection.rb#10
2297
- def index(*_arg0, **_arg1, &_arg2); end
2298
-
2299
- # source://activeresource//lib/active_resource/collection.rb#10
2300
- def inquiry(*_arg0, **_arg1, &_arg2); end
2301
-
2302
- # source://activeresource//lib/active_resource/collection.rb#10
2303
- def insert(*_arg0, **_arg1, &_arg2); end
2304
-
2305
- # source://activeresource//lib/active_resource/collection.rb#10
2306
- def inspect(*_arg0, **_arg1, &_arg2); end
2307
-
2308
- # source://activeresource//lib/active_resource/collection.rb#10
2309
- def intersect?(*_arg0, **_arg1, &_arg2); end
2310
-
2311
- # source://activeresource//lib/active_resource/collection.rb#10
2312
- def intersection(*_arg0, **_arg1, &_arg2); end
2313
-
2314
- # source://activeresource//lib/active_resource/collection.rb#10
2315
- def join(*_arg0, **_arg1, &_arg2); end
2316
-
2317
- # source://activeresource//lib/active_resource/collection.rb#10
2318
- def keep_if(*_arg0, **_arg1, &_arg2); end
2319
-
2320
- # source://activeresource//lib/active_resource/collection.rb#10
2321
- def last(*_arg0, **_arg1, &_arg2); end
2322
-
2323
- # source://activeresource//lib/active_resource/collection.rb#10
2324
- def length(*_arg0, **_arg1, &_arg2); end
2325
-
2326
- # source://activeresource//lib/active_resource/collection.rb#10
2327
- def map(*_arg0, **_arg1, &_arg2); end
2328
-
2329
- # source://activeresource//lib/active_resource/collection.rb#67
2330
- def map!; end
2331
-
2332
- # source://activeresource//lib/active_resource/collection.rb#10
2333
- def max(*_arg0, **_arg1, &_arg2); end
2334
-
2335
- # source://activeresource//lib/active_resource/collection.rb#10
2336
- def min(*_arg0, **_arg1, &_arg2); end
2337
-
2338
- # source://activeresource//lib/active_resource/collection.rb#10
2339
- def minmax(*_arg0, **_arg1, &_arg2); end
2340
-
2341
- # source://activeresource//lib/active_resource/collection.rb#10
2342
- def none?(*_arg0, **_arg1, &_arg2); end
2343
-
2344
- # source://activeresource//lib/active_resource/collection.rb#10
2345
- def one?(*_arg0, **_arg1, &_arg2); end
2346
-
2347
- # The array of actual elements returned by index actions
2348
- #
2349
- # source://activeresource//lib/active_resource/collection.rb#13
2350
- def original_params; end
2351
-
2352
- # The array of actual elements returned by index actions
2353
- #
2354
- # source://activeresource//lib/active_resource/collection.rb#13
2355
- def original_params=(_arg0); end
2356
-
2357
- # source://activeresource//lib/active_resource/collection.rb#10
2358
- def pack(*_arg0, **_arg1, &_arg2); end
2359
-
2360
- # source://activeresource//lib/active_resource/collection.rb#10
2361
- def permutation(*_arg0, **_arg1, &_arg2); end
2362
-
2363
- # source://activeresource//lib/active_resource/collection.rb#10
2364
- def place(*_arg0, **_arg1, &_arg2); end
2365
-
2366
- # source://activeresource//lib/active_resource/collection.rb#10
2367
- def pop(*_arg0, **_arg1, &_arg2); end
2368
-
2369
- # source://activeresource//lib/active_resource/collection.rb#10
2370
- def prepend(*_arg0, **_arg1, &_arg2); end
2371
-
2372
- # source://activeresource//lib/active_resource/collection.rb#10
2373
- def present?(*_arg0, **_arg1, &_arg2); end
2374
-
2375
- # source://activeresource//lib/active_resource/collection.rb#10
2376
- def pretty_print(*_arg0, **_arg1, &_arg2); end
2377
-
2378
- # source://activeresource//lib/active_resource/collection.rb#10
2379
- def pretty_print_cycle(*_arg0, **_arg1, &_arg2); end
2380
-
2381
- # source://activeresource//lib/active_resource/collection.rb#10
2382
- def product(*_arg0, **_arg1, &_arg2); end
2383
-
2384
- # source://activeresource//lib/active_resource/collection.rb#10
2385
- def push(*_arg0, **_arg1, &_arg2); end
2386
-
2387
- # source://activeresource//lib/active_resource/collection.rb#10
2388
- def rassoc(*_arg0, **_arg1, &_arg2); end
2389
-
2390
- # source://activeresource//lib/active_resource/collection.rb#10
2391
- def reject(*_arg0, **_arg1, &_arg2); end
2392
-
2393
- # source://activeresource//lib/active_resource/collection.rb#10
2394
- def reject!(*_arg0, **_arg1, &_arg2); end
2395
-
2396
- # source://activeresource//lib/active_resource/collection.rb#10
2397
- def repeated_combination(*_arg0, **_arg1, &_arg2); end
2398
-
2399
- # source://activeresource//lib/active_resource/collection.rb#10
2400
- def repeated_permutation(*_arg0, **_arg1, &_arg2); end
2401
-
2402
- # source://activeresource//lib/active_resource/collection.rb#10
2403
- def replace(*_arg0, **_arg1, &_arg2); end
2404
-
2405
- # The array of actual elements returned by index actions
2406
- #
2407
- # source://activeresource//lib/active_resource/collection.rb#13
2408
- def resource_class; end
2409
-
2410
- # The array of actual elements returned by index actions
2411
- #
2412
- # source://activeresource//lib/active_resource/collection.rb#13
2413
- def resource_class=(_arg0); end
2414
-
2415
- # source://activeresource//lib/active_resource/collection.rb#10
2416
- def reverse(*_arg0, **_arg1, &_arg2); end
2417
-
2418
- # source://activeresource//lib/active_resource/collection.rb#10
2419
- def reverse!(*_arg0, **_arg1, &_arg2); end
2420
-
2421
- # source://activeresource//lib/active_resource/collection.rb#10
2422
- def reverse_each(*_arg0, **_arg1, &_arg2); end
2423
-
2424
- # source://activeresource//lib/active_resource/collection.rb#10
2425
- def rindex(*_arg0, **_arg1, &_arg2); end
2426
-
2427
- # source://activeresource//lib/active_resource/collection.rb#10
2428
- def rotate(*_arg0, **_arg1, &_arg2); end
2429
-
2430
- # source://activeresource//lib/active_resource/collection.rb#10
2431
- def rotate!(*_arg0, **_arg1, &_arg2); end
2432
-
2433
- # source://activeresource//lib/active_resource/collection.rb#10
2434
- def sample(*_arg0, **_arg1, &_arg2); end
2435
-
2436
- # source://activeresource//lib/active_resource/collection.rb#10
2437
- def second(*_arg0, **_arg1, &_arg2); end
2438
-
2439
- # source://activeresource//lib/active_resource/collection.rb#10
2440
- def second_to_last(*_arg0, **_arg1, &_arg2); end
2441
-
2442
- # source://activeresource//lib/active_resource/collection.rb#10
2443
- def select(*_arg0, **_arg1, &_arg2); end
2444
-
2445
- # source://activeresource//lib/active_resource/collection.rb#10
2446
- def select!(*_arg0, **_arg1, &_arg2); end
2447
-
2448
- # source://activeresource//lib/active_resource/collection.rb#10
2449
- def shelljoin(*_arg0, **_arg1, &_arg2); end
2450
-
2451
- # source://activeresource//lib/active_resource/collection.rb#10
2452
- def shift(*_arg0, **_arg1, &_arg2); end
2453
-
2454
- # source://activeresource//lib/active_resource/collection.rb#10
2455
- def shuffle(*_arg0, **_arg1, &_arg2); end
2456
-
2457
- # source://activeresource//lib/active_resource/collection.rb#10
2458
- def shuffle!(*_arg0, **_arg1, &_arg2); end
2459
-
2460
- # source://activeresource//lib/active_resource/collection.rb#10
2461
- def size(*_arg0, **_arg1, &_arg2); end
2462
-
2463
- # source://activeresource//lib/active_resource/collection.rb#10
2464
- def slice(*_arg0, **_arg1, &_arg2); end
2465
-
2466
- # source://activeresource//lib/active_resource/collection.rb#10
2467
- def slice!(*_arg0, **_arg1, &_arg2); end
2468
-
2469
- # source://activeresource//lib/active_resource/collection.rb#10
2470
- def sort(*_arg0, **_arg1, &_arg2); end
2471
-
2472
- # source://activeresource//lib/active_resource/collection.rb#10
2473
- def sort!(*_arg0, **_arg1, &_arg2); end
2474
-
2475
- # source://activeresource//lib/active_resource/collection.rb#10
2476
- def sort_by!(*_arg0, **_arg1, &_arg2); end
2477
-
2478
- # source://activeresource//lib/active_resource/collection.rb#10
2479
- def split(*_arg0, **_arg1, &_arg2); end
2480
-
2481
- # source://activeresource//lib/active_resource/collection.rb#10
2482
- def sum(*_arg0, **_arg1, &_arg2); end
2483
-
2484
- # source://activeresource//lib/active_resource/collection.rb#10
2485
- def take(*_arg0, **_arg1, &_arg2); end
2486
-
2487
- # source://activeresource//lib/active_resource/collection.rb#10
2488
- def take_while(*_arg0, **_arg1, &_arg2); end
2489
-
2490
- # source://activeresource//lib/active_resource/collection.rb#10
2491
- def third(*_arg0, **_arg1, &_arg2); end
2492
-
2493
- # source://activeresource//lib/active_resource/collection.rb#10
2494
- def third_to_last(*_arg0, **_arg1, &_arg2); end
2495
-
2496
- # source://activeresource//lib/active_resource/collection.rb#10
2497
- def to(*_arg0, **_arg1, &_arg2); end
2498
-
2499
- # source://activeresource//lib/active_resource/collection.rb#63
2500
- def to_a; end
2501
-
2502
- # source://activeresource//lib/active_resource/collection.rb#10
2503
- def to_ary(*_arg0, **_arg1, &_arg2); end
2504
-
2505
- # source://activeresource//lib/active_resource/collection.rb#10
2506
- def to_formatted_s(*_arg0, **_arg1, &_arg2); end
2507
-
2508
- # source://activeresource//lib/active_resource/collection.rb#10
2509
- def to_fs(*_arg0, **_arg1, &_arg2); end
2510
-
2511
- # source://activeresource//lib/active_resource/collection.rb#10
2512
- def to_h(*_arg0, **_arg1, &_arg2); end
2513
-
2514
- # source://activeresource//lib/active_resource/collection.rb#10
2515
- def to_param(*_arg0, **_arg1, &_arg2); end
2516
-
2517
- # source://activeresource//lib/active_resource/collection.rb#10
2518
- def to_query(*_arg0, **_arg1, &_arg2); end
2519
-
2520
- # source://activeresource//lib/active_resource/collection.rb#10
2521
- def to_s(*_arg0, **_arg1, &_arg2); end
2522
-
2523
- # source://activeresource//lib/active_resource/collection.rb#10
2524
- def to_sentence(*_arg0, **_arg1, &_arg2); end
2525
-
2526
- # source://activeresource//lib/active_resource/collection.rb#10
2527
- def to_xml(*_arg0, **_arg1, &_arg2); end
2528
-
2529
- # source://activeresource//lib/active_resource/collection.rb#10
2530
- def to_yaml(*_arg0, **_arg1, &_arg2); end
2531
-
2532
- # source://activeresource//lib/active_resource/collection.rb#10
2533
- def transpose(*_arg0, **_arg1, &_arg2); end
2534
-
2535
- # source://activeresource//lib/active_resource/collection.rb#10
2536
- def union(*_arg0, **_arg1, &_arg2); end
2537
-
2538
- # source://activeresource//lib/active_resource/collection.rb#10
2539
- def uniq(*_arg0, **_arg1, &_arg2); end
2540
-
2541
- # source://activeresource//lib/active_resource/collection.rb#10
2542
- def uniq!(*_arg0, **_arg1, &_arg2); end
2543
-
2544
- # source://activeresource//lib/active_resource/collection.rb#10
2545
- def unshift(*_arg0, **_arg1, &_arg2); end
2546
-
2547
- # source://activeresource//lib/active_resource/collection.rb#10
2548
- def values_at(*_arg0, **_arg1, &_arg2); end
2549
-
2550
- # @raise [ArgumentError]
2551
- #
2552
- # source://activeresource//lib/active_resource/collection.rb#88
2553
- def where(clauses = T.unsafe(nil)); end
2554
-
2555
- # source://activeresource//lib/active_resource/collection.rb#10
2556
- def without(*_arg0, **_arg1, &_arg2); end
2557
-
2558
- # source://activeresource//lib/active_resource/collection.rb#10
2559
- def zip(*_arg0, **_arg1, &_arg2); end
2560
-
2561
- # source://activeresource//lib/active_resource/collection.rb#10
2562
- def |(*_arg0, **_arg1, &_arg2); end
2563
- end
2564
-
2565
- # source://activeresource//lib/active_resource/collection.rb#8
2566
- ActiveResource::Collection::SELF_DEFINE_METHODS = T.let(T.unsafe(nil), Array)
2567
-
2568
- # Class to handle connections to remote web services.
2569
- # This class is used by ActiveResource::Base to interface with REST
2570
- # services.
2571
- #
2572
- # source://activeresource//lib/active_resource/connection.rb#13
2573
- class ActiveResource::Connection
2574
- # The +site+ parameter is required and will set the +site+
2575
- # attribute to the URI for the remote resource service.
2576
- #
2577
- # @raise [ArgumentError]
2578
- # @return [Connection] a new instance of Connection
2579
- #
2580
- # source://activeresource//lib/active_resource/connection.rb#33
2581
- def initialize(site, format = T.unsafe(nil), logger: T.unsafe(nil)); end
2582
-
2583
- # Returns the value of attribute auth_type.
2584
- #
2585
- # source://activeresource//lib/active_resource/connection.rb#22
2586
- def auth_type; end
2587
-
2588
- # Sets the auth type for remote service.
2589
- #
2590
- # source://activeresource//lib/active_resource/connection.rb#64
2591
- def auth_type=(auth_type); end
2592
-
2593
- # Returns the value of attribute bearer_token.
2594
- #
2595
- # source://activeresource//lib/active_resource/connection.rb#22
2596
- def bearer_token; end
2597
-
2598
- # Sets the bearer token for remote service.
2599
- #
2600
- # source://activeresource//lib/active_resource/connection.rb#61
2601
- def bearer_token=(_arg0); end
2602
-
2603
- # Executes a DELETE request (see HTTP protocol documentation if unfamiliar).
2604
- # Used to delete resources.
2605
- #
2606
- # source://activeresource//lib/active_resource/connection.rb#88
2607
- def delete(path, headers = T.unsafe(nil)); end
2608
-
2609
- # Returns the value of attribute format.
2610
- #
2611
- # source://activeresource//lib/active_resource/connection.rb#23
2612
- def format; end
2613
-
2614
- # Sets the attribute format
2615
- #
2616
- # @param value the value to set the attribute format to.
2617
- #
2618
- # source://activeresource//lib/active_resource/connection.rb#23
2619
- def format=(_arg0); end
2620
-
2621
- # Executes a GET request.
2622
- # Used to get (find) resources.
2623
- #
2624
- # source://activeresource//lib/active_resource/connection.rb#82
2625
- def get(path, headers = T.unsafe(nil)); end
2626
-
2627
- # Executes a HEAD request.
2628
- # Used to obtain meta-information about resources, such as whether they exist and their size (via response headers).
2629
- #
2630
- # source://activeresource//lib/active_resource/connection.rb#112
2631
- def head(path, headers = T.unsafe(nil)); end
2632
-
2633
- # Returns the value of attribute logger.
2634
- #
2635
- # source://activeresource//lib/active_resource/connection.rb#23
2636
- def logger; end
2637
-
2638
- # Sets the attribute logger
2639
- #
2640
- # @param value the value to set the attribute logger to.
2641
- #
2642
- # source://activeresource//lib/active_resource/connection.rb#23
2643
- def logger=(_arg0); end
2644
-
2645
- # Returns the value of attribute open_timeout.
2646
- #
2647
- # source://activeresource//lib/active_resource/connection.rb#22
2648
- def open_timeout; end
2649
-
2650
- # Sets the number of seconds after which HTTP connects to the remote service should time out.
2651
- #
2652
- # source://activeresource//lib/active_resource/connection.rb#72
2653
- def open_timeout=(_arg0); end
2654
-
2655
- # Returns the value of attribute password.
2656
- #
2657
- # source://activeresource//lib/active_resource/connection.rb#22
2658
- def password; end
2659
-
2660
- # Sets the password for remote service.
2661
- #
2662
- # source://activeresource//lib/active_resource/connection.rb#58
2663
- def password=(_arg0); end
2664
-
2665
- # Executes a PATCH request (see HTTP protocol documentation if unfamiliar).
2666
- # Used to update resources.
2667
- #
2668
- # source://activeresource//lib/active_resource/connection.rb#94
2669
- def patch(path, body = T.unsafe(nil), headers = T.unsafe(nil)); end
2670
-
2671
- # Executes a POST request.
2672
- # Used to create new resources.
2673
- #
2674
- # source://activeresource//lib/active_resource/connection.rb#106
2675
- def post(path, body = T.unsafe(nil), headers = T.unsafe(nil)); end
2676
-
2677
- # Returns the value of attribute proxy.
2678
- #
2679
- # source://activeresource//lib/active_resource/connection.rb#22
2680
- def proxy; end
2681
-
2682
- # Set the proxy for remote service.
2683
- #
2684
- # source://activeresource//lib/active_resource/connection.rb#50
2685
- def proxy=(proxy); end
2686
-
2687
- # Executes a PUT request (see HTTP protocol documentation if unfamiliar).
2688
- # Used to update resources.
2689
- #
2690
- # source://activeresource//lib/active_resource/connection.rb#100
2691
- def put(path, body = T.unsafe(nil), headers = T.unsafe(nil)); end
2692
-
2693
- # Returns the value of attribute read_timeout.
2694
- #
2695
- # source://activeresource//lib/active_resource/connection.rb#22
2696
- def read_timeout; end
2697
-
2698
- # Sets the number of seconds after which HTTP read requests to the remote service should time out.
2699
- #
2700
- # source://activeresource//lib/active_resource/connection.rb#75
2701
- def read_timeout=(_arg0); end
2702
-
2703
- # Returns the value of attribute site.
2704
- #
2705
- # source://activeresource//lib/active_resource/connection.rb#22
2706
- def site; end
2707
-
2708
- # Set URI for remote service.
2709
- #
2710
- # source://activeresource//lib/active_resource/connection.rb#42
2711
- def site=(site); end
2712
-
2713
- # Returns the value of attribute ssl_options.
2714
- #
2715
- # source://activeresource//lib/active_resource/connection.rb#22
2716
- def ssl_options; end
2717
-
2718
- # Hash of options applied to Net::HTTP instance when +site+ protocol is 'https'.
2719
- #
2720
- # source://activeresource//lib/active_resource/connection.rb#78
2721
- def ssl_options=(_arg0); end
2722
-
2723
- # Returns the value of attribute timeout.
2724
- #
2725
- # source://activeresource//lib/active_resource/connection.rb#22
2726
- def timeout; end
2727
-
2728
- # Sets the number of seconds after which HTTP requests to the remote service should time out.
2729
- #
2730
- # source://activeresource//lib/active_resource/connection.rb#69
2731
- def timeout=(_arg0); end
2732
-
2733
- # Returns the value of attribute user.
2734
- #
2735
- # source://activeresource//lib/active_resource/connection.rb#22
2736
- def user; end
2737
-
2738
- # Sets the user for remote service.
2739
- #
2740
- # source://activeresource//lib/active_resource/connection.rb#55
2741
- def user=(_arg0); end
2742
-
2743
- private
2744
-
2745
- # source://activeresource//lib/active_resource/connection.rb#197
2746
- def apply_ssl_options(http); end
2747
-
2748
- # source://activeresource//lib/active_resource/connection.rb#272
2749
- def auth_attributes_for(uri, request_digest, params); end
2750
-
2751
- # source://activeresource//lib/active_resource/connection.rb#232
2752
- def authorization_header(http_method, uri); end
2753
-
2754
- # Builds headers for request to remote service.
2755
- #
2756
- # source://activeresource//lib/active_resource/connection.rb#214
2757
- def build_request_headers(headers, http_method, uri); end
2758
-
2759
- # source://activeresource//lib/active_resource/connection.rb#260
2760
- def client_nonce; end
2761
-
2762
- # source://activeresource//lib/active_resource/connection.rb#185
2763
- def configure_http(http); end
2764
-
2765
- # source://activeresource//lib/active_resource/connection.rb#209
2766
- def default_header; end
2767
-
2768
- # source://activeresource//lib/active_resource/connection.rb#246
2769
- def digest_auth_header(http_method, uri); end
2770
-
2771
- # source://activeresource//lib/active_resource/connection.rb#264
2772
- def extract_params_from_response; end
2773
-
2774
- # Handles response and error codes from the remote service.
2775
- #
2776
- # source://activeresource//lib/active_resource/connection.rb#132
2777
- def handle_response(response); end
2778
-
2779
- # Creates new Net::HTTP instance for communication with the
2780
- # remote service and resources.
2781
- #
2782
- # source://activeresource//lib/active_resource/http_mock.rb#364
2783
- def http; end
2784
-
2785
- # source://activeresource//lib/active_resource/connection.rb#288
2786
- def http_format_header(http_method); end
2787
-
2788
- # source://activeresource//lib/active_resource/http_mock.rb#373
2789
- def http_stub; end
2790
-
2791
- # source://activeresource//lib/active_resource/connection.rb#292
2792
- def legitimize_auth_type(auth_type); end
2793
-
2794
- # source://activeresource//lib/active_resource/connection.rb#175
2795
- def new_http; end
2796
-
2797
- # Makes a request to the remote service.
2798
- #
2799
- # source://activeresource//lib/active_resource/connection.rb#118
2800
- def request(method, path, *arguments); end
2801
-
2802
- # source://activeresource//lib/active_resource/connection.rb#218
2803
- def response_auth_header; end
2804
-
2805
- # source://activeresource//lib/active_resource/http_mock.rb#381
2806
- def stub_http?; end
2807
-
2808
- # source://activeresource//lib/active_resource/http_mock.rb#377
2809
- def unstub_http?; end
2810
-
2811
- # source://activeresource//lib/active_resource/connection.rb#222
2812
- def with_auth; end
2813
-
2814
- class << self
2815
- # source://activeresource//lib/active_resource/connection.rb#26
2816
- def requests; end
2817
- end
2818
- end
2819
-
2820
- # source://activeresource//lib/active_resource/connection.rb#14
2821
- ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES = T.let(T.unsafe(nil), Hash)
2822
-
2823
- # source://activeresource//lib/active_resource/exceptions.rb#4
2824
- class ActiveResource::ConnectionError < ::StandardError
2825
- # @return [ConnectionError] a new instance of ConnectionError
2826
- #
2827
- # source://activeresource//lib/active_resource/exceptions.rb#7
2828
- def initialize(response, message = T.unsafe(nil)); end
2829
-
2830
- # Returns the value of attribute response.
2831
- #
2832
- # source://activeresource//lib/active_resource/exceptions.rb#5
2833
- def response; end
2834
-
2835
- # source://activeresource//lib/active_resource/exceptions.rb#12
2836
- def to_s; end
2837
- end
2838
-
2839
- # A module to support custom REST methods and sub-resources, allowing you to break out
2840
- # of the "default" REST methods with your own custom resource requests. For example,
2841
- # say you use Rails to expose a REST service and configure your routes with:
2842
- #
2843
- # map.resources :people, :new => { :register => :post },
2844
- # :member => { :promote => :put, :deactivate => :delete }
2845
- # :collection => { :active => :get }
2846
- #
2847
- # This route set creates routes for the following HTTP requests:
2848
- #
2849
- # POST /people/new/register.json # PeopleController.register
2850
- # PATCH/PUT /people/1/promote.json # PeopleController.promote with :id => 1
2851
- # DELETE /people/1/deactivate.json # PeopleController.deactivate with :id => 1
2852
- # GET /people/active.json # PeopleController.active
2853
- #
2854
- # Using this module, Active Resource can use these custom REST methods just like the
2855
- # standard methods.
2856
- #
2857
- # class Person < ActiveResource::Base
2858
- # self.site = "https://37s.sunrise.com"
2859
- # end
2860
- #
2861
- # Person.new(:name => 'Ryan').post(:register) # POST /people/new/register.json
2862
- # # => { :id => 1, :name => 'Ryan' }
2863
- #
2864
- # Person.find(1).put(:promote, :position => 'Manager') # PUT /people/1/promote.json
2865
- # Person.find(1).delete(:deactivate) # DELETE /people/1/deactivate.json
2866
- #
2867
- # Person.get(:active) # GET /people/active.json
2868
- # # => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]
2869
- #
2870
- # source://activeresource//lib/active_resource/custom_methods.rb#37
2871
- module ActiveResource::CustomMethods
2872
- extend ::ActiveSupport::Concern
2873
-
2874
- # source://activeresource//lib/active_resource/custom_methods.rb#115
2875
- def delete(method_name, options = T.unsafe(nil)); end
2876
-
2877
- # source://activeresource//lib/active_resource/custom_methods.rb#94
2878
- def get(method_name, options = T.unsafe(nil)); end
2879
-
2880
- # source://activeresource//lib/active_resource/custom_methods.rb#107
2881
- def patch(method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
2882
-
2883
- # source://activeresource//lib/active_resource/custom_methods.rb#98
2884
- def post(method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
2885
-
2886
- # source://activeresource//lib/active_resource/custom_methods.rb#111
2887
- def put(method_name, options = T.unsafe(nil), body = T.unsafe(nil)); end
2888
-
2889
- private
2890
-
2891
- # source://activeresource//lib/active_resource/custom_methods.rb#121
2892
- def custom_method_element_url(method_name, options = T.unsafe(nil)); end
2893
-
2894
- # source://activeresource//lib/active_resource/custom_methods.rb#125
2895
- def custom_method_new_element_url(method_name, options = T.unsafe(nil)); end
2896
- end
2897
-
2898
- # source://activeresource//lib/active_resource/custom_methods.rb#87
2899
- module ActiveResource::CustomMethods::ClassMethods
2900
- # source://activeresource//lib/active_resource/custom_methods.rb#88
2901
- def custom_method_collection_url(method_name, options = T.unsafe(nil)); end
2902
- end
2903
-
2904
- # Active Resource validation is reported to and from this object, which is used by Base#save
2905
- # to determine whether the object in a valid state to be saved. See usage example in Validations.
2906
- #
2907
- # source://activeresource//lib/active_resource/validations.rb#12
2908
- class ActiveResource::Errors < ::ActiveModel::Errors
2909
- # Grabs errors from an array of messages (like ActiveRecord::Validations).
2910
- # The second parameter directs the errors cache to be cleared (default)
2911
- # or not (by passing true).
2912
- #
2913
- # source://activeresource//lib/active_resource/validations.rb#16
2914
- def from_array(messages, save_cache = T.unsafe(nil)); end
2915
-
2916
- # Grabs errors from a hash of attribute => array of errors elements
2917
- # The second parameter directs the errors cache to be cleared (default)
2918
- # or not (by passing true)
2919
- #
2920
- # Unrecognized attribute names will be humanized and added to the record's
2921
- # base errors.
2922
- #
2923
- # source://activeresource//lib/active_resource/validations.rb#35
2924
- def from_hash(messages, save_cache = T.unsafe(nil)); end
2925
-
2926
- # Grabs errors from a json response.
2927
- #
2928
- # source://activeresource//lib/active_resource/validations.rb#54
2929
- def from_json(json, save_cache = T.unsafe(nil)); end
2930
-
2931
- # Grabs errors from an XML response.
2932
- #
2933
- # source://activeresource//lib/active_resource/validations.rb#74
2934
- def from_xml(xml, save_cache = T.unsafe(nil)); end
2935
- end
2936
-
2937
- # 403 Forbidden
2938
- #
2939
- # source://activeresource//lib/active_resource/exceptions.rb#65
2940
- class ActiveResource::ForbiddenAccess < ::ActiveResource::ClientError; end
2941
-
2942
- # source://activeresource//lib/active_resource/formats.rb#4
2943
- module ActiveResource::Formats
2944
- class << self
2945
- # Lookup the format class from a mime type reference symbol. Example:
2946
- #
2947
- # ActiveResource::Formats[:xml] # => ActiveResource::Formats::XmlFormat
2948
- # ActiveResource::Formats[:json] # => ActiveResource::Formats::JsonFormat
2949
- #
2950
- # source://activeresource//lib/active_resource/formats.rb#12
2951
- def [](mime_type_reference); end
2952
-
2953
- # source://activeresource//lib/active_resource/formats.rb#16
2954
- def remove_root(data); end
2955
- end
2956
- end
2957
-
2958
- # source://activeresource//lib/active_resource/formats/json_format.rb#7
2959
- module ActiveResource::Formats::JsonFormat
2960
- extend ::ActiveResource::Formats::JsonFormat
2961
-
2962
- # source://activeresource//lib/active_resource/formats/json_format.rb#22
2963
- def decode(json); end
2964
-
2965
- # source://activeresource//lib/active_resource/formats/json_format.rb#18
2966
- def encode(hash, options = T.unsafe(nil)); end
2967
-
2968
- # source://activeresource//lib/active_resource/formats/json_format.rb#10
2969
- def extension; end
2970
-
2971
- # source://activeresource//lib/active_resource/formats/json_format.rb#14
2972
- def mime_type; end
2973
- end
2974
-
2975
- # source://activeresource//lib/active_resource/formats/xml_format.rb#7
2976
- module ActiveResource::Formats::XmlFormat
2977
- extend ::ActiveResource::Formats::XmlFormat
2978
-
2979
- # source://activeresource//lib/active_resource/formats/xml_format.rb#22
2980
- def decode(xml); end
2981
-
2982
- # source://activeresource//lib/active_resource/formats/xml_format.rb#18
2983
- def encode(hash, options = T.unsafe(nil)); end
2984
-
2985
- # source://activeresource//lib/active_resource/formats/xml_format.rb#10
2986
- def extension; end
2987
-
2988
- # source://activeresource//lib/active_resource/formats/xml_format.rb#14
2989
- def mime_type; end
2990
- end
2991
-
2992
- # One thing that has always been a pain with remote web services is testing. The HttpMock
2993
- # class makes it easy to test your Active Resource models by creating a set of mock responses to specific
2994
- # requests.
2995
- #
2996
- # To test your Active Resource model, you simply call the ActiveResource::HttpMock.respond_to
2997
- # method with an attached block. The block declares a set of URIs with expected input, and the output
2998
- # each request should return. The passed in block has any number of entries in the following generalized
2999
- # format:
3000
- #
3001
- # mock.http_method(path, request_headers = {}, body = nil, status = 200, response_headers = {})
3002
- #
3003
- # * <tt>http_method</tt> - The HTTP method to listen for. This can be +get+, +post+, +patch+, +put+, +delete+ or
3004
- # +head+.
3005
- # * <tt>path</tt> - A string, starting with a "/", defining the URI that is expected to be
3006
- # called.
3007
- # * <tt>request_headers</tt> - Headers that are expected along with the request. This argument uses a
3008
- # hash format, such as <tt>{ "Content-Type" => "application/json" }</tt>. This mock will only trigger
3009
- # if your tests sends a request with identical headers.
3010
- # * <tt>body</tt> - The data to be returned. This should be a string of Active Resource parseable content,
3011
- # such as Json.
3012
- # * <tt>status</tt> - The HTTP response code, as an integer, to return with the response.
3013
- # * <tt>response_headers</tt> - Headers to be returned with the response. Uses the same hash format as
3014
- # <tt>request_headers</tt> listed above.
3015
- #
3016
- # In order for a mock to deliver its content, the incoming request must match by the <tt>http_method</tt>,
3017
- # +path+ and <tt>request_headers</tt>. If no match is found an +InvalidRequestError+ exception
3018
- # will be raised showing you what request it could not find a response for and also what requests and response
3019
- # pairs have been recorded so you can create a new mock for that request.
3020
- #
3021
- # ==== Example
3022
- # def setup
3023
- # @matz = { :person => { :id => 1, :name => "Matz" } }.to_json
3024
- # ActiveResource::HttpMock.respond_to do |mock|
3025
- # mock.post "/people.json", {}, @matz, 201, "Location" => "/people/1.json"
3026
- # mock.get "/people/1.json", {}, @matz
3027
- # mock.put "/people/1.json", {}, nil, 204
3028
- # mock.delete "/people/1.json", {}, nil, 200
3029
- # end
3030
- # end
3031
- #
3032
- # def test_get_matz
3033
- # person = Person.find(1)
3034
- # assert_equal "Matz", person.name
3035
- # end
3036
- #
3037
- # source://activeresource//lib/active_resource/http_mock.rb#54
3038
- class ActiveResource::HttpMock
3039
- # @return [HttpMock] a new instance of HttpMock
3040
- #
3041
- # source://activeresource//lib/active_resource/http_mock.rb#270
3042
- def initialize(site); end
3043
-
3044
- # source://activeresource//lib/active_resource/http_mock.rb#257
3045
- def delete(path, headers, options = T.unsafe(nil)); end
3046
-
3047
- # source://activeresource//lib/active_resource/http_mock.rb#257
3048
- def get(path, headers, options = T.unsafe(nil)); end
3049
-
3050
- # source://activeresource//lib/active_resource/http_mock.rb#257
3051
- def head(path, headers, options = T.unsafe(nil)); end
3052
-
3053
- # source://activeresource//lib/active_resource/http_mock.rb#274
3054
- def inspect_responses; end
3055
-
3056
- # source://activeresource//lib/active_resource/http_mock.rb#257
3057
- def patch(path, body, headers, options = T.unsafe(nil)); end
3058
-
3059
- # source://activeresource//lib/active_resource/http_mock.rb#257
3060
- def post(path, body, headers, options = T.unsafe(nil)); end
3061
-
3062
- # source://activeresource//lib/active_resource/http_mock.rb#257
3063
- def put(path, body, headers, options = T.unsafe(nil)); end
3064
-
3065
- class << self
3066
- # source://activeresource//lib/active_resource/http_mock.rb#205
3067
- def delete_responses_to_replace(new_responses); end
3068
-
3069
- # Sets all ActiveResource::Connection to use HttpMock instances.
3070
- #
3071
- # source://activeresource//lib/active_resource/http_mock.rb#225
3072
- def disable_net_connection!; end
3073
-
3074
- # Enables all ActiveResource::Connection instances to use real
3075
- # Net::HTTP instance instead of a mock.
3076
- #
3077
- # source://activeresource//lib/active_resource/http_mock.rb#220
3078
- def enable_net_connection!; end
3079
-
3080
- # @return [Boolean]
3081
- #
3082
- # source://activeresource//lib/active_resource/http_mock.rb#238
3083
- def net_connection_disabled?; end
3084
-
3085
- # Checks if real requests can be used instead of the default mock used in tests.
3086
- #
3087
- # @return [Boolean]
3088
- #
3089
- # source://activeresource//lib/active_resource/http_mock.rb#230
3090
- def net_connection_enabled?; end
3091
-
3092
- # Returns an array of all request objects that have been sent to the mock. You can use this to check
3093
- # if your model actually sent an HTTP request.
3094
- #
3095
- # ==== Example
3096
- # def setup
3097
- # @matz = { :person => { :id => 1, :name => "Matz" } }.to_json
3098
- # ActiveResource::HttpMock.respond_to do |mock|
3099
- # mock.get "/people/1.json", {}, @matz
3100
- # end
3101
- # end
3102
- #
3103
- # def test_should_request_remote_service
3104
- # person = Person.find(1) # Call the remote service
3105
- #
3106
- # # This request object has the same HTTP method and path as declared by the mock
3107
- # expected_request = ActiveResource::Request.new(:get, "/people/1.json")
3108
- #
3109
- # # Assert that the mock received, and responded to, the expected request from the model
3110
- # assert ActiveResource::HttpMock.requests.include?(expected_request)
3111
- # end
3112
- #
3113
- # source://activeresource//lib/active_resource/http_mock.rb#103
3114
- def requests; end
3115
-
3116
- # Deletes all logged requests and responses.
3117
- #
3118
- # source://activeresource//lib/active_resource/http_mock.rb#213
3119
- def reset!; end
3120
-
3121
- # Accepts a block which declares a set of requests and responses for the HttpMock to respond to in
3122
- # the following format:
3123
- #
3124
- # mock.http_method(path, request_headers = {}, body = nil, status = 200, response_headers = {})
3125
- #
3126
- # === Example
3127
- #
3128
- # @matz = { :person => { :id => 1, :name => "Matz" } }.to_json
3129
- # ActiveResource::HttpMock.respond_to do |mock|
3130
- # mock.post "/people.json", {}, @matz, 201, "Location" => "/people/1.json"
3131
- # mock.get "/people/1.json", {}, @matz
3132
- # mock.put "/people/1.json", {}, nil, 204
3133
- # mock.delete "/people/1.json", {}, nil, 200
3134
- # end
3135
- #
3136
- # Alternatively, accepts a hash of <tt>{Request => Response}</tt> pairs allowing you to generate
3137
- # these the following format:
3138
- #
3139
- # ActiveResource::Request.new(method, path, body, request_headers)
3140
- # ActiveResource::Response.new(body, status, response_headers)
3141
- #
3142
- # === Example
3143
- #
3144
- # Request.new(method, path, nil, request_headers)
3145
- #
3146
- # @matz = { :person => { :id => 1, :name => "Matz" } }.to_json
3147
- #
3148
- # create_matz = ActiveResource::Request.new(:post, '/people.json', @matz, {})
3149
- # created_response = ActiveResource::Response.new("", 201, {"Location" => "/people/1.json"})
3150
- # get_matz = ActiveResource::Request.new(:get, '/people/1.json', nil)
3151
- # ok_response = ActiveResource::Response.new("", 200, {})
3152
- #
3153
- # pairs = {create_matz => created_response, get_matz => ok_response}
3154
- #
3155
- # ActiveResource::HttpMock.respond_to(pairs)
3156
- #
3157
- # Note, by default, every time you call +respond_to+, any previous request and response pairs stored
3158
- # in HttpMock will be deleted giving you a clean slate to work on.
3159
- #
3160
- # If you want to override this behavior, pass in +false+ as the last argument to +respond_to+
3161
- #
3162
- # === Example
3163
- #
3164
- # ActiveResource::HttpMock.respond_to do |mock|
3165
- # mock.send(:get, "/people/1", {}, "JSON1")
3166
- # end
3167
- # ActiveResource::HttpMock.responses.length #=> 1
3168
- #
3169
- # ActiveResource::HttpMock.respond_to(false) do |mock|
3170
- # mock.send(:get, "/people/2", {}, "JSON2")
3171
- # end
3172
- # ActiveResource::HttpMock.responses.length #=> 2
3173
- #
3174
- # This also works with passing in generated pairs of requests and responses, again, just pass in false
3175
- # as the last argument:
3176
- #
3177
- # === Example
3178
- #
3179
- # ActiveResource::HttpMock.respond_to do |mock|
3180
- # mock.send(:get, "/people/1", {}, "JSON1")
3181
- # end
3182
- # ActiveResource::HttpMock.responses.length #=> 1
3183
- #
3184
- # get_matz = ActiveResource::Request.new(:get, '/people/1.json', nil)
3185
- # ok_response = ActiveResource::Response.new("", 200, {})
3186
- #
3187
- # pairs = {get_matz => ok_response}
3188
- #
3189
- # ActiveResource::HttpMock.respond_to(pairs, false)
3190
- # ActiveResource::HttpMock.responses.length #=> 2
3191
- #
3192
- # # If you add a response with an existing request, it will be replaced
3193
- #
3194
- # fail_response = ActiveResource::Response.new("", 404, {})
3195
- # pairs = {get_matz => fail_response}
3196
- #
3197
- # ActiveResource::HttpMock.respond_to(pairs, false)
3198
- # ActiveResource::HttpMock.responses.length #=> 2
3199
- #
3200
- # source://activeresource//lib/active_resource/http_mock.rb#192
3201
- def respond_to(*args); end
3202
-
3203
- # Returns the list of requests and their mocked responses. Look up a
3204
- # response for a request using <tt>responses.assoc(request)</tt>.
3205
- #
3206
- # source://activeresource//lib/active_resource/http_mock.rb#109
3207
- def responses; end
3208
- end
3209
- end
3210
-
3211
- # source://activeresource//lib/active_resource/http_mock.rb#55
3212
- class ActiveResource::HttpMock::Responder
3213
- # @return [Responder] a new instance of Responder
3214
- #
3215
- # source://activeresource//lib/active_resource/http_mock.rb#56
3216
- def initialize(responses); end
3217
-
3218
- # source://activeresource//lib/active_resource/http_mock.rb#65
3219
- def delete(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3220
-
3221
- # source://activeresource//lib/active_resource/http_mock.rb#65
3222
- def get(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3223
-
3224
- # source://activeresource//lib/active_resource/http_mock.rb#65
3225
- def head(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3226
-
3227
- # source://activeresource//lib/active_resource/http_mock.rb#65
3228
- def patch(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3229
-
3230
- # source://activeresource//lib/active_resource/http_mock.rb#65
3231
- def post(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3232
-
3233
- # source://activeresource//lib/active_resource/http_mock.rb#65
3234
- def put(path, request_headers = T.unsafe(nil), body = T.unsafe(nil), status = T.unsafe(nil), response_headers = T.unsafe(nil), options = T.unsafe(nil)); end
3235
-
3236
- private
3237
-
3238
- # source://activeresource//lib/active_resource/http_mock.rb#77
3239
- def delete_duplicate_responses(request); end
3240
- end
3241
-
3242
- # source://activeresource//lib/active_resource/inheriting_hash.rb#4
3243
- class ActiveResource::InheritingHash < ::Hash
3244
- # @return [InheritingHash] a new instance of InheritingHash
3245
- #
3246
- # source://activeresource//lib/active_resource/inheriting_hash.rb#5
3247
- def initialize(parent_hash = T.unsafe(nil)); end
3248
-
3249
- # source://activeresource//lib/active_resource/inheriting_hash.rb#11
3250
- def [](key); end
3251
-
3252
- # source://activeresource//lib/active_resource/inheriting_hash.rb#26
3253
- def inspect; end
3254
-
3255
- # So we can see the merged object in IRB or the Rails console
3256
- #
3257
- # source://activeresource//lib/active_resource/inheriting_hash.rb#22
3258
- def pretty_print(pp); end
3259
-
3260
- # Merges the flattened parent hash (if it's an InheritingHash)
3261
- # with ourself
3262
- #
3263
- # source://activeresource//lib/active_resource/inheriting_hash.rb#17
3264
- def to_hash; end
3265
-
3266
- # source://activeresource//lib/active_resource/inheriting_hash.rb#30
3267
- def to_s; end
3268
- end
3269
-
3270
- # source://activeresource//lib/active_resource/http_mock.rb#7
3271
- class ActiveResource::InvalidRequestError < ::StandardError; end
3272
-
3273
- # source://activeresource//lib/active_resource/log_subscriber.rb#4
3274
- class ActiveResource::LogSubscriber < ::ActiveSupport::LogSubscriber
3275
- # source://activeresource//lib/active_resource/log_subscriber.rb#20
3276
- def logger; end
3277
-
3278
- # source://activeresource//lib/active_resource/log_subscriber.rb#5
3279
- def request(event); end
3280
- end
3281
-
3282
- # 405 Method Not Allowed
3283
- #
3284
- # source://activeresource//lib/active_resource/exceptions.rb#93
3285
- class ActiveResource::MethodNotAllowed < ::ActiveResource::ClientError
3286
- # source://activeresource//lib/active_resource/exceptions.rb#94
3287
- def allowed_methods; end
3288
- end
3289
-
3290
- # source://activeresource//lib/active_resource/exceptions.rb#45
3291
- class ActiveResource::MissingPrefixParam < ::ArgumentError; end
3292
-
3293
- # 402 Payment Required
3294
- #
3295
- # source://activeresource//lib/active_resource/exceptions.rb#61
3296
- class ActiveResource::PaymentRequired < ::ActiveResource::ClientError; end
3297
-
3298
- # 412 Precondition Failed
3299
- #
3300
- # source://activeresource//lib/active_resource/exceptions.rb#81
3301
- class ActiveResource::PreconditionFailed < ::ActiveResource::ClientError; end
3302
-
3303
- # 3xx Redirection
3304
- #
3305
- # source://activeresource//lib/active_resource/exceptions.rb#39
3306
- class ActiveResource::Redirection < ::ActiveResource::ConnectionError
3307
- # source://activeresource//lib/active_resource/exceptions.rb#40
3308
- def to_s; end
3309
- end
3310
-
3311
- # = Active Resource reflection
3312
- #
3313
- # Associations in ActiveResource would be used to resolve nested attributes
3314
- # in a response with correct classes.
3315
- # Now they could be specified over Associations with the options :class_name
3316
- #
3317
- # source://activeresource//lib/active_resource/reflection.rb#12
3318
- module ActiveResource::Reflection
3319
- extend ::ActiveSupport::Concern
3320
- include GeneratedInstanceMethods
3321
-
3322
- mixes_in_class_methods GeneratedClassMethods
3323
- mixes_in_class_methods ::ActiveResource::Reflection::ClassMethods
3324
-
3325
- module GeneratedClassMethods
3326
- def reflections; end
3327
- def reflections=(value); end
3328
- def reflections?; end
3329
- end
3330
-
3331
- module GeneratedInstanceMethods
3332
- def reflections; end
3333
- def reflections=(value); end
3334
- def reflections?; end
3335
- end
3336
- end
3337
-
3338
- # source://activeresource//lib/active_resource/reflection.rb#29
3339
- class ActiveResource::Reflection::AssociationReflection
3340
- # @return [AssociationReflection] a new instance of AssociationReflection
3341
- #
3342
- # source://activeresource//lib/active_resource/reflection.rb#30
3343
- def initialize(macro, name, options); end
3344
-
3345
- # Returns the class name for the macro.
3346
- #
3347
- # <tt>has_many :clients</tt> returns <tt>'Client'</tt>
3348
- #
3349
- # source://activeresource//lib/active_resource/reflection.rb#59
3350
- def class_name; end
3351
-
3352
- # Returns the foreign_key for the macro.
3353
- #
3354
- # source://activeresource//lib/active_resource/reflection.rb#64
3355
- def foreign_key; end
3356
-
3357
- # Returns the class for the macro.
3358
- #
3359
- # <tt>has_many :clients</tt> returns the Client class
3360
- #
3361
- # source://activeresource//lib/active_resource/reflection.rb#52
3362
- def klass; end
3363
-
3364
- # Returns the macro type.
3365
- #
3366
- # <tt>has_many :clients</tt> returns <tt>:has_many</tt>
3367
- #
3368
- # source://activeresource//lib/active_resource/reflection.rb#42
3369
- def macro; end
3370
-
3371
- # Returns the name of the macro.
3372
- #
3373
- # <tt>has_many :clients</tt> returns <tt>:clients</tt>
3374
- #
3375
- # source://activeresource//lib/active_resource/reflection.rb#37
3376
- def name; end
3377
-
3378
- # Returns the hash of options used for the macro.
3379
- #
3380
- # <tt>has_many :clients</tt> returns +{}+
3381
- #
3382
- # source://activeresource//lib/active_resource/reflection.rb#47
3383
- def options; end
3384
-
3385
- private
3386
-
3387
- # source://activeresource//lib/active_resource/reflection.rb#69
3388
- def derive_class_name; end
3389
-
3390
- # source://activeresource//lib/active_resource/reflection.rb#73
3391
- def derive_foreign_key; end
3392
- end
3393
-
3394
- # source://activeresource//lib/active_resource/reflection.rb#20
3395
- module ActiveResource::Reflection::ClassMethods
3396
- # source://activeresource//lib/active_resource/reflection.rb#21
3397
- def create_reflection(macro, name, options); end
3398
- end
3399
-
3400
- # source://activeresource//lib/active_resource/http_mock.rb#279
3401
- class ActiveResource::Request
3402
- # @return [Request] a new instance of Request
3403
- #
3404
- # source://activeresource//lib/active_resource/http_mock.rb#282
3405
- def initialize(method, path, body = T.unsafe(nil), headers = T.unsafe(nil), options = T.unsafe(nil)); end
3406
-
3407
- # source://activeresource//lib/active_resource/http_mock.rb#286
3408
- def ==(req); end
3409
-
3410
- # Returns the value of attribute body.
3411
- #
3412
- # source://activeresource//lib/active_resource/http_mock.rb#280
3413
- def body; end
3414
-
3415
- # Sets the attribute body
3416
- #
3417
- # @param value the value to set the attribute body to.
3418
- #
3419
- # source://activeresource//lib/active_resource/http_mock.rb#280
3420
- def body=(_arg0); end
3421
-
3422
- # Returns the value of attribute headers.
3423
- #
3424
- # source://activeresource//lib/active_resource/http_mock.rb#280
3425
- def headers; end
3426
-
3427
- # Sets the attribute headers
3428
- #
3429
- # @param value the value to set the attribute headers to.
3430
- #
3431
- # source://activeresource//lib/active_resource/http_mock.rb#280
3432
- def headers=(_arg0); end
3433
-
3434
- # Returns the value of attribute method.
3435
- #
3436
- # source://activeresource//lib/active_resource/http_mock.rb#280
3437
- def method; end
3438
-
3439
- # Sets the attribute method
3440
- #
3441
- # @param value the value to set the attribute method to.
3442
- #
3443
- # source://activeresource//lib/active_resource/http_mock.rb#280
3444
- def method=(_arg0); end
3445
-
3446
- # Returns the value of attribute path.
3447
- #
3448
- # source://activeresource//lib/active_resource/http_mock.rb#280
3449
- def path; end
3450
-
3451
- # Sets the attribute path
3452
- #
3453
- # @param value the value to set the attribute path to.
3454
- #
3455
- # source://activeresource//lib/active_resource/http_mock.rb#280
3456
- def path=(_arg0); end
3457
-
3458
- # Removes query parameters from the path.
3459
- #
3460
- # @return [String] the path without query parameters
3461
- #
3462
- # source://activeresource//lib/active_resource/http_mock.rb#297
3463
- def remove_query_params_from_path; end
3464
-
3465
- # source://activeresource//lib/active_resource/http_mock.rb#290
3466
- def to_s; end
3467
-
3468
- private
3469
-
3470
- # @return [Boolean]
3471
- #
3472
- # source://activeresource//lib/active_resource/http_mock.rb#310
3473
- def headers_match?(req); end
3474
-
3475
- # @return [Boolean]
3476
- #
3477
- # source://activeresource//lib/active_resource/http_mock.rb#302
3478
- def same_path?(req); end
3479
- end
3480
-
3481
- # 409 Conflict
3482
- #
3483
- # source://activeresource//lib/active_resource/exceptions.rb#73
3484
- class ActiveResource::ResourceConflict < ::ActiveResource::ClientError; end
3485
-
3486
- # 410 Gone
3487
- #
3488
- # source://activeresource//lib/active_resource/exceptions.rb#77
3489
- class ActiveResource::ResourceGone < ::ActiveResource::ClientError; end
3490
-
3491
- # source://activeresource//lib/active_resource/validations.rb#7
3492
- class ActiveResource::ResourceInvalid < ::ActiveResource::ClientError; end
3493
-
3494
- # 404 Not Found
3495
- #
3496
- # source://activeresource//lib/active_resource/exceptions.rb#69
3497
- class ActiveResource::ResourceNotFound < ::ActiveResource::ClientError; end
3498
-
3499
- # source://activeresource//lib/active_resource/http_mock.rb#321
3500
- class ActiveResource::Response
3501
- # @return [Response] a new instance of Response
3502
- #
3503
- # source://activeresource//lib/active_resource/http_mock.rb#324
3504
- def initialize(body, message = T.unsafe(nil), headers = T.unsafe(nil)); end
3505
-
3506
- # Returns true if the other is a Response with an equal body, equal message
3507
- # and equal headers. Otherwise it returns false.
3508
- #
3509
- # source://activeresource//lib/active_resource/http_mock.rb#352
3510
- def ==(other); end
3511
-
3512
- # source://activeresource//lib/active_resource/http_mock.rb#342
3513
- def [](key); end
3514
-
3515
- # source://activeresource//lib/active_resource/http_mock.rb#346
3516
- def []=(key, value); end
3517
-
3518
- # Returns the value of attribute body.
3519
- #
3520
- # source://activeresource//lib/active_resource/http_mock.rb#322
3521
- def body; end
3522
-
3523
- # Sets the attribute body
3524
- #
3525
- # @param value the value to set the attribute body to.
3526
- #
3527
- # source://activeresource//lib/active_resource/http_mock.rb#322
3528
- def body=(_arg0); end
3529
-
3530
- # Returns the value of attribute code.
3531
- #
3532
- # source://activeresource//lib/active_resource/http_mock.rb#322
3533
- def code; end
3534
-
3535
- # Sets the attribute code
3536
- #
3537
- # @param value the value to set the attribute code to.
3538
- #
3539
- # source://activeresource//lib/active_resource/http_mock.rb#322
3540
- def code=(_arg0); end
3541
-
3542
- # Returns the value of attribute headers.
3543
- #
3544
- # source://activeresource//lib/active_resource/http_mock.rb#322
3545
- def headers; end
3546
-
3547
- # Sets the attribute headers
3548
- #
3549
- # @param value the value to set the attribute headers to.
3550
- #
3551
- # source://activeresource//lib/active_resource/http_mock.rb#322
3552
- def headers=(_arg0); end
3553
-
3554
- # Returns the value of attribute message.
3555
- #
3556
- # source://activeresource//lib/active_resource/http_mock.rb#322
3557
- def message; end
3558
-
3559
- # Sets the attribute message
3560
- #
3561
- # @param value the value to set the attribute message to.
3562
- #
3563
- # source://activeresource//lib/active_resource/http_mock.rb#322
3564
- def message=(_arg0); end
3565
-
3566
- # Returns true if code is 2xx,
3567
- # false otherwise.
3568
- #
3569
- # @return [Boolean]
3570
- #
3571
- # source://activeresource//lib/active_resource/http_mock.rb#338
3572
- def success?; end
3573
- end
3574
-
3575
- # Raised when a OpenSSL::SSL::SSLError occurs.
3576
- #
3577
- # source://activeresource//lib/active_resource/exceptions.rb#31
3578
- class ActiveResource::SSLError < ::ActiveResource::ConnectionError
3579
- # @return [SSLError] a new instance of SSLError
3580
- #
3581
- # source://activeresource//lib/active_resource/exceptions.rb#32
3582
- def initialize(message); end
3583
-
3584
- # source://activeresource//lib/active_resource/exceptions.rb#35
3585
- def to_s; end
3586
- end
3587
-
3588
- # source://activeresource//lib/active_resource/schema.rb#4
3589
- class ActiveResource::Schema
3590
- # The internals of an Active Resource Schema are very simple -
3591
- # unlike an Active Record TableDefinition (on which it is based).
3592
- # It provides a set of convenience methods for people to define their
3593
- # schema using the syntax:
3594
- # schema do
3595
- # string :foo
3596
- # integer :bar
3597
- # end
3598
- #
3599
- # The schema stores the name and type of each attribute. That is then
3600
- # read out by the schema method to populate the schema of the actual
3601
- # resource.
3602
- #
3603
- # @return [Schema] a new instance of Schema
3604
- #
3605
- # source://activeresource//lib/active_resource/schema.rb#25
3606
- def initialize; end
3607
-
3608
- # @raise [ArgumentError]
3609
- #
3610
- # source://activeresource//lib/active_resource/schema.rb#29
3611
- def attribute(name, type, options = T.unsafe(nil)); end
3612
-
3613
- # An array of attribute definitions, representing the attributes that
3614
- # have been defined.
3615
- #
3616
- # source://activeresource//lib/active_resource/schema.rb#11
3617
- def attrs; end
3618
-
3619
- # An array of attribute definitions, representing the attributes that
3620
- # have been defined.
3621
- #
3622
- # source://activeresource//lib/active_resource/schema.rb#11
3623
- def attrs=(_arg0); end
3624
-
3625
- # source://activeresource//lib/active_resource/schema.rb#51
3626
- def binary(*args); end
3627
-
3628
- # source://activeresource//lib/active_resource/schema.rb#51
3629
- def boolean(*args); end
3630
-
3631
- # source://activeresource//lib/active_resource/schema.rb#51
3632
- def date(*args); end
3633
-
3634
- # source://activeresource//lib/active_resource/schema.rb#51
3635
- def datetime(*args); end
3636
-
3637
- # source://activeresource//lib/active_resource/schema.rb#51
3638
- def decimal(*args); end
3639
-
3640
- # source://activeresource//lib/active_resource/schema.rb#51
3641
- def float(*args); end
3642
-
3643
- # source://activeresource//lib/active_resource/schema.rb#51
3644
- def integer(*args); end
3645
-
3646
- # source://activeresource//lib/active_resource/schema.rb#51
3647
- def string(*args); end
3648
-
3649
- # source://activeresource//lib/active_resource/schema.rb#51
3650
- def text(*args); end
3651
-
3652
- # source://activeresource//lib/active_resource/schema.rb#51
3653
- def time(*args); end
3654
-
3655
- # source://activeresource//lib/active_resource/schema.rb#51
3656
- def timestamp(*args); end
3657
- end
3658
-
3659
- # attributes can be known to be one of these types. They are easy to
3660
- # cast to/from.
3661
- #
3662
- # source://activeresource//lib/active_resource/schema.rb#7
3663
- ActiveResource::Schema::KNOWN_ATTRIBUTE_TYPES = T.let(T.unsafe(nil), Array)
3664
-
3665
- # 5xx Server Error
3666
- #
3667
- # source://activeresource//lib/active_resource/exceptions.rb#89
3668
- class ActiveResource::ServerError < ::ActiveResource::ConnectionError; end
3669
-
3670
- # source://activeresource//lib/active_resource/singleton.rb#4
3671
- module ActiveResource::Singleton
3672
- extend ::ActiveSupport::Concern
3673
-
3674
- mixes_in_class_methods ::ActiveResource::Singleton::ClassMethods
3675
-
3676
- # Deletes the resource from the remote service.
3677
- #
3678
- # ==== Examples
3679
- # weather = Weather.find
3680
- # weather.destroy
3681
- # Weather.find # 404 (Resource Not Found)
3682
- #
3683
- # source://activeresource//lib/active_resource/singleton.rb#85
3684
- def destroy; end
3685
-
3686
- protected
3687
-
3688
- # Create (i.e. \save to the remote service) the \new resource.
3689
- #
3690
- # source://activeresource//lib/active_resource/singleton.rb#99
3691
- def create; end
3692
-
3693
- # Update the resource on the remote service
3694
- #
3695
- # source://activeresource//lib/active_resource/singleton.rb#92
3696
- def update; end
3697
-
3698
- private
3699
-
3700
- # source://activeresource//lib/active_resource/singleton.rb#107
3701
- def singleton_path(options = T.unsafe(nil)); end
3702
- end
3703
-
3704
- # source://activeresource//lib/active_resource/singleton.rb#7
3705
- module ActiveResource::Singleton::ClassMethods
3706
- # Core method for finding singleton resources.
3707
- #
3708
- # ==== Arguments
3709
- # Takes a single argument of options
3710
- #
3711
- # ==== Options
3712
- # * <tt>:params</tt> - Sets the query and \prefix (nested URL) parameters.
3713
- #
3714
- # ==== Examples
3715
- # Weather.find
3716
- # # => GET /weather.json
3717
- #
3718
- # Weather.find(:params => {:degrees => 'fahrenheit'})
3719
- # # => GET /weather.json?degrees=fahrenheit
3720
- #
3721
- # == Failure or missing data
3722
- # A failure to find the requested object raises a ResourceNotFound exception.
3723
- #
3724
- # Inventory.find
3725
- # # => raises ResourceNotFound
3726
- #
3727
- # source://activeresource//lib/active_resource/singleton.rb#65
3728
- def find(options = T.unsafe(nil)); end
3729
-
3730
- # source://activeresource//lib/active_resource/singleton.rb#10
3731
- def singleton_name; end
3732
-
3733
- # Sets the attribute singleton_name
3734
- #
3735
- # @param value the value to set the attribute singleton_name to.
3736
- #
3737
- # source://activeresource//lib/active_resource/singleton.rb#8
3738
- def singleton_name=(_arg0); end
3739
-
3740
- # Gets the singleton path for the object. If the +query_options+ parameter is omitted, Rails
3741
- # will split from the \prefix options.
3742
- #
3743
- # ==== Options
3744
- # * +prefix_options+ - A \hash to add a \prefix to the request for nested URLs (e.g., <tt>:account_id => 19</tt>
3745
- # would yield a URL like <tt>/accounts/19/purchases.json</tt>).
3746
- #
3747
- # * +query_options+ - A \hash to add items to the query string for the request.
3748
- #
3749
- # ==== Examples
3750
- # Weather.singleton_path
3751
- # # => /weather.json
3752
- #
3753
- # class Inventory < ActiveResource::Base
3754
- # self.site = "https://37s.sunrise.com"
3755
- # self.prefix = "/products/:product_id/"
3756
- # end
3757
- #
3758
- # Inventory.singleton_path(:product_id => 5)
3759
- # # => /products/5/inventory.json
3760
- #
3761
- # Inventory.singleton_path({:product_id => 5}, {:sold => true})
3762
- # # => /products/5/inventory.json?sold=true
3763
- #
3764
- # source://activeresource//lib/active_resource/singleton.rb#38
3765
- def singleton_path(prefix_options = T.unsafe(nil), query_options = T.unsafe(nil)); end
3766
-
3767
- private
3768
-
3769
- # Find singleton resource
3770
- #
3771
- # source://activeresource//lib/active_resource/singleton.rb#71
3772
- def find_singleton(options); end
3773
- end
3774
-
3775
- # Raised when a Timeout::Error occurs.
3776
- #
3777
- # source://activeresource//lib/active_resource/exceptions.rb#23
3778
- class ActiveResource::TimeoutError < ::ActiveResource::ConnectionError
3779
- # @return [TimeoutError] a new instance of TimeoutError
3780
- #
3781
- # source://activeresource//lib/active_resource/exceptions.rb#24
3782
- def initialize(message); end
3783
-
3784
- # source://activeresource//lib/active_resource/exceptions.rb#27
3785
- def to_s; end
3786
- end
3787
-
3788
- # 429 Too Many Requests
3789
- #
3790
- # source://activeresource//lib/active_resource/exceptions.rb#85
3791
- class ActiveResource::TooManyRequests < ::ActiveResource::ClientError; end
3792
-
3793
- # source://activeresource//lib/active_resource.rb#36
3794
- ActiveResource::URI_PARSER = T.let(T.unsafe(nil), URI::RFC2396_Parser)
3795
-
3796
- # 401 Unauthorized
3797
- #
3798
- # source://activeresource//lib/active_resource/exceptions.rb#57
3799
- class ActiveResource::UnauthorizedAccess < ::ActiveResource::ClientError; end
3800
-
3801
- # source://activeresource//lib/active_resource/version.rb#4
3802
- module ActiveResource::VERSION; end
3803
-
3804
- # source://activeresource//lib/active_resource/version.rb#5
3805
- ActiveResource::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
3806
-
3807
- # source://activeresource//lib/active_resource/version.rb#6
3808
- ActiveResource::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
3809
-
3810
- # source://activeresource//lib/active_resource/version.rb#8
3811
- ActiveResource::VERSION::PRE = T.let(T.unsafe(nil), T.untyped)
3812
-
3813
- # source://activeresource//lib/active_resource/version.rb#10
3814
- ActiveResource::VERSION::STRING = T.let(T.unsafe(nil), String)
3815
-
3816
- # source://activeresource//lib/active_resource/version.rb#7
3817
- ActiveResource::VERSION::TINY = T.let(T.unsafe(nil), Integer)
3818
-
3819
- # Module to support validation and errors with Active Resource objects. The module overrides
3820
- # Base#save to rescue ActiveResource::ResourceInvalid exceptions and parse the errors returned
3821
- # in the web service response. The module also adds an +errors+ collection that mimics the interface
3822
- # of the errors provided by ActiveModel::Errors.
3823
- #
3824
- # ==== Example
3825
- #
3826
- # Consider a Person resource on the server requiring both a +first_name+ and a +last_name+ with a
3827
- # <tt>validates_presence_of :first_name, :last_name</tt> declaration in the model:
3828
- #
3829
- # person = Person.new(:first_name => "Jim", :last_name => "")
3830
- # person.save # => false (server returns an HTTP 422 status code and errors)
3831
- # person.valid? # => false
3832
- # person.errors.empty? # => false
3833
- # person.errors.count # => 1
3834
- # person.errors.full_messages # => ["Last name can't be empty"]
3835
- # person.errors[:last_name] # => ["can't be empty"]
3836
- # person.last_name = "Halpert"
3837
- # person.save # => true (and person is now saved to the remote service)
3838
- #
3839
- # source://activeresource//lib/active_resource/validations.rb#100
3840
- module ActiveResource::Validations
3841
- extend ::ActiveSupport::Concern
3842
- include GeneratedInstanceMethods
3843
- include ::ActiveSupport::Callbacks
3844
- include ::ActiveModel::Validations::HelperMethods
3845
- include ::ActiveModel::Validations
3846
-
3847
- mixes_in_class_methods GeneratedClassMethods
3848
-
3849
- # Returns the Errors object that holds all information about attribute error messages.
3850
- #
3851
- # source://activeresource//lib/active_resource/validations.rb#172
3852
- def errors; end
3853
-
3854
- # Loads the set of remote errors into the object's Errors based on the
3855
- # content-type of the error-block received.
3856
- #
3857
- # source://activeresource//lib/active_resource/validations.rb#136
3858
- def load_remote_errors(remote_errors, save_cache = T.unsafe(nil)); end
3859
-
3860
- # Validate a resource and save (POST) it to the remote web service.
3861
- # If any local validations fail - the save (POST) will not be attempted.
3862
- #
3863
- # source://activeresource//lib/active_resource/validations.rb#111
3864
- def save_with_validation(options = T.unsafe(nil)); end
3865
-
3866
- # Checks for errors on an object (i.e., is resource.errors empty?).
3867
- #
3868
- # Runs all the specified local validations and returns true if no errors
3869
- # were added, otherwise false.
3870
- # Runs local validations (eg those on your Active Resource model), and
3871
- # also any errors returned from the remote system the last time we
3872
- # saved.
3873
- # Remote errors can only be cleared by trying to re-save the resource.
3874
- #
3875
- # ==== Examples
3876
- # my_person = Person.create(params[:person])
3877
- # my_person.valid?
3878
- # # => true
3879
- #
3880
- # my_person.errors.add('login', 'can not be empty') if my_person.login == ''
3881
- # my_person.valid?
3882
- # # => false
3883
- #
3884
- # @return [Boolean]
3885
- #
3886
- # source://activeresource//lib/active_resource/validations.rb#163
3887
- def valid?(context = T.unsafe(nil)); end
3888
-
3889
- module GeneratedClassMethods
3890
- def __callbacks; end
3891
- def __callbacks=(value); end
3892
- def _validators; end
3893
- def _validators=(value); end
3894
- def _validators?; end
3895
- end
3896
-
3897
- module GeneratedInstanceMethods
3898
- def __callbacks; end
3899
- def _validators; end
3900
- def _validators?; end
3901
- end
3902
- end
3903
-
3904
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#5
3905
- module ThreadsafeAttributes
3906
- mixes_in_class_methods ::ThreadsafeAttributes::ClassMethods
3907
-
3908
- private
3909
-
3910
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#31
3911
- def get_threadsafe_attribute(name, main_thread); end
3912
-
3913
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#53
3914
- def get_threadsafe_attribute_by_thread(name, thread); end
3915
-
3916
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#42
3917
- def set_threadsafe_attribute(name, value, main_thread); end
3918
-
3919
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#57
3920
- def set_threadsafe_attribute_by_thread(name, value, thread); end
3921
-
3922
- # @return [Boolean]
3923
- #
3924
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#49
3925
- def threadsafe_attribute_defined?(name, main_thread); end
3926
-
3927
- # @return [Boolean]
3928
- #
3929
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#62
3930
- def threadsafe_attribute_defined_by_thread?(name, thread); end
3931
-
3932
- class << self
3933
- # @private
3934
- #
3935
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#6
3936
- def included(klass); end
3937
- end
3938
- end
3939
-
3940
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#10
3941
- module ThreadsafeAttributes::ClassMethods
3942
- # source://activeresource//lib/active_resource/threadsafe_attributes.rb#11
3943
- def threadsafe_attribute(*attrs); end
3944
- end