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,222 @@
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 SimContext < InstanceContext
12
+ class UsageRecordList < ListResource
13
+ ##
14
+ # Initialize the UsageRecordList
15
+ # @param [Version] version Version that contains the resource
16
+ # @param [String] sim_sid The sim_sid
17
+ # @return [UsageRecordList] UsageRecordList
18
+ def initialize(version, sim_sid: nil)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {
23
+ sim_sid: sim_sid
24
+ }
25
+ @uri = "/Sims/#{@solution[:sim_sid]}/UsageRecords"
26
+ end
27
+
28
+ ##
29
+ # Lists UsageRecordInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [Time] end_ The end
33
+ # @param [Time] start The start
34
+ # @param [usage_record.Granularity] granularity The granularity
35
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
36
+ # guarantees to never return more than limit. Default is no limit
37
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
38
+ # the default value of 50 records. If no page_size is defined
39
+ # but a limit is defined, stream() will attempt to read the
40
+ # limit with the most efficient page size, i.e. min(limit, 1000)
41
+ # @return [Array] Array of up to limit results
42
+ def list(end_: nil, start: nil, granularity: nil, limit: nil, page_size: nil)
43
+ self.stream(
44
+ end_: end_,
45
+ start: start,
46
+ granularity: granularity,
47
+ limit: limit,
48
+ page_size: page_size
49
+ ).entries
50
+ end
51
+
52
+ ##
53
+ # Streams UsageRecordInstance records from the API as an Enumerable.
54
+ # This operation lazily loads records as efficiently as possible until the limit
55
+ # is reached.
56
+ # @param [Time] end_ The end
57
+ # @param [Time] start The start
58
+ # @param [usage_record.Granularity] granularity The granularity
59
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
60
+ # guarantees to never return more than limit. Default is no limit
61
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
62
+ # the default value of 50 records. If no page_size is defined
63
+ # but a limit is defined, stream() will attempt to read the
64
+ # limit with the most efficient page size, i.e. min(limit, 1000)
65
+ # @return [Enumerable] Enumerable that will yield up to limit results
66
+ def stream(end_: nil, start: nil, granularity: nil, limit: nil, page_size: nil)
67
+ limits = @version.read_limits(limit, page_size)
68
+
69
+ page = self.page(
70
+ end_: end_,
71
+ start: start,
72
+ granularity: granularity,
73
+ page_size: limits[:page_size],
74
+ )
75
+
76
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
77
+ end
78
+
79
+ ##
80
+ # When passed a block, yields UsageRecordInstance records from the API.
81
+ # This operation lazily loads records as efficiently as possible until the limit
82
+ # is reached.
83
+ # @param [Time] end_ The end
84
+ # @param [Time] start The start
85
+ # @param [usage_record.Granularity] granularity The granularity
86
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
87
+ # guarantees to never return more than limit. Default is no limit
88
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
89
+ # the default value of 50 records. If no page_size is defined
90
+ # but a limit is defined, stream() will attempt to read the
91
+ # limit with the most efficient page size, i.e. min(limit, 1000)
92
+ def each
93
+ limits = @version.read_limits
94
+
95
+ page = self.page(
96
+ page_size: limits[:page_size],
97
+ )
98
+
99
+ @version.stream(page,
100
+ limit: limits[:limit],
101
+ page_limit: limits[:page_limit]).each {|x| yield x}
102
+ end
103
+
104
+ ##
105
+ # Retrieve a single page of UsageRecordInstance records from the API.
106
+ # Request is executed immediately.
107
+ # @param [Time] end_ The end
108
+ # @param [Time] start The start
109
+ # @param [usage_record.Granularity] granularity The granularity
110
+ # @param [String] page_token PageToken provided by the API
111
+ # @param [Integer] page_number Page Number, this value is simply for client state
112
+ # @param [Integer] page_size Number of records to return, defaults to 50
113
+ # @return [Page] Page of UsageRecordInstance
114
+ def page(end_: nil, start: nil, granularity: nil, page_token: nil, page_number: nil, page_size: nil)
115
+ params = {
116
+ 'End' => Twilio.serialize_iso8601(end_),
117
+ 'Start' => Twilio.serialize_iso8601(start),
118
+ 'Granularity' => granularity,
119
+ 'PageToken' => page_token,
120
+ 'Page' => page_number,
121
+ 'PageSize' => page_size,
122
+ }
123
+ response = @version.page(
124
+ 'GET',
125
+ @uri,
126
+ params
127
+ )
128
+ return UsageRecordPage.new(@version, response, @solution)
129
+ end
130
+
131
+ ##
132
+ # Provide a user friendly representation
133
+ def to_s
134
+ '#<Twilio.Wireless.V1.UsageRecordList>'
135
+ end
136
+ end
137
+
138
+ class UsageRecordPage < Page
139
+ ##
140
+ # Initialize the UsageRecordPage
141
+ # @param [Version] version Version that contains the resource
142
+ # @param [Response] response Response from the API
143
+ # @param [Hash] solution Path solution for the resource
144
+ # @param [String] sim_sid The sim_sid
145
+ # @return [UsageRecordPage] UsageRecordPage
146
+ def initialize(version, response, solution)
147
+ super(version, response)
148
+
149
+ # Path Solution
150
+ @solution = solution
151
+ end
152
+
153
+ ##
154
+ # Build an instance of UsageRecordInstance
155
+ # @param [Hash] payload Payload response from the API
156
+ # @return [UsageRecordInstance] UsageRecordInstance
157
+ def get_instance(payload)
158
+ return UsageRecordInstance.new(
159
+ @version,
160
+ payload,
161
+ sim_sid: @solution[:sim_sid],
162
+ )
163
+ end
164
+
165
+ ##
166
+ # Provide a user friendly representation
167
+ def to_s
168
+ '<Twilio.Wireless.V1.UsageRecordPage>'
169
+ end
170
+ end
171
+
172
+ class UsageRecordInstance < InstanceResource
173
+ ##
174
+ # Initialize the UsageRecordInstance
175
+ # @param [Version] version Version that contains the resource
176
+ # @param [Hash] payload payload that contains response from Twilio
177
+ # @param [String] sim_sid The sim_sid
178
+ # @return [UsageRecordInstance] UsageRecordInstance
179
+ def initialize(version, payload, sim_sid: nil)
180
+ super(version)
181
+
182
+ # Marshaled Properties
183
+ @properties = {
184
+ 'sim_sid' => payload['sim_sid'],
185
+ 'account_sid' => payload['account_sid'],
186
+ 'period' => payload['period'],
187
+ 'commands' => payload['commands'],
188
+ 'data' => payload['data'],
189
+ }
190
+ end
191
+
192
+ def sim_sid
193
+ @properties['sim_sid']
194
+ end
195
+
196
+ def account_sid
197
+ @properties['account_sid']
198
+ end
199
+
200
+ def period
201
+ @properties['period']
202
+ end
203
+
204
+ def commands
205
+ @properties['commands']
206
+ end
207
+
208
+ def data
209
+ @properties['data']
210
+ end
211
+
212
+ ##
213
+ # Provide a user friendly representation
214
+ def to_s
215
+ "<Twilio.Wireless.V1.UsageRecordInstance>"
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
@@ -0,0 +1,502 @@
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 SimList < ListResource
12
+ ##
13
+ # Initialize the SimList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [SimList] SimList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ @uri = "/Sims"
22
+ end
23
+
24
+ ##
25
+ # Lists SimInstance 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 [sim.Status] status The status
29
+ # @param [String] iccid The iccid
30
+ # @param [String] rate_plan The rate_plan
31
+ # @param [String] e_id The e_id
32
+ # @param [String] sim_registration_code The sim_registration_code
33
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
34
+ # guarantees to never return more than limit. Default is no limit
35
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
36
+ # the default value of 50 records. If no page_size is defined
37
+ # but a limit is defined, stream() will attempt to read the
38
+ # limit with the most efficient page size, i.e. min(limit, 1000)
39
+ # @return [Array] Array of up to limit results
40
+ def list(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, limit: nil, page_size: nil)
41
+ self.stream(
42
+ status: status,
43
+ iccid: iccid,
44
+ rate_plan: rate_plan,
45
+ e_id: e_id,
46
+ sim_registration_code: sim_registration_code,
47
+ limit: limit,
48
+ page_size: page_size
49
+ ).entries
50
+ end
51
+
52
+ ##
53
+ # Streams SimInstance records from the API as an Enumerable.
54
+ # This operation lazily loads records as efficiently as possible until the limit
55
+ # is reached.
56
+ # @param [sim.Status] status The status
57
+ # @param [String] iccid The iccid
58
+ # @param [String] rate_plan The rate_plan
59
+ # @param [String] e_id The e_id
60
+ # @param [String] sim_registration_code The sim_registration_code
61
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
62
+ # guarantees to never return more than limit. Default is no limit
63
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
64
+ # the default value of 50 records. If no page_size is defined
65
+ # but a limit is defined, stream() will attempt to read the
66
+ # limit with the most efficient page size, i.e. min(limit, 1000)
67
+ # @return [Enumerable] Enumerable that will yield up to limit results
68
+ def stream(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, limit: nil, page_size: nil)
69
+ limits = @version.read_limits(limit, page_size)
70
+
71
+ page = self.page(
72
+ status: status,
73
+ iccid: iccid,
74
+ rate_plan: rate_plan,
75
+ e_id: e_id,
76
+ sim_registration_code: sim_registration_code,
77
+ page_size: limits[:page_size],
78
+ )
79
+
80
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
81
+ end
82
+
83
+ ##
84
+ # When passed a block, yields SimInstance records from the API.
85
+ # This operation lazily loads records as efficiently as possible until the limit
86
+ # is reached.
87
+ # @param [sim.Status] status The status
88
+ # @param [String] iccid The iccid
89
+ # @param [String] rate_plan The rate_plan
90
+ # @param [String] e_id The e_id
91
+ # @param [String] sim_registration_code The sim_registration_code
92
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
93
+ # guarantees to never return more than limit. Default is no limit
94
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
95
+ # the default value of 50 records. If no page_size is defined
96
+ # but a limit is defined, stream() will attempt to read the
97
+ # limit with the most efficient page size, i.e. min(limit, 1000)
98
+ def each
99
+ limits = @version.read_limits
100
+
101
+ page = self.page(
102
+ page_size: limits[:page_size],
103
+ )
104
+
105
+ @version.stream(page,
106
+ limit: limits[:limit],
107
+ page_limit: limits[:page_limit]).each {|x| yield x}
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of SimInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [sim.Status] status The status
114
+ # @param [String] iccid The iccid
115
+ # @param [String] rate_plan The rate_plan
116
+ # @param [String] e_id The e_id
117
+ # @param [String] sim_registration_code The sim_registration_code
118
+ # @param [String] page_token PageToken provided by the API
119
+ # @param [Integer] page_number Page Number, this value is simply for client state
120
+ # @param [Integer] page_size Number of records to return, defaults to 50
121
+ # @return [Page] Page of SimInstance
122
+ def page(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, page_token: nil, page_number: nil, page_size: nil)
123
+ params = {
124
+ 'Status' => status,
125
+ 'Iccid' => iccid,
126
+ 'RatePlan' => rate_plan,
127
+ 'EId' => e_id,
128
+ 'SimRegistrationCode' => sim_registration_code,
129
+ 'PageToken' => page_token,
130
+ 'Page' => page_number,
131
+ 'PageSize' => page_size,
132
+ }
133
+ response = @version.page(
134
+ 'GET',
135
+ @uri,
136
+ params
137
+ )
138
+ return SimPage.new(@version, response, @solution)
139
+ end
140
+
141
+ ##
142
+ # Provide a user friendly representation
143
+ def to_s
144
+ '#<Twilio.Wireless.V1.SimList>'
145
+ end
146
+ end
147
+
148
+ class SimPage < Page
149
+ ##
150
+ # Initialize the SimPage
151
+ # @param [Version] version Version that contains the resource
152
+ # @param [Response] response Response from the API
153
+ # @param [Hash] solution Path solution for the resource
154
+ # @return [SimPage] SimPage
155
+ def initialize(version, response, solution)
156
+ super(version, response)
157
+
158
+ # Path Solution
159
+ @solution = solution
160
+ end
161
+
162
+ ##
163
+ # Build an instance of SimInstance
164
+ # @param [Hash] payload Payload response from the API
165
+ # @return [SimInstance] SimInstance
166
+ def get_instance(payload)
167
+ return SimInstance.new(
168
+ @version,
169
+ payload,
170
+ )
171
+ end
172
+
173
+ ##
174
+ # Provide a user friendly representation
175
+ def to_s
176
+ '<Twilio.Wireless.V1.SimPage>'
177
+ end
178
+ end
179
+
180
+ class SimContext < InstanceContext
181
+ ##
182
+ # Initialize the SimContext
183
+ # @param [Version] version Version that contains the resource
184
+ # @param [String] sid The sid
185
+ # @return [SimContext] SimContext
186
+ def initialize(version, sid)
187
+ super(version)
188
+
189
+ # Path Solution
190
+ @solution = {
191
+ sid: sid,
192
+ }
193
+ @uri = "/Sims/#{@solution[:sid]}"
194
+
195
+ # Dependents
196
+ @usage_records = nil
197
+ end
198
+
199
+ ##
200
+ # Fetch a SimInstance
201
+ # @return [SimInstance] Fetched SimInstance
202
+ def fetch
203
+ params = {}
204
+
205
+ payload = @version.fetch(
206
+ 'GET',
207
+ @uri,
208
+ params,
209
+ )
210
+
211
+ return SimInstance.new(
212
+ @version,
213
+ payload,
214
+ sid: @solution[:sid],
215
+ )
216
+ end
217
+
218
+ ##
219
+ # Update the SimInstance
220
+ # @param [String] unique_name The unique_name
221
+ # @param [String] callback_method The callback_method
222
+ # @param [String] callback_url The callback_url
223
+ # @param [String] friendly_name The friendly_name
224
+ # @param [String] rate_plan The rate_plan
225
+ # @param [sim.Status] status The status
226
+ # @param [String] commands_callback_method The commands_callback_method
227
+ # @param [String] commands_callback_url The commands_callback_url
228
+ # @param [String] sms_fallback_method The sms_fallback_method
229
+ # @param [String] sms_fallback_url The sms_fallback_url
230
+ # @param [String] sms_method The sms_method
231
+ # @param [String] sms_url The sms_url
232
+ # @param [String] voice_fallback_method The voice_fallback_method
233
+ # @param [String] voice_fallback_url The voice_fallback_url
234
+ # @param [String] voice_method The voice_method
235
+ # @param [String] voice_url The voice_url
236
+ # @return [SimInstance] Updated SimInstance
237
+ def update(unique_name: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil, sms_fallback_method: nil, sms_fallback_url: nil, sms_method: nil, sms_url: nil, voice_fallback_method: nil, voice_fallback_url: nil, voice_method: nil, voice_url: nil)
238
+ data = {
239
+ 'UniqueName' => unique_name,
240
+ 'CallbackMethod' => callback_method,
241
+ 'CallbackUrl' => callback_url,
242
+ 'FriendlyName' => friendly_name,
243
+ 'RatePlan' => rate_plan,
244
+ 'Status' => status,
245
+ 'CommandsCallbackMethod' => commands_callback_method,
246
+ 'CommandsCallbackUrl' => commands_callback_url,
247
+ 'SmsFallbackMethod' => sms_fallback_method,
248
+ 'SmsFallbackUrl' => sms_fallback_url,
249
+ 'SmsMethod' => sms_method,
250
+ 'SmsUrl' => sms_url,
251
+ 'VoiceFallbackMethod' => voice_fallback_method,
252
+ 'VoiceFallbackUrl' => voice_fallback_url,
253
+ 'VoiceMethod' => voice_method,
254
+ 'VoiceUrl' => voice_url,
255
+ }
256
+
257
+ payload = @version.update(
258
+ 'POST',
259
+ @uri,
260
+ data: data,
261
+ )
262
+
263
+ return SimInstance.new(
264
+ @version,
265
+ payload,
266
+ sid: @solution[:sid],
267
+ )
268
+ end
269
+
270
+ ##
271
+ # Access the usage_records
272
+ # @return [UsageRecordList] UsageRecordList
273
+ def usage_records
274
+ unless @usage_records
275
+ @usage_records = UsageRecordList.new(
276
+ @version,
277
+ sim_sid: @solution[:sid],
278
+ )
279
+ end
280
+
281
+ @usage_records
282
+ end
283
+
284
+ ##
285
+ # Provide a user friendly representation
286
+ def to_s
287
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
288
+ "#<Twilio.Wireless.V1.SimContext #{context}>"
289
+ end
290
+ end
291
+
292
+ class SimInstance < InstanceResource
293
+ ##
294
+ # Initialize the SimInstance
295
+ # @param [Version] version Version that contains the resource
296
+ # @param [Hash] payload payload that contains response from Twilio
297
+ # @param [String] sid The sid
298
+ # @return [SimInstance] SimInstance
299
+ def initialize(version, payload, sid: nil)
300
+ super(version)
301
+
302
+ # Marshaled Properties
303
+ @properties = {
304
+ 'sid' => payload['sid'],
305
+ 'unique_name' => payload['unique_name'],
306
+ 'account_sid' => payload['account_sid'],
307
+ 'rate_plan_sid' => payload['rate_plan_sid'],
308
+ 'friendly_name' => payload['friendly_name'],
309
+ 'iccid' => payload['iccid'],
310
+ 'e_id' => payload['e_id'],
311
+ 'status' => payload['status'],
312
+ 'commands_callback_url' => payload['commands_callback_url'],
313
+ 'commands_callback_method' => payload['commands_callback_method'],
314
+ 'sms_fallback_method' => payload['sms_fallback_method'],
315
+ 'sms_fallback_url' => payload['sms_fallback_url'],
316
+ 'sms_method' => payload['sms_method'],
317
+ 'sms_url' => payload['sms_url'],
318
+ 'voice_fallback_method' => payload['voice_fallback_method'],
319
+ 'voice_fallback_url' => payload['voice_fallback_url'],
320
+ 'voice_method' => payload['voice_method'],
321
+ 'voice_url' => payload['voice_url'],
322
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
323
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
324
+ 'url' => payload['url'],
325
+ 'links' => payload['links'],
326
+ }
327
+
328
+ # Context
329
+ @instance_context = nil
330
+ @params = {
331
+ 'sid' => sid || @properties['sid'],
332
+ }
333
+ end
334
+
335
+ ##
336
+ # Generate an instance context for the instance, the context is capable of
337
+ # performing various actions. All instance actions are proxied to the context
338
+ # @param [Version] version Version that contains the resource
339
+ # @return [SimContext] SimContext for this SimInstance
340
+ def context
341
+ unless @instance_context
342
+ @instance_context = SimContext.new(
343
+ @version,
344
+ @params['sid'],
345
+ )
346
+ end
347
+ @instance_context
348
+ end
349
+
350
+ def sid
351
+ @properties['sid']
352
+ end
353
+
354
+ def unique_name
355
+ @properties['unique_name']
356
+ end
357
+
358
+ def account_sid
359
+ @properties['account_sid']
360
+ end
361
+
362
+ def rate_plan_sid
363
+ @properties['rate_plan_sid']
364
+ end
365
+
366
+ def friendly_name
367
+ @properties['friendly_name']
368
+ end
369
+
370
+ def iccid
371
+ @properties['iccid']
372
+ end
373
+
374
+ def e_id
375
+ @properties['e_id']
376
+ end
377
+
378
+ def status
379
+ @properties['status']
380
+ end
381
+
382
+ def commands_callback_url
383
+ @properties['commands_callback_url']
384
+ end
385
+
386
+ def commands_callback_method
387
+ @properties['commands_callback_method']
388
+ end
389
+
390
+ def sms_fallback_method
391
+ @properties['sms_fallback_method']
392
+ end
393
+
394
+ def sms_fallback_url
395
+ @properties['sms_fallback_url']
396
+ end
397
+
398
+ def sms_method
399
+ @properties['sms_method']
400
+ end
401
+
402
+ def sms_url
403
+ @properties['sms_url']
404
+ end
405
+
406
+ def voice_fallback_method
407
+ @properties['voice_fallback_method']
408
+ end
409
+
410
+ def voice_fallback_url
411
+ @properties['voice_fallback_url']
412
+ end
413
+
414
+ def voice_method
415
+ @properties['voice_method']
416
+ end
417
+
418
+ def voice_url
419
+ @properties['voice_url']
420
+ end
421
+
422
+ def date_created
423
+ @properties['date_created']
424
+ end
425
+
426
+ def date_updated
427
+ @properties['date_updated']
428
+ end
429
+
430
+ def url
431
+ @properties['url']
432
+ end
433
+
434
+ def links
435
+ @properties['links']
436
+ end
437
+
438
+ ##
439
+ # Fetch a SimInstance
440
+ # @return [SimInstance] Fetched SimInstance
441
+ def fetch
442
+ context.fetch
443
+ end
444
+
445
+ ##
446
+ # Update the SimInstance
447
+ # @param [String] unique_name The unique_name
448
+ # @param [String] callback_method The callback_method
449
+ # @param [String] callback_url The callback_url
450
+ # @param [String] friendly_name The friendly_name
451
+ # @param [String] rate_plan The rate_plan
452
+ # @param [sim.Status] status The status
453
+ # @param [String] commands_callback_method The commands_callback_method
454
+ # @param [String] commands_callback_url The commands_callback_url
455
+ # @param [String] sms_fallback_method The sms_fallback_method
456
+ # @param [String] sms_fallback_url The sms_fallback_url
457
+ # @param [String] sms_method The sms_method
458
+ # @param [String] sms_url The sms_url
459
+ # @param [String] voice_fallback_method The voice_fallback_method
460
+ # @param [String] voice_fallback_url The voice_fallback_url
461
+ # @param [String] voice_method The voice_method
462
+ # @param [String] voice_url The voice_url
463
+ # @return [SimInstance] Updated SimInstance
464
+ def update(unique_name: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil, sms_fallback_method: nil, sms_fallback_url: nil, sms_method: nil, sms_url: nil, voice_fallback_method: nil, voice_fallback_url: nil, voice_method: nil, voice_url: nil)
465
+ context.update(
466
+ unique_name: unique_name,
467
+ callback_method: callback_method,
468
+ callback_url: callback_url,
469
+ friendly_name: friendly_name,
470
+ rate_plan: rate_plan,
471
+ status: status,
472
+ commands_callback_method: commands_callback_method,
473
+ commands_callback_url: commands_callback_url,
474
+ sms_fallback_method: sms_fallback_method,
475
+ sms_fallback_url: sms_fallback_url,
476
+ sms_method: sms_method,
477
+ sms_url: sms_url,
478
+ voice_fallback_method: voice_fallback_method,
479
+ voice_fallback_url: voice_fallback_url,
480
+ voice_method: voice_method,
481
+ voice_url: voice_url,
482
+ )
483
+ end
484
+
485
+ ##
486
+ # Access the usage_records
487
+ # @return [usage_records] usage_records
488
+ def usage_records
489
+ context.usage_records
490
+ end
491
+
492
+ ##
493
+ # Provide a user friendly representation
494
+ def to_s
495
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
496
+ "<Twilio.Wireless.V1.SimInstance #{values}>"
497
+ end
498
+ end
499
+ end
500
+ end
501
+ end
502
+ end