twilio-ruby 5.0.0.rc20 → 5.0.0.rc21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +9 -3
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/http/http_client.rb +0 -1
  5. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +196 -0
  6. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +197 -0
  7. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +232 -0
  8. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +44 -0
  9. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +517 -0
  10. data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +35 -0
  11. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +336 -0
  12. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +393 -0
  13. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +409 -0
  14. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +479 -0
  15. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +506 -0
  16. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +336 -0
  17. data/lib/twilio-ruby/rest/preview/proxy/service.rb +467 -0
  18. data/lib/twilio-ruby/rest/preview/proxy.rb +35 -0
  19. data/lib/twilio-ruby/rest/preview.rb +34 -1
  20. data/lib/twilio-ruby/version.rb +1 -1
  21. data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
  22. data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
  23. data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
  24. data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +277 -0
  25. data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
  26. data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
  27. data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
  28. data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
  29. data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
  30. data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
  31. data/spec/integration/preview/proxy/service_spec.rb +200 -0
  32. metadata +38 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a237c668281992d46d1bdd3c6d9417a8f2ca040
4
- data.tar.gz: 70bcf47381f5e55675fe35ac01bee5de15355f36
3
+ metadata.gz: d37f870e4dc93660634ee065e3d21804db16b380
4
+ data.tar.gz: 95b5156b35166aaa495bfd9955a2af205568f072
5
5
  SHA512:
6
- metadata.gz: be90b36898a29bdb6744d61a45199a0f47bfe128010f7c61088ef4ecd90d77f1f35e06b54c3f4ded8da47ee86e1c520e021a8bfc87b727816ef2e7be91525568
7
- data.tar.gz: 020e62824e298f3c106e9a4fcd38d97b1e8f6202a92623cd227a8586dc501a3ffcfaf414f187ede70044340034e4ad41afd6001e13d0577421aa475d6eb84f71
6
+ metadata.gz: 5adc69016e3495368a5df9d08b39b61102317b5fdb86fad9689b34bb22c9f12387b0322b240c46e24efc18695b54afafbbd124af07b0b9adc2451ea1ab4d0025
7
+ data.tar.gz: 162a06e0b7d8e35971977cdff185219f17b824bd346bdc6e4c884fba909741e3552b92fd8ce2e6f29b879033c91354d939b8048faa5b257761f46a19e4ce58f1
data/CHANGES.md CHANGED
@@ -1,7 +1,13 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
+ [2017-05-24] Version 5.0.0-rc21
4
+ -------------------------------
5
+ - Add HostedNumbers preview support.
6
+ - Add Proxy preview support.
7
+ - Add BulkExports preview support.
3
8
 
4
9
  [2017-05-22] Version 5.0.0-rc20
10
+ -------------------------------
5
11
  - Add Wireless Domain
6
12
  - Add Fax Domain
7
13
  - Add Video Domain
@@ -10,7 +16,7 @@ twilio-ruby changelog
10
16
  - Converted `TwilioException` to `TwilioError`
11
17
 
12
18
  [2017-04-27] Version 5.0.0-rc19
13
- ------------------
19
+ -------------------------------
14
20
 
15
21
  - Add chat v2.
16
22
  - Wireless rate plans updates.
@@ -18,14 +24,14 @@ twilio-ruby changelog
18
24
  - New Usage API categories.
19
25
 
20
26
  Version 5.0.0-rc18
21
- -------------
27
+ -------------------------------
22
28
 
23
29
  Release April 17, 2017
24
30
 
25
31
  - Update VideoGrant access token to accept `room` instead of `configuration_profile_sid`
26
32
 
27
33
  Version 5.0.0-rc16
28
- -------------
34
+ -------------------------------
29
35
 
30
36
  Release September 1, 2016
31
37
 
data/README.md CHANGED
@@ -11,13 +11,13 @@ A module for using the Twilio REST API and generating valid [TwiML](http://www.t
11
11
  To install using [Bundler][bundler] grab the latest stable version:
12
12
 
13
13
  ```ruby
14
- gem 'twilio-ruby', '~> 5.0.0.rc20'
14
+ gem 'twilio-ruby', '~> 5.0.0.rc21'
15
15
  ```
16
16
 
17
17
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
18
18
 
19
19
  ```bash
20
- gem install twilio-ruby -v 5.0.0.rc20
20
+ gem install twilio-ruby -v 5.0.0.rc21
21
21
  ```
22
22
 
23
23
  To build and install the development branch yourself from the latest source:
@@ -18,7 +18,6 @@ module Twilio
18
18
  end
19
19
 
20
20
  def request(host, port, method, url, params={}, data={}, headers={}, auth=nil, timeout=nil)
21
- puts(url)
22
21
  @connection = Faraday.new(url: host + ":" + port.to_s, ssl: {verify: true}) do |f|
23
22
  f.request :url_encoded
24
23
  f.adapter @adapter
@@ -0,0 +1,196 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class BulkExports < Version
11
+ class ExportContext < InstanceContext
12
+ class DayList < ListResource
13
+ ##
14
+ # Initialize the DayList
15
+ # @param [Version] version Version that contains the resource
16
+ # @param [String] resource_type The resource_type
17
+ # @return [DayList] DayList
18
+ def initialize(version, resource_type: nil)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {
23
+ resource_type: resource_type
24
+ }
25
+ @uri = "/Exports/#{@solution[:resource_type]}/Days"
26
+ end
27
+
28
+ ##
29
+ # Lists DayInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
33
+ # guarantees to never return more than limit. Default is no limit
34
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
35
+ # the default value of 50 records. If no page_size is defined
36
+ # but a limit is defined, stream() will attempt to read the
37
+ # limit with the most efficient page size, i.e. min(limit, 1000)
38
+ # @return [Array] Array of up to limit results
39
+ def list(limit: nil, page_size: nil)
40
+ self.stream(
41
+ limit: limit,
42
+ page_size: page_size
43
+ ).entries
44
+ end
45
+
46
+ ##
47
+ # Streams DayInstance records from the API as an Enumerable.
48
+ # This operation lazily loads records as efficiently as possible until the limit
49
+ # is reached.
50
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
51
+ # guarantees to never return more than limit. Default is no limit
52
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
53
+ # the default value of 50 records. If no page_size is defined
54
+ # but a limit is defined, stream() will attempt to read the
55
+ # limit with the most efficient page size, i.e. min(limit, 1000)
56
+ # @return [Enumerable] Enumerable that will yield up to limit results
57
+ def stream(limit: nil, page_size: nil)
58
+ limits = @version.read_limits(limit, page_size)
59
+
60
+ page = self.page(
61
+ page_size: limits[:page_size],
62
+ )
63
+
64
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
65
+ end
66
+
67
+ ##
68
+ # When passed a block, yields DayInstance records from the API.
69
+ # This operation lazily loads records as efficiently as possible until the limit
70
+ # is reached.
71
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
72
+ # guarantees to never return more than limit. Default is no limit
73
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
74
+ # the default value of 50 records. If no page_size is defined
75
+ # but a limit is defined, stream() will attempt to read the
76
+ # limit with the most efficient page size, i.e. min(limit, 1000)
77
+ def each
78
+ limits = @version.read_limits
79
+
80
+ page = self.page(
81
+ page_size: limits[:page_size],
82
+ )
83
+
84
+ @version.stream(page,
85
+ limit: limits[:limit],
86
+ page_limit: limits[:page_limit]).each {|x| yield x}
87
+ end
88
+
89
+ ##
90
+ # Retrieve a single page of DayInstance records from the API.
91
+ # Request is executed immediately.
92
+ # @param [String] page_token PageToken provided by the API
93
+ # @param [Integer] page_number Page Number, this value is simply for client state
94
+ # @param [Integer] page_size Number of records to return, defaults to 50
95
+ # @return [Page] Page of DayInstance
96
+ def page(page_token: nil, page_number: nil, page_size: nil)
97
+ params = {
98
+ 'PageToken' => page_token,
99
+ 'Page' => page_number,
100
+ 'PageSize' => page_size,
101
+ }
102
+ response = @version.page(
103
+ 'GET',
104
+ @uri,
105
+ params
106
+ )
107
+ return DayPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Provide a user friendly representation
112
+ def to_s
113
+ '#<Twilio.Preview.BulkExports.DayList>'
114
+ end
115
+ end
116
+
117
+ class DayPage < Page
118
+ ##
119
+ # Initialize the DayPage
120
+ # @param [Version] version Version that contains the resource
121
+ # @param [Response] response Response from the API
122
+ # @param [Hash] solution Path solution for the resource
123
+ # @param [String] resource_type The resource_type
124
+ # @return [DayPage] DayPage
125
+ def initialize(version, response, solution)
126
+ super(version, response)
127
+
128
+ # Path Solution
129
+ @solution = solution
130
+ end
131
+
132
+ ##
133
+ # Build an instance of DayInstance
134
+ # @param [Hash] payload Payload response from the API
135
+ # @return [DayInstance] DayInstance
136
+ def get_instance(payload)
137
+ return DayInstance.new(
138
+ @version,
139
+ payload,
140
+ resource_type: @solution[:resource_type],
141
+ )
142
+ end
143
+
144
+ ##
145
+ # Provide a user friendly representation
146
+ def to_s
147
+ '<Twilio.Preview.BulkExports.DayPage>'
148
+ end
149
+ end
150
+
151
+ class DayInstance < InstanceResource
152
+ ##
153
+ # Initialize the DayInstance
154
+ # @param [Version] version Version that contains the resource
155
+ # @param [Hash] payload payload that contains response from Twilio
156
+ # @param [String] resource_type The resource_type
157
+ # @return [DayInstance] DayInstance
158
+ def initialize(version, payload, resource_type: nil)
159
+ super(version)
160
+
161
+ # Marshaled Properties
162
+ @properties = {
163
+ 'redirect_to' => payload['redirect_to'],
164
+ 'day' => payload['day'],
165
+ 'size' => payload['size'].to_i,
166
+ 'resource_type' => payload['resource_type'],
167
+ }
168
+ end
169
+
170
+ def redirect_to
171
+ @properties['redirect_to']
172
+ end
173
+
174
+ def day
175
+ @properties['day']
176
+ end
177
+
178
+ def size
179
+ @properties['size']
180
+ end
181
+
182
+ def resource_type
183
+ @properties['resource_type']
184
+ end
185
+
186
+ ##
187
+ # Provide a user friendly representation
188
+ def to_s
189
+ "<Twilio.Preview.BulkExports.DayInstance>"
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,197 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class BulkExports < Version
11
+ class ExportList < ListResource
12
+ ##
13
+ # Initialize the ExportList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [ExportList] ExportList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ end
22
+
23
+ ##
24
+ # Provide a user friendly representation
25
+ def to_s
26
+ '#<Twilio.Preview.BulkExports.ExportList>'
27
+ end
28
+ end
29
+
30
+ class ExportPage < Page
31
+ ##
32
+ # Initialize the ExportPage
33
+ # @param [Version] version Version that contains the resource
34
+ # @param [Response] response Response from the API
35
+ # @param [Hash] solution Path solution for the resource
36
+ # @return [ExportPage] ExportPage
37
+ def initialize(version, response, solution)
38
+ super(version, response)
39
+
40
+ # Path Solution
41
+ @solution = solution
42
+ end
43
+
44
+ ##
45
+ # Build an instance of ExportInstance
46
+ # @param [Hash] payload Payload response from the API
47
+ # @return [ExportInstance] ExportInstance
48
+ def get_instance(payload)
49
+ return ExportInstance.new(
50
+ @version,
51
+ payload,
52
+ )
53
+ end
54
+
55
+ ##
56
+ # Provide a user friendly representation
57
+ def to_s
58
+ '<Twilio.Preview.BulkExports.ExportPage>'
59
+ end
60
+ end
61
+
62
+ class ExportContext < InstanceContext
63
+ ##
64
+ # Initialize the ExportContext
65
+ # @param [Version] version Version that contains the resource
66
+ # @param [String] resource_type The resource_type
67
+ # @return [ExportContext] ExportContext
68
+ def initialize(version, resource_type)
69
+ super(version)
70
+
71
+ # Path Solution
72
+ @solution = {
73
+ resource_type: resource_type,
74
+ }
75
+ @uri = "/Exports/#{@solution[:resource_type]}"
76
+
77
+ # Dependents
78
+ @days = nil
79
+ end
80
+
81
+ ##
82
+ # Fetch a ExportInstance
83
+ # @return [ExportInstance] Fetched ExportInstance
84
+ def fetch
85
+ params = {}
86
+
87
+ payload = @version.fetch(
88
+ 'GET',
89
+ @uri,
90
+ params,
91
+ )
92
+
93
+ return ExportInstance.new(
94
+ @version,
95
+ payload,
96
+ resource_type: @solution[:resource_type],
97
+ )
98
+ end
99
+
100
+ ##
101
+ # Access the days
102
+ # @return [DayList] DayList
103
+ def days
104
+ unless @days
105
+ @days = DayList.new(
106
+ @version,
107
+ resource_type: @solution[:resource_type],
108
+ )
109
+ end
110
+
111
+ @days
112
+ end
113
+
114
+ ##
115
+ # Provide a user friendly representation
116
+ def to_s
117
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
118
+ "#<Twilio.Preview.BulkExports.ExportContext #{context}>"
119
+ end
120
+ end
121
+
122
+ class ExportInstance < InstanceResource
123
+ ##
124
+ # Initialize the ExportInstance
125
+ # @param [Version] version Version that contains the resource
126
+ # @param [Hash] payload payload that contains response from Twilio
127
+ # @param [String] resource_type The resource_type
128
+ # @return [ExportInstance] ExportInstance
129
+ def initialize(version, payload, resource_type: nil)
130
+ super(version)
131
+
132
+ # Marshaled Properties
133
+ @properties = {
134
+ 'resource_type' => payload['resource_type'],
135
+ 'url' => payload['url'],
136
+ 'links' => payload['links'],
137
+ }
138
+
139
+ # Context
140
+ @instance_context = nil
141
+ @params = {
142
+ 'resource_type' => resource_type || @properties['resource_type'],
143
+ }
144
+ end
145
+
146
+ ##
147
+ # Generate an instance context for the instance, the context is capable of
148
+ # performing various actions. All instance actions are proxied to the context
149
+ # @param [Version] version Version that contains the resource
150
+ # @return [ExportContext] ExportContext for this ExportInstance
151
+ def context
152
+ unless @instance_context
153
+ @instance_context = ExportContext.new(
154
+ @version,
155
+ @params['resource_type'],
156
+ )
157
+ end
158
+ @instance_context
159
+ end
160
+
161
+ def resource_type
162
+ @properties['resource_type']
163
+ end
164
+
165
+ def url
166
+ @properties['url']
167
+ end
168
+
169
+ def links
170
+ @properties['links']
171
+ end
172
+
173
+ ##
174
+ # Fetch a ExportInstance
175
+ # @return [ExportInstance] Fetched ExportInstance
176
+ def fetch
177
+ context.fetch
178
+ end
179
+
180
+ ##
181
+ # Access the days
182
+ # @return [days] days
183
+ def days
184
+ context.days
185
+ end
186
+
187
+ ##
188
+ # Provide a user friendly representation
189
+ def to_s
190
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
191
+ "<Twilio.Preview.BulkExports.ExportInstance #{values}>"
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end