twilio-ruby 5.0.0.rc19 → 5.0.0.rc20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +8 -0
  3. data/README.md +2 -2
  4. data/VERSIONS.md +64 -0
  5. data/lib/twilio-ruby/framework/{exception.rb → error.rb} +3 -2
  6. data/lib/twilio-ruby/framework/page.rb +3 -3
  7. data/lib/twilio-ruby/framework/serialize.rb +9 -0
  8. data/lib/twilio-ruby/framework/version.rb +1 -1
  9. data/lib/twilio-ruby/http/http_client.rb +1 -0
  10. data/lib/twilio-ruby/jwt/access_token.rb +28 -0
  11. data/lib/twilio-ruby/rest/client.rb +64 -42
  12. data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +303 -0
  13. data/lib/twilio-ruby/rest/fax/v1/fax.rb +80 -6
  14. data/lib/twilio-ruby/rest/messaging/v1/service.rb +50 -3
  15. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
  16. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +2 -2
  17. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +2 -2
  18. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +2 -2
  19. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +2 -2
  20. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +38 -17
  21. data/lib/twilio-ruby/rest/preview/wireless/sim.rb +74 -2
  22. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +377 -0
  23. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +415 -0
  24. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +409 -0
  25. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +377 -0
  26. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +407 -0
  27. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +411 -0
  28. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +377 -0
  29. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +407 -0
  30. data/lib/twilio-ruby/rest/sync/v1/service.rb +469 -0
  31. data/lib/twilio-ruby/rest/sync/v1.rb +35 -0
  32. data/lib/twilio-ruby/rest/sync.rb +40 -0
  33. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +324 -0
  34. data/lib/twilio-ruby/rest/video/v1/room.rb +37 -0
  35. data/lib/twilio-ruby/rest/wireless/v1/command.rb +344 -0
  36. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +399 -0
  37. data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +222 -0
  38. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +502 -0
  39. data/lib/twilio-ruby/rest/wireless/v1.rb +53 -0
  40. data/lib/twilio-ruby/rest/wireless.rb +48 -0
  41. data/lib/twilio-ruby/security/request_validator.rb +19 -1
  42. data/lib/twilio-ruby/version.rb +1 -1
  43. data/spec/framework/serialize_spec.rb +20 -1
  44. data/spec/integration/accounts/v1/credential/public_key_spec.rb +5 -5
  45. data/spec/integration/api/v2010/account/address/dependent_phone_number_spec.rb +1 -1
  46. data/spec/integration/api/v2010/account/address_spec.rb +5 -5
  47. data/spec/integration/api/v2010/account/application_spec.rb +5 -5
  48. data/spec/integration/api/v2010/account/authorized_connect_app_spec.rb +2 -2
  49. data/spec/integration/api/v2010/account/available_phone_number/local_spec.rb +1 -1
  50. data/spec/integration/api/v2010/account/available_phone_number/mobile_spec.rb +1 -1
  51. data/spec/integration/api/v2010/account/available_phone_number/toll_free_spec.rb +1 -1
  52. data/spec/integration/api/v2010/account/available_phone_number_spec.rb +2 -2
  53. data/spec/integration/api/v2010/account/call/feedback_spec.rb +3 -3
  54. data/spec/integration/api/v2010/account/call/feedback_summary_spec.rb +3 -3
  55. data/spec/integration/api/v2010/account/call/notification_spec.rb +3 -3
  56. data/spec/integration/api/v2010/account/call/recording_spec.rb +3 -3
  57. data/spec/integration/api/v2010/account/call_spec.rb +5 -5
  58. data/spec/integration/api/v2010/account/conference/participant_spec.rb +5 -5
  59. data/spec/integration/api/v2010/account/conference_spec.rb +3 -3
  60. data/spec/integration/api/v2010/account/connect_app_spec.rb +3 -3
  61. data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension_spec.rb +2 -2
  62. data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on_spec.rb +4 -4
  63. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +2 -2
  64. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +2 -2
  65. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +2 -2
  66. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +5 -5
  67. data/spec/integration/api/v2010/account/key_spec.rb +4 -4
  68. data/spec/integration/api/v2010/account/message/feedback_spec.rb +1 -1
  69. data/spec/integration/api/v2010/account/message/media_spec.rb +3 -3
  70. data/spec/integration/api/v2010/account/message_spec.rb +5 -5
  71. data/spec/integration/api/v2010/account/new_key_spec.rb +1 -1
  72. data/spec/integration/api/v2010/account/new_signing_key_spec.rb +1 -1
  73. data/spec/integration/api/v2010/account/notification_spec.rb +3 -3
  74. data/spec/integration/api/v2010/account/outgoing_caller_id_spec.rb +4 -4
  75. data/spec/integration/api/v2010/account/queue/member_spec.rb +3 -3
  76. data/spec/integration/api/v2010/account/queue_spec.rb +5 -5
  77. data/spec/integration/api/v2010/account/recording/add_on_result/payload_spec.rb +3 -3
  78. data/spec/integration/api/v2010/account/recording/add_on_result_spec.rb +3 -3
  79. data/spec/integration/api/v2010/account/recording/transcription_spec.rb +3 -3
  80. data/spec/integration/api/v2010/account/recording_spec.rb +3 -3
  81. data/spec/integration/api/v2010/account/short_code_spec.rb +3 -3
  82. data/spec/integration/api/v2010/account/signing_key_spec.rb +4 -4
  83. data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +5 -5
  84. data/spec/integration/api/v2010/account/sip/credential_list_spec.rb +5 -5
  85. data/spec/integration/api/v2010/account/sip/domain/credential_list_mapping_spec.rb +4 -4
  86. data/spec/integration/api/v2010/account/sip/domain/ip_access_control_list_mapping_spec.rb +4 -4
  87. data/spec/integration/api/v2010/account/sip/domain_spec.rb +5 -5
  88. data/spec/integration/api/v2010/account/sip/ip_access_control_list/ip_address_spec.rb +5 -5
  89. data/spec/integration/api/v2010/account/sip/ip_access_control_list_spec.rb +5 -5
  90. data/spec/integration/api/v2010/account/token_spec.rb +1 -1
  91. data/spec/integration/api/v2010/account/transcription_spec.rb +3 -3
  92. data/spec/integration/api/v2010/account/usage/record/all_time_spec.rb +1 -1
  93. data/spec/integration/api/v2010/account/usage/record/daily_spec.rb +1 -1
  94. data/spec/integration/api/v2010/account/usage/record/last_month_spec.rb +1 -1
  95. data/spec/integration/api/v2010/account/usage/record/monthly_spec.rb +1 -1
  96. data/spec/integration/api/v2010/account/usage/record/this_month_spec.rb +1 -1
  97. data/spec/integration/api/v2010/account/usage/record/today_spec.rb +1 -1
  98. data/spec/integration/api/v2010/account/usage/record/yearly_spec.rb +1 -1
  99. data/spec/integration/api/v2010/account/usage/record/yesterday_spec.rb +1 -1
  100. data/spec/integration/api/v2010/account/usage/record_spec.rb +1 -1
  101. data/spec/integration/api/v2010/account/usage/trigger_spec.rb +5 -5
  102. data/spec/integration/api/v2010/account/validation_request_spec.rb +1 -1
  103. data/spec/integration/api/v2010/account_spec.rb +4 -4
  104. data/spec/integration/chat/v1/credential_spec.rb +5 -5
  105. data/spec/integration/chat/v1/service/channel/invite_spec.rb +4 -4
  106. data/spec/integration/chat/v1/service/channel/member_spec.rb +5 -5
  107. data/spec/integration/chat/v1/service/channel/message_spec.rb +5 -5
  108. data/spec/integration/chat/v1/service/channel_spec.rb +5 -5
  109. data/spec/integration/chat/v1/service/role_spec.rb +5 -5
  110. data/spec/integration/chat/v1/service/user/user_channel_spec.rb +1 -1
  111. data/spec/integration/chat/v1/service/user_spec.rb +5 -5
  112. data/spec/integration/chat/v1/service_spec.rb +5 -5
  113. data/spec/integration/chat/v2/credential_spec.rb +5 -5
  114. data/spec/integration/chat/v2/service/channel/invite_spec.rb +4 -4
  115. data/spec/integration/chat/v2/service/channel/member_spec.rb +5 -5
  116. data/spec/integration/chat/v2/service/channel/message_spec.rb +5 -5
  117. data/spec/integration/chat/v2/service/channel_spec.rb +5 -5
  118. data/spec/integration/chat/v2/service/role_spec.rb +5 -5
  119. data/spec/integration/chat/v2/service/user/user_channel_spec.rb +1 -1
  120. data/spec/integration/chat/v2/service/user_spec.rb +5 -5
  121. data/spec/integration/chat/v2/service_spec.rb +5 -5
  122. data/spec/integration/fax/v1/fax/fax_media_spec.rb +126 -0
  123. data/spec/integration/fax/v1/fax_spec.rb +48 -7
  124. data/spec/integration/ip_messaging/v1/credential_spec.rb +5 -5
  125. data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +4 -4
  126. data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +5 -5
  127. data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +5 -5
  128. data/spec/integration/ip_messaging/v1/service/channel_spec.rb +5 -5
  129. data/spec/integration/ip_messaging/v1/service/role_spec.rb +5 -5
  130. data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +1 -1
  131. data/spec/integration/ip_messaging/v1/service/user_spec.rb +5 -5
  132. data/spec/integration/ip_messaging/v1/service_spec.rb +5 -5
  133. data/spec/integration/ip_messaging/v2/credential_spec.rb +5 -5
  134. data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +4 -4
  135. data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +5 -5
  136. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +5 -5
  137. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +5 -5
  138. data/spec/integration/ip_messaging/v2/service/role_spec.rb +5 -5
  139. data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +1 -1
  140. data/spec/integration/ip_messaging/v2/service/user_spec.rb +5 -5
  141. data/spec/integration/ip_messaging/v2/service_spec.rb +5 -5
  142. data/spec/integration/lookups/v1/phone_number_spec.rb +1 -1
  143. data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +4 -4
  144. data/spec/integration/messaging/v1/service/phone_number_spec.rb +4 -4
  145. data/spec/integration/messaging/v1/service/short_code_spec.rb +4 -4
  146. data/spec/integration/messaging/v1/service_spec.rb +21 -5
  147. data/spec/integration/monitor/v1/alert_spec.rb +3 -3
  148. data/spec/integration/monitor/v1/event_spec.rb +2 -2
  149. data/spec/integration/notify/v1/credential_spec.rb +5 -5
  150. data/spec/integration/notify/v1/service/binding_spec.rb +4 -4
  151. data/spec/integration/notify/v1/service/notification_spec.rb +1 -1
  152. data/spec/integration/notify/v1/service/segment_spec.rb +1 -1
  153. data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +3 -3
  154. data/spec/integration/notify/v1/service/user/user_binding_spec.rb +4 -4
  155. data/spec/integration/notify/v1/service/user_spec.rb +4 -4
  156. data/spec/integration/notify/v1/service_spec.rb +5 -5
  157. data/spec/integration/preview/marketplace/available_add_on/available_add_on_extension_spec.rb +2 -2
  158. data/spec/integration/preview/marketplace/available_add_on_spec.rb +2 -2
  159. data/spec/integration/preview/marketplace/installed_add_on/installed_add_on_extension_spec.rb +3 -3
  160. data/spec/integration/preview/marketplace/installed_add_on_spec.rb +5 -5
  161. data/spec/integration/preview/sync/service/document/document_permission_spec.rb +4 -4
  162. data/spec/integration/preview/sync/service/document_spec.rb +6 -6
  163. data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +7 -7
  164. data/spec/integration/preview/sync/service/sync_list/sync_list_permission_spec.rb +4 -4
  165. data/spec/integration/preview/sync/service/sync_list_spec.rb +4 -4
  166. data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +7 -7
  167. data/spec/integration/preview/sync/service/sync_map/sync_map_permission_spec.rb +4 -4
  168. data/spec/integration/preview/sync/service/sync_map_spec.rb +4 -4
  169. data/spec/integration/preview/sync/service_spec.rb +5 -5
  170. data/spec/integration/preview/wireless/command_spec.rb +3 -3
  171. data/spec/integration/preview/wireless/rate_plan_spec.rb +45 -45
  172. data/spec/integration/preview/wireless/sim/usage_spec.rb +1 -1
  173. data/spec/integration/preview/wireless/sim_spec.rb +27 -3
  174. data/spec/integration/pricing/v1/messaging/country_spec.rb +2 -2
  175. data/spec/integration/pricing/v1/phone_number/country_spec.rb +2 -2
  176. data/spec/integration/pricing/v1/voice/country_spec.rb +2 -2
  177. data/spec/integration/pricing/v1/voice/number_spec.rb +1 -1
  178. data/spec/integration/sync/v1/service/document/document_permission_spec.rb +206 -0
  179. data/spec/integration/sync/v1/service/document_spec.rb +254 -0
  180. data/spec/integration/sync/v1/service/sync_list/sync_list_item_spec.rb +256 -0
  181. data/spec/integration/sync/v1/service/sync_list/sync_list_permission_spec.rb +206 -0
  182. data/spec/integration/sync/v1/service/sync_list_spec.rb +207 -0
  183. data/spec/integration/sync/v1/service/sync_map/sync_map_item_spec.rb +257 -0
  184. data/spec/integration/sync/v1/service/sync_map/sync_map_permission_spec.rb +206 -0
  185. data/spec/integration/sync/v1/service/sync_map_spec.rb +207 -0
  186. data/spec/integration/sync/v1/service_spec.rb +244 -0
  187. data/spec/integration/taskrouter/v1/workspace/activity_spec.rb +5 -5
  188. data/spec/integration/taskrouter/v1/workspace/event_spec.rb +2 -2
  189. data/spec/integration/taskrouter/v1/workspace/task/reservation_spec.rb +3 -3
  190. data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +2 -2
  191. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_statistics_spec.rb +1 -1
  192. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queues_statistics_spec.rb +1 -1
  193. data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +5 -5
  194. data/spec/integration/taskrouter/v1/workspace/task_spec.rb +5 -5
  195. data/spec/integration/taskrouter/v1/workspace/worker/reservation_spec.rb +3 -3
  196. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +3 -3
  197. data/spec/integration/taskrouter/v1/workspace/worker/worker_statistics_spec.rb +1 -1
  198. data/spec/integration/taskrouter/v1/workspace/worker/workers_statistics_spec.rb +1 -1
  199. data/spec/integration/taskrouter/v1/workspace/worker_spec.rb +5 -5
  200. data/spec/integration/taskrouter/v1/workspace/workflow/workflow_statistics_spec.rb +1 -1
  201. data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +5 -5
  202. data/spec/integration/taskrouter/v1/workspace/workspace_statistics_spec.rb +1 -1
  203. data/spec/integration/taskrouter/v1/workspace_spec.rb +5 -5
  204. data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +4 -4
  205. data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +4 -4
  206. data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +5 -5
  207. data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +4 -4
  208. data/spec/integration/trunking/v1/trunk_spec.rb +5 -5
  209. data/spec/integration/video/v1/recording_spec.rb +3 -3
  210. data/spec/integration/video/v1/room/recording_spec.rb +145 -0
  211. data/spec/integration/video/v1/room_spec.rb +20 -8
  212. data/spec/integration/wireless/v1/command_spec.rb +166 -0
  213. data/spec/integration/wireless/v1/rate_plan_spec.rb +260 -0
  214. data/spec/integration/wireless/v1/sim/usage_record_spec.rb +65 -0
  215. data/spec/integration/wireless/v1/sim_spec.rb +208 -0
  216. data/twilio-ruby.gemspec +1 -1
  217. metadata +55 -5
@@ -0,0 +1,344 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Wireless < Domain
10
+ class V1 < Version
11
+ class CommandList < ListResource
12
+ ##
13
+ # Initialize the CommandList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [CommandList] CommandList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ @uri = "/Commands"
22
+ end
23
+
24
+ ##
25
+ # Lists CommandInstance records from the API as a list.
26
+ # Unlike stream(), this operation is eager and will load `limit` records into
27
+ # memory before returning.
28
+ # @param [String] sim The sim
29
+ # @param [command.Status] status The status
30
+ # @param [command.Direction] direction The direction
31
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
32
+ # guarantees to never return more than limit. Default is no limit
33
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
34
+ # the default value of 50 records. If no page_size is defined
35
+ # but a limit is defined, stream() will attempt to read the
36
+ # limit with the most efficient page size, i.e. min(limit, 1000)
37
+ # @return [Array] Array of up to limit results
38
+ def list(sim: nil, status: nil, direction: nil, limit: nil, page_size: nil)
39
+ self.stream(
40
+ sim: sim,
41
+ status: status,
42
+ direction: direction,
43
+ limit: limit,
44
+ page_size: page_size
45
+ ).entries
46
+ end
47
+
48
+ ##
49
+ # Streams CommandInstance records from the API as an Enumerable.
50
+ # This operation lazily loads records as efficiently as possible until the limit
51
+ # is reached.
52
+ # @param [String] sim The sim
53
+ # @param [command.Status] status The status
54
+ # @param [command.Direction] direction The direction
55
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
56
+ # guarantees to never return more than limit. Default is no limit
57
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
58
+ # the default value of 50 records. If no page_size is defined
59
+ # but a limit is defined, stream() will attempt to read the
60
+ # limit with the most efficient page size, i.e. min(limit, 1000)
61
+ # @return [Enumerable] Enumerable that will yield up to limit results
62
+ def stream(sim: nil, status: nil, direction: nil, limit: nil, page_size: nil)
63
+ limits = @version.read_limits(limit, page_size)
64
+
65
+ page = self.page(
66
+ sim: sim,
67
+ status: status,
68
+ direction: direction,
69
+ page_size: limits[:page_size],
70
+ )
71
+
72
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
73
+ end
74
+
75
+ ##
76
+ # When passed a block, yields CommandInstance records from the API.
77
+ # This operation lazily loads records as efficiently as possible until the limit
78
+ # is reached.
79
+ # @param [String] sim The sim
80
+ # @param [command.Status] status The status
81
+ # @param [command.Direction] direction The direction
82
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
83
+ # guarantees to never return more than limit. Default is no limit
84
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
85
+ # the default value of 50 records. If no page_size is defined
86
+ # but a limit is defined, stream() will attempt to read the
87
+ # limit with the most efficient page size, i.e. min(limit, 1000)
88
+ def each
89
+ limits = @version.read_limits
90
+
91
+ page = self.page(
92
+ page_size: limits[:page_size],
93
+ )
94
+
95
+ @version.stream(page,
96
+ limit: limits[:limit],
97
+ page_limit: limits[:page_limit]).each {|x| yield x}
98
+ end
99
+
100
+ ##
101
+ # Retrieve a single page of CommandInstance records from the API.
102
+ # Request is executed immediately.
103
+ # @param [String] sim The sim
104
+ # @param [command.Status] status The status
105
+ # @param [command.Direction] direction The direction
106
+ # @param [String] page_token PageToken provided by the API
107
+ # @param [Integer] page_number Page Number, this value is simply for client state
108
+ # @param [Integer] page_size Number of records to return, defaults to 50
109
+ # @return [Page] Page of CommandInstance
110
+ def page(sim: nil, status: nil, direction: nil, page_token: nil, page_number: nil, page_size: nil)
111
+ params = {
112
+ 'Sim' => sim,
113
+ 'Status' => status,
114
+ 'Direction' => direction,
115
+ 'PageToken' => page_token,
116
+ 'Page' => page_number,
117
+ 'PageSize' => page_size,
118
+ }
119
+ response = @version.page(
120
+ 'GET',
121
+ @uri,
122
+ params
123
+ )
124
+ return CommandPage.new(@version, response, @solution)
125
+ end
126
+
127
+ ##
128
+ # Retrieve a single page of CommandInstance records from the API.
129
+ # Request is executed immediately.
130
+ # @param [String] command The command
131
+ # @param [String] sim The sim
132
+ # @param [String] callback_method The callback_method
133
+ # @param [String] callback_url The callback_url
134
+ # @param [command.CommandMode] command_mode The command_mode
135
+ # @param [String] include_sid The include_sid
136
+ # @return [CommandInstance] Newly created CommandInstance
137
+ def create(command: nil, sim: nil, callback_method: nil, callback_url: nil, command_mode: nil, include_sid: nil)
138
+ data = {
139
+ 'Command' => command,
140
+ 'Sim' => sim,
141
+ 'CallbackMethod' => callback_method,
142
+ 'CallbackUrl' => callback_url,
143
+ 'CommandMode' => command_mode,
144
+ 'IncludeSid' => include_sid,
145
+ }
146
+
147
+ payload = @version.create(
148
+ 'POST',
149
+ @uri,
150
+ data: data
151
+ )
152
+
153
+ return CommandInstance.new(
154
+ @version,
155
+ payload,
156
+ )
157
+ end
158
+
159
+ ##
160
+ # Provide a user friendly representation
161
+ def to_s
162
+ '#<Twilio.Wireless.V1.CommandList>'
163
+ end
164
+ end
165
+
166
+ class CommandPage < Page
167
+ ##
168
+ # Initialize the CommandPage
169
+ # @param [Version] version Version that contains the resource
170
+ # @param [Response] response Response from the API
171
+ # @param [Hash] solution Path solution for the resource
172
+ # @return [CommandPage] CommandPage
173
+ def initialize(version, response, solution)
174
+ super(version, response)
175
+
176
+ # Path Solution
177
+ @solution = solution
178
+ end
179
+
180
+ ##
181
+ # Build an instance of CommandInstance
182
+ # @param [Hash] payload Payload response from the API
183
+ # @return [CommandInstance] CommandInstance
184
+ def get_instance(payload)
185
+ return CommandInstance.new(
186
+ @version,
187
+ payload,
188
+ )
189
+ end
190
+
191
+ ##
192
+ # Provide a user friendly representation
193
+ def to_s
194
+ '<Twilio.Wireless.V1.CommandPage>'
195
+ end
196
+ end
197
+
198
+ class CommandContext < InstanceContext
199
+ ##
200
+ # Initialize the CommandContext
201
+ # @param [Version] version Version that contains the resource
202
+ # @param [String] sid The sid
203
+ # @return [CommandContext] CommandContext
204
+ def initialize(version, sid)
205
+ super(version)
206
+
207
+ # Path Solution
208
+ @solution = {
209
+ sid: sid,
210
+ }
211
+ @uri = "/Commands/#{@solution[:sid]}"
212
+ end
213
+
214
+ ##
215
+ # Fetch a CommandInstance
216
+ # @return [CommandInstance] Fetched CommandInstance
217
+ def fetch
218
+ params = {}
219
+
220
+ payload = @version.fetch(
221
+ 'GET',
222
+ @uri,
223
+ params,
224
+ )
225
+
226
+ return CommandInstance.new(
227
+ @version,
228
+ payload,
229
+ sid: @solution[:sid],
230
+ )
231
+ end
232
+
233
+ ##
234
+ # Provide a user friendly representation
235
+ def to_s
236
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
237
+ "#<Twilio.Wireless.V1.CommandContext #{context}>"
238
+ end
239
+ end
240
+
241
+ class CommandInstance < InstanceResource
242
+ ##
243
+ # Initialize the CommandInstance
244
+ # @param [Version] version Version that contains the resource
245
+ # @param [Hash] payload payload that contains response from Twilio
246
+ # @param [String] sid The sid
247
+ # @return [CommandInstance] CommandInstance
248
+ def initialize(version, payload, sid: nil)
249
+ super(version)
250
+
251
+ # Marshaled Properties
252
+ @properties = {
253
+ 'sid' => payload['sid'],
254
+ 'account_sid' => payload['account_sid'],
255
+ 'sim_sid' => payload['sim_sid'],
256
+ 'command' => payload['command'],
257
+ 'command_mode' => payload['command_mode'],
258
+ 'status' => payload['status'],
259
+ 'direction' => payload['direction'],
260
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
261
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
262
+ 'url' => payload['url'],
263
+ }
264
+
265
+ # Context
266
+ @instance_context = nil
267
+ @params = {
268
+ 'sid' => sid || @properties['sid'],
269
+ }
270
+ end
271
+
272
+ ##
273
+ # Generate an instance context for the instance, the context is capable of
274
+ # performing various actions. All instance actions are proxied to the context
275
+ # @param [Version] version Version that contains the resource
276
+ # @return [CommandContext] CommandContext for this CommandInstance
277
+ def context
278
+ unless @instance_context
279
+ @instance_context = CommandContext.new(
280
+ @version,
281
+ @params['sid'],
282
+ )
283
+ end
284
+ @instance_context
285
+ end
286
+
287
+ def sid
288
+ @properties['sid']
289
+ end
290
+
291
+ def account_sid
292
+ @properties['account_sid']
293
+ end
294
+
295
+ def sim_sid
296
+ @properties['sim_sid']
297
+ end
298
+
299
+ def command
300
+ @properties['command']
301
+ end
302
+
303
+ def command_mode
304
+ @properties['command_mode']
305
+ end
306
+
307
+ def status
308
+ @properties['status']
309
+ end
310
+
311
+ def direction
312
+ @properties['direction']
313
+ end
314
+
315
+ def date_created
316
+ @properties['date_created']
317
+ end
318
+
319
+ def date_updated
320
+ @properties['date_updated']
321
+ end
322
+
323
+ def url
324
+ @properties['url']
325
+ end
326
+
327
+ ##
328
+ # Fetch a CommandInstance
329
+ # @return [CommandInstance] Fetched CommandInstance
330
+ def fetch
331
+ context.fetch
332
+ end
333
+
334
+ ##
335
+ # Provide a user friendly representation
336
+ def to_s
337
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
338
+ "<Twilio.Wireless.V1.CommandInstance #{values}>"
339
+ end
340
+ end
341
+ end
342
+ end
343
+ end
344
+ end
@@ -0,0 +1,399 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Wireless < Domain
10
+ class V1 < Version
11
+ class RatePlanList < ListResource
12
+ ##
13
+ # Initialize the RatePlanList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [RatePlanList] RatePlanList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ @uri = "/RatePlans"
22
+ end
23
+
24
+ ##
25
+ # Lists RatePlanInstance records from the API as a list.
26
+ # Unlike stream(), this operation is eager and will load `limit` records into
27
+ # memory before returning.
28
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
29
+ # guarantees to never return more than limit. Default is no limit
30
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
31
+ # the default value of 50 records. If no page_size is defined
32
+ # but a limit is defined, stream() will attempt to read the
33
+ # limit with the most efficient page size, i.e. min(limit, 1000)
34
+ # @return [Array] Array of up to limit results
35
+ def list(limit: nil, page_size: nil)
36
+ self.stream(
37
+ limit: limit,
38
+ page_size: page_size
39
+ ).entries
40
+ end
41
+
42
+ ##
43
+ # Streams RatePlanInstance records from the API as an Enumerable.
44
+ # This operation lazily loads records as efficiently as possible until the limit
45
+ # is reached.
46
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
47
+ # guarantees to never return more than limit. Default is no limit
48
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
49
+ # the default value of 50 records. If no page_size is defined
50
+ # but a limit is defined, stream() will attempt to read the
51
+ # limit with the most efficient page size, i.e. min(limit, 1000)
52
+ # @return [Enumerable] Enumerable that will yield up to limit results
53
+ def stream(limit: nil, page_size: nil)
54
+ limits = @version.read_limits(limit, page_size)
55
+
56
+ page = self.page(
57
+ page_size: limits[:page_size],
58
+ )
59
+
60
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
61
+ end
62
+
63
+ ##
64
+ # When passed a block, yields RatePlanInstance records from the API.
65
+ # This operation lazily loads records as efficiently as possible until the limit
66
+ # is reached.
67
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
68
+ # guarantees to never return more than limit. Default is no limit
69
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
70
+ # the default value of 50 records. If no page_size is defined
71
+ # but a limit is defined, stream() will attempt to read the
72
+ # limit with the most efficient page size, i.e. min(limit, 1000)
73
+ def each
74
+ limits = @version.read_limits
75
+
76
+ page = self.page(
77
+ page_size: limits[:page_size],
78
+ )
79
+
80
+ @version.stream(page,
81
+ limit: limits[:limit],
82
+ page_limit: limits[:page_limit]).each {|x| yield x}
83
+ end
84
+
85
+ ##
86
+ # Retrieve a single page of RatePlanInstance records from the API.
87
+ # Request is executed immediately.
88
+ # @param [String] page_token PageToken provided by the API
89
+ # @param [Integer] page_number Page Number, this value is simply for client state
90
+ # @param [Integer] page_size Number of records to return, defaults to 50
91
+ # @return [Page] Page of RatePlanInstance
92
+ def page(page_token: nil, page_number: nil, page_size: nil)
93
+ params = {
94
+ 'PageToken' => page_token,
95
+ 'Page' => page_number,
96
+ 'PageSize' => page_size,
97
+ }
98
+ response = @version.page(
99
+ 'GET',
100
+ @uri,
101
+ params
102
+ )
103
+ return RatePlanPage.new(@version, response, @solution)
104
+ end
105
+
106
+ ##
107
+ # Retrieve a single page of RatePlanInstance records from the API.
108
+ # Request is executed immediately.
109
+ # @param [String] unique_name The unique_name
110
+ # @param [String] friendly_name The friendly_name
111
+ # @param [Boolean] data_enabled The data_enabled
112
+ # @param [String] data_limit The data_limit
113
+ # @param [String] data_metering The data_metering
114
+ # @param [Boolean] messaging_enabled The messaging_enabled
115
+ # @param [Boolean] voice_enabled The voice_enabled
116
+ # @param [Boolean] national_roaming_enabled The national_roaming_enabled
117
+ # @param [String] international_roaming The international_roaming
118
+ # @return [RatePlanInstance] Newly created RatePlanInstance
119
+ def create(unique_name: nil, friendly_name: nil, data_enabled: nil, data_limit: nil, data_metering: nil, messaging_enabled: nil, voice_enabled: nil, national_roaming_enabled: nil, international_roaming: nil)
120
+ data = {
121
+ 'UniqueName' => unique_name,
122
+ 'FriendlyName' => friendly_name,
123
+ 'DataEnabled' => data_enabled,
124
+ 'DataLimit' => data_limit,
125
+ 'DataMetering' => data_metering,
126
+ 'MessagingEnabled' => messaging_enabled,
127
+ 'VoiceEnabled' => voice_enabled,
128
+ 'NationalRoamingEnabled' => national_roaming_enabled,
129
+ 'InternationalRoaming' => international_roaming,
130
+ }
131
+
132
+ payload = @version.create(
133
+ 'POST',
134
+ @uri,
135
+ data: data
136
+ )
137
+
138
+ return RatePlanInstance.new(
139
+ @version,
140
+ payload,
141
+ )
142
+ end
143
+
144
+ ##
145
+ # Provide a user friendly representation
146
+ def to_s
147
+ '#<Twilio.Wireless.V1.RatePlanList>'
148
+ end
149
+ end
150
+
151
+ class RatePlanPage < Page
152
+ ##
153
+ # Initialize the RatePlanPage
154
+ # @param [Version] version Version that contains the resource
155
+ # @param [Response] response Response from the API
156
+ # @param [Hash] solution Path solution for the resource
157
+ # @return [RatePlanPage] RatePlanPage
158
+ def initialize(version, response, solution)
159
+ super(version, response)
160
+
161
+ # Path Solution
162
+ @solution = solution
163
+ end
164
+
165
+ ##
166
+ # Build an instance of RatePlanInstance
167
+ # @param [Hash] payload Payload response from the API
168
+ # @return [RatePlanInstance] RatePlanInstance
169
+ def get_instance(payload)
170
+ return RatePlanInstance.new(
171
+ @version,
172
+ payload,
173
+ )
174
+ end
175
+
176
+ ##
177
+ # Provide a user friendly representation
178
+ def to_s
179
+ '<Twilio.Wireless.V1.RatePlanPage>'
180
+ end
181
+ end
182
+
183
+ class RatePlanContext < InstanceContext
184
+ ##
185
+ # Initialize the RatePlanContext
186
+ # @param [Version] version Version that contains the resource
187
+ # @param [String] sid The sid
188
+ # @return [RatePlanContext] RatePlanContext
189
+ def initialize(version, sid)
190
+ super(version)
191
+
192
+ # Path Solution
193
+ @solution = {
194
+ sid: sid,
195
+ }
196
+ @uri = "/RatePlans/#{@solution[:sid]}"
197
+ end
198
+
199
+ ##
200
+ # Fetch a RatePlanInstance
201
+ # @return [RatePlanInstance] Fetched RatePlanInstance
202
+ def fetch
203
+ params = {}
204
+
205
+ payload = @version.fetch(
206
+ 'GET',
207
+ @uri,
208
+ params,
209
+ )
210
+
211
+ return RatePlanInstance.new(
212
+ @version,
213
+ payload,
214
+ sid: @solution[:sid],
215
+ )
216
+ end
217
+
218
+ ##
219
+ # Update the RatePlanInstance
220
+ # @param [String] unique_name The unique_name
221
+ # @param [String] friendly_name The friendly_name
222
+ # @return [RatePlanInstance] Updated RatePlanInstance
223
+ def update(unique_name: nil, friendly_name: nil)
224
+ data = {
225
+ 'UniqueName' => unique_name,
226
+ 'FriendlyName' => friendly_name,
227
+ }
228
+
229
+ payload = @version.update(
230
+ 'POST',
231
+ @uri,
232
+ data: data,
233
+ )
234
+
235
+ return RatePlanInstance.new(
236
+ @version,
237
+ payload,
238
+ sid: @solution[:sid],
239
+ )
240
+ end
241
+
242
+ ##
243
+ # Deletes the RatePlanInstance
244
+ # @return [Boolean] true if delete succeeds, true otherwise
245
+ def delete
246
+ return @version.delete('delete', @uri)
247
+ end
248
+
249
+ ##
250
+ # Provide a user friendly representation
251
+ def to_s
252
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
253
+ "#<Twilio.Wireless.V1.RatePlanContext #{context}>"
254
+ end
255
+ end
256
+
257
+ class RatePlanInstance < InstanceResource
258
+ ##
259
+ # Initialize the RatePlanInstance
260
+ # @param [Version] version Version that contains the resource
261
+ # @param [Hash] payload payload that contains response from Twilio
262
+ # @param [String] sid The sid
263
+ # @return [RatePlanInstance] RatePlanInstance
264
+ def initialize(version, payload, sid: nil)
265
+ super(version)
266
+
267
+ # Marshaled Properties
268
+ @properties = {
269
+ 'sid' => payload['sid'],
270
+ 'unique_name' => payload['unique_name'],
271
+ 'account_sid' => payload['account_sid'],
272
+ 'friendly_name' => payload['friendly_name'],
273
+ 'data_enabled' => payload['data_enabled'],
274
+ 'data_metering' => payload['data_metering'],
275
+ 'data_limit' => payload['data_limit'].to_i,
276
+ 'messaging_enabled' => payload['messaging_enabled'],
277
+ 'voice_enabled' => payload['voice_enabled'],
278
+ 'national_roaming_enabled' => payload['national_roaming_enabled'],
279
+ 'international_roaming' => payload['international_roaming'],
280
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
281
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
282
+ 'url' => payload['url'],
283
+ }
284
+
285
+ # Context
286
+ @instance_context = nil
287
+ @params = {
288
+ 'sid' => sid || @properties['sid'],
289
+ }
290
+ end
291
+
292
+ ##
293
+ # Generate an instance context for the instance, the context is capable of
294
+ # performing various actions. All instance actions are proxied to the context
295
+ # @param [Version] version Version that contains the resource
296
+ # @return [RatePlanContext] RatePlanContext for this RatePlanInstance
297
+ def context
298
+ unless @instance_context
299
+ @instance_context = RatePlanContext.new(
300
+ @version,
301
+ @params['sid'],
302
+ )
303
+ end
304
+ @instance_context
305
+ end
306
+
307
+ def sid
308
+ @properties['sid']
309
+ end
310
+
311
+ def unique_name
312
+ @properties['unique_name']
313
+ end
314
+
315
+ def account_sid
316
+ @properties['account_sid']
317
+ end
318
+
319
+ def friendly_name
320
+ @properties['friendly_name']
321
+ end
322
+
323
+ def data_enabled
324
+ @properties['data_enabled']
325
+ end
326
+
327
+ def data_metering
328
+ @properties['data_metering']
329
+ end
330
+
331
+ def data_limit
332
+ @properties['data_limit']
333
+ end
334
+
335
+ def messaging_enabled
336
+ @properties['messaging_enabled']
337
+ end
338
+
339
+ def voice_enabled
340
+ @properties['voice_enabled']
341
+ end
342
+
343
+ def national_roaming_enabled
344
+ @properties['national_roaming_enabled']
345
+ end
346
+
347
+ def international_roaming
348
+ @properties['international_roaming']
349
+ end
350
+
351
+ def date_created
352
+ @properties['date_created']
353
+ end
354
+
355
+ def date_updated
356
+ @properties['date_updated']
357
+ end
358
+
359
+ def url
360
+ @properties['url']
361
+ end
362
+
363
+ ##
364
+ # Fetch a RatePlanInstance
365
+ # @return [RatePlanInstance] Fetched RatePlanInstance
366
+ def fetch
367
+ context.fetch
368
+ end
369
+
370
+ ##
371
+ # Update the RatePlanInstance
372
+ # @param [String] unique_name The unique_name
373
+ # @param [String] friendly_name The friendly_name
374
+ # @return [RatePlanInstance] Updated RatePlanInstance
375
+ def update(unique_name: nil, friendly_name: nil)
376
+ context.update(
377
+ unique_name: unique_name,
378
+ friendly_name: friendly_name,
379
+ )
380
+ end
381
+
382
+ ##
383
+ # Deletes the RatePlanInstance
384
+ # @return [Boolean] true if delete succeeds, true otherwise
385
+ def delete
386
+ context.delete
387
+ end
388
+
389
+ ##
390
+ # Provide a user friendly representation
391
+ def to_s
392
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
393
+ "<Twilio.Wireless.V1.RatePlanInstance #{values}>"
394
+ end
395
+ end
396
+ end
397
+ end
398
+ end
399
+ end