twilio-ruby 5.12.4 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +28 -13
  5. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +14 -6
  6. data/lib/twilio-ruby/rest/client.rb +7 -0
  7. data/lib/twilio-ruby/rest/preview.rb +28 -8
  8. data/lib/twilio-ruby/rest/preview/authy.rb +43 -0
  9. data/lib/twilio-ruby/rest/preview/authy/service.rb +364 -0
  10. data/lib/twilio-ruby/rest/preview/authy/service/entity.rb +326 -0
  11. data/lib/twilio-ruby/rest/preview/permissions.rb +35 -0
  12. data/lib/twilio-ruby/rest/preview/permissions/voice_permission.rb +131 -0
  13. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/bulk_country_update.rb +132 -0
  14. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country.rb +391 -0
  15. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country/highrisk_special_prefix.rb +192 -0
  16. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/settings.rb +197 -0
  17. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +12 -6
  18. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb +13 -11
  19. data/lib/twilio-ruby/rest/pricing/v2/voice.rb +17 -0
  20. data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +214 -0
  21. data/lib/twilio-ruby/rest/verify.rb +46 -0
  22. data/lib/twilio-ruby/rest/verify/v1.rb +43 -0
  23. data/lib/twilio-ruby/rest/verify/v1/service.rb +391 -0
  24. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +185 -0
  25. data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +182 -0
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/preview/authy/service/entity_spec.rb +173 -0
  28. data/spec/integration/preview/authy/service_spec.rb +201 -0
  29. data/spec/integration/preview/permissions/voice_permission/bulk_country_update_spec.rb +45 -0
  30. data/spec/integration/preview/permissions/voice_permission/country/highrisk_special_prefix_spec.rb +61 -0
  31. data/spec/integration/preview/permissions/voice_permission/country_spec.rb +112 -0
  32. data/spec/integration/preview/permissions/voice_permission/settings_spec.rb +77 -0
  33. data/spec/integration/preview/permissions/voice_permission_spec.rb +12 -0
  34. data/spec/integration/pricing/v2/voice/number_spec.rb +62 -0
  35. data/spec/integration/verify/v1/service/verification_check_spec.rb +52 -0
  36. data/spec/integration/verify/v1/service/verification_spec.rb +52 -0
  37. data/spec/integration/verify/v1/service_spec.rb +185 -0
  38. metadata +39 -2
@@ -0,0 +1,185 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Verify < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class VerificationList < ListResource
17
+ ##
18
+ # Initialize the VerificationList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] service_sid The unique SID identifier of the Service.
21
+ # @return [VerificationList] VerificationList
22
+ def initialize(version, service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {service_sid: service_sid}
27
+ @uri = "/Services/#{@solution[:service_sid]}/Verifications"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of VerificationInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] to The To phonenumber of the phone being verified
34
+ # @param [String] channel The method in which the phone will be verified. Either
35
+ # sms or call
36
+ # @param [String] custom_message A character string containing a custom message
37
+ # for this verification
38
+ # @return [VerificationInstance] Newly created VerificationInstance
39
+ def create(to: nil, channel: nil, custom_message: :unset)
40
+ data = Twilio::Values.of({'To' => to, 'Channel' => channel, 'CustomMessage' => custom_message, })
41
+
42
+ payload = @version.create(
43
+ 'POST',
44
+ @uri,
45
+ data: data
46
+ )
47
+
48
+ VerificationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
49
+ end
50
+
51
+ ##
52
+ # Provide a user friendly representation
53
+ def to_s
54
+ '#<Twilio.Verify.V1.VerificationList>'
55
+ end
56
+ end
57
+
58
+ ##
59
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
60
+ class VerificationPage < Page
61
+ ##
62
+ # Initialize the VerificationPage
63
+ # @param [Version] version Version that contains the resource
64
+ # @param [Response] response Response from the API
65
+ # @param [Hash] solution Path solution for the resource
66
+ # @return [VerificationPage] VerificationPage
67
+ def initialize(version, response, solution)
68
+ super(version, response)
69
+
70
+ # Path Solution
71
+ @solution = solution
72
+ end
73
+
74
+ ##
75
+ # Build an instance of VerificationInstance
76
+ # @param [Hash] payload Payload response from the API
77
+ # @return [VerificationInstance] VerificationInstance
78
+ def get_instance(payload)
79
+ VerificationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
80
+ end
81
+
82
+ ##
83
+ # Provide a user friendly representation
84
+ def to_s
85
+ '<Twilio.Verify.V1.VerificationPage>'
86
+ end
87
+ end
88
+
89
+ ##
90
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
91
+ class VerificationInstance < InstanceResource
92
+ ##
93
+ # Initialize the VerificationInstance
94
+ # @param [Version] version Version that contains the resource
95
+ # @param [Hash] payload payload that contains response from Twilio
96
+ # @param [String] service_sid The unique SID identifier of the Service.
97
+ # @return [VerificationInstance] VerificationInstance
98
+ def initialize(version, payload, service_sid: nil)
99
+ super(version)
100
+
101
+ # Marshaled Properties
102
+ @properties = {
103
+ 'sid' => payload['sid'],
104
+ 'service_sid' => payload['service_sid'],
105
+ 'account_sid' => payload['account_sid'],
106
+ 'to' => payload['to'],
107
+ 'channel' => payload['channel'],
108
+ 'status' => payload['status'],
109
+ 'valid' => payload['valid'],
110
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
111
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
112
+ }
113
+ end
114
+
115
+ ##
116
+ # @return [String] A string that uniquely identifies this Verification.
117
+ def sid
118
+ @properties['sid']
119
+ end
120
+
121
+ ##
122
+ # @return [String] Service Sid.
123
+ def service_sid
124
+ @properties['service_sid']
125
+ end
126
+
127
+ ##
128
+ # @return [String] Account Sid.
129
+ def account_sid
130
+ @properties['account_sid']
131
+ end
132
+
133
+ ##
134
+ # @return [String] To phonenumber
135
+ def to
136
+ @properties['to']
137
+ end
138
+
139
+ ##
140
+ # @return [verification.Channel] sms or call
141
+ def channel
142
+ @properties['channel']
143
+ end
144
+
145
+ ##
146
+ # @return [String] pending, approved, denied or expired
147
+ def status
148
+ @properties['status']
149
+ end
150
+
151
+ ##
152
+ # @return [Boolean] successful verification
153
+ def valid
154
+ @properties['valid']
155
+ end
156
+
157
+ ##
158
+ # @return [Time] The date this Verification was created
159
+ def date_created
160
+ @properties['date_created']
161
+ end
162
+
163
+ ##
164
+ # @return [Time] The date this Verification was updated
165
+ def date_updated
166
+ @properties['date_updated']
167
+ end
168
+
169
+ ##
170
+ # Provide a user friendly representation
171
+ def to_s
172
+ "<Twilio.Verify.V1.VerificationInstance>"
173
+ end
174
+
175
+ ##
176
+ # Provide a detailed, user friendly representation
177
+ def inspect
178
+ "<Twilio.Verify.V1.VerificationInstance>"
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,182 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Verify < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class VerificationCheckList < ListResource
17
+ ##
18
+ # Initialize the VerificationCheckList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] service_sid The unique SID identifier of the Service.
21
+ # @return [VerificationCheckList] VerificationCheckList
22
+ def initialize(version, service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {service_sid: service_sid}
27
+ @uri = "/Services/#{@solution[:service_sid]}/VerificationCheck"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of VerificationCheckInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] code The 4-10 character string being verified
34
+ # @param [String] to The To phonenumber of the phone being verified
35
+ # @return [VerificationCheckInstance] Newly created VerificationCheckInstance
36
+ def create(code: nil, to: :unset)
37
+ data = Twilio::Values.of({'Code' => code, 'To' => to, })
38
+
39
+ payload = @version.create(
40
+ 'POST',
41
+ @uri,
42
+ data: data
43
+ )
44
+
45
+ VerificationCheckInstance.new(@version, payload, service_sid: @solution[:service_sid], )
46
+ end
47
+
48
+ ##
49
+ # Provide a user friendly representation
50
+ def to_s
51
+ '#<Twilio.Verify.V1.VerificationCheckList>'
52
+ end
53
+ end
54
+
55
+ ##
56
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
57
+ class VerificationCheckPage < Page
58
+ ##
59
+ # Initialize the VerificationCheckPage
60
+ # @param [Version] version Version that contains the resource
61
+ # @param [Response] response Response from the API
62
+ # @param [Hash] solution Path solution for the resource
63
+ # @return [VerificationCheckPage] VerificationCheckPage
64
+ def initialize(version, response, solution)
65
+ super(version, response)
66
+
67
+ # Path Solution
68
+ @solution = solution
69
+ end
70
+
71
+ ##
72
+ # Build an instance of VerificationCheckInstance
73
+ # @param [Hash] payload Payload response from the API
74
+ # @return [VerificationCheckInstance] VerificationCheckInstance
75
+ def get_instance(payload)
76
+ VerificationCheckInstance.new(@version, payload, service_sid: @solution[:service_sid], )
77
+ end
78
+
79
+ ##
80
+ # Provide a user friendly representation
81
+ def to_s
82
+ '<Twilio.Verify.V1.VerificationCheckPage>'
83
+ end
84
+ end
85
+
86
+ ##
87
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
88
+ class VerificationCheckInstance < InstanceResource
89
+ ##
90
+ # Initialize the VerificationCheckInstance
91
+ # @param [Version] version Version that contains the resource
92
+ # @param [Hash] payload payload that contains response from Twilio
93
+ # @param [String] service_sid The unique SID identifier of the Service.
94
+ # @return [VerificationCheckInstance] VerificationCheckInstance
95
+ def initialize(version, payload, service_sid: nil)
96
+ super(version)
97
+
98
+ # Marshaled Properties
99
+ @properties = {
100
+ 'sid' => payload['sid'],
101
+ 'service_sid' => payload['service_sid'],
102
+ 'account_sid' => payload['account_sid'],
103
+ 'to' => payload['to'],
104
+ 'channel' => payload['channel'],
105
+ 'status' => payload['status'],
106
+ 'valid' => payload['valid'],
107
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
108
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
109
+ }
110
+ end
111
+
112
+ ##
113
+ # @return [String] A string that uniquely identifies this Verification Check.
114
+ def sid
115
+ @properties['sid']
116
+ end
117
+
118
+ ##
119
+ # @return [String] Service Sid.
120
+ def service_sid
121
+ @properties['service_sid']
122
+ end
123
+
124
+ ##
125
+ # @return [String] Account Sid.
126
+ def account_sid
127
+ @properties['account_sid']
128
+ end
129
+
130
+ ##
131
+ # @return [String] To phonenumber
132
+ def to
133
+ @properties['to']
134
+ end
135
+
136
+ ##
137
+ # @return [verification_check.Channel] sms or call
138
+ def channel
139
+ @properties['channel']
140
+ end
141
+
142
+ ##
143
+ # @return [String] pending, approved, denied or expired
144
+ def status
145
+ @properties['status']
146
+ end
147
+
148
+ ##
149
+ # @return [Boolean] successful verification
150
+ def valid
151
+ @properties['valid']
152
+ end
153
+
154
+ ##
155
+ # @return [Time] The date this Verification Check was created
156
+ def date_created
157
+ @properties['date_created']
158
+ end
159
+
160
+ ##
161
+ # @return [Time] The date this Verification Check was updated
162
+ def date_updated
163
+ @properties['date_updated']
164
+ end
165
+
166
+ ##
167
+ # Provide a user friendly representation
168
+ def to_s
169
+ "<Twilio.Verify.V1.VerificationCheckInstance>"
170
+ end
171
+
172
+ ##
173
+ # Provide a detailed, user friendly representation
174
+ def inspect
175
+ "<Twilio.Verify.V1.VerificationCheckInstance>"
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.12.4'
2
+ VERSION = '5.13.0'
3
3
  end
@@ -0,0 +1,173 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require 'spec_helper.rb'
10
+
11
+ describe 'Entity' do
12
+ it "can create" do
13
+ @holodeck.mock(Twilio::Response.new(500, ''))
14
+
15
+ expect {
16
+ @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
17
+ .entities.create(identity: 'identity')
18
+ }.to raise_exception(Twilio::REST::TwilioError)
19
+
20
+ values = {'Identity' => 'identity', }
21
+ expect(
22
+ @holodeck.has_request?(Holodeck::Request.new(
23
+ method: 'post',
24
+ url: 'https://preview.twilio.com/Authy/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities',
25
+ data: values,
26
+ ))).to eq(true)
27
+ end
28
+
29
+ it "receives create responses" do
30
+ @holodeck.mock(Twilio::Response.new(
31
+ 201,
32
+ %q[
33
+ {
34
+ "sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35
+ "identity": "ff483d1ff591898a9942916050d2ca3f",
36
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+ "date_created": "2015-07-30T20:00:00Z",
39
+ "date_updated": "2015-07-30T20:00:00Z",
40
+ "url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f",
41
+ "links": {
42
+ "factors": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
43
+ }
44
+ }
45
+ ]
46
+ ))
47
+
48
+ actual = @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
49
+ .entities.create(identity: 'identity')
50
+
51
+ expect(actual).to_not eq(nil)
52
+ end
53
+
54
+ it "can read" do
55
+ @holodeck.mock(Twilio::Response.new(500, ''))
56
+
57
+ expect {
58
+ @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
59
+ .entities.list()
60
+ }.to raise_exception(Twilio::REST::TwilioError)
61
+
62
+ values = {}
63
+ expect(
64
+ @holodeck.has_request?(Holodeck::Request.new(
65
+ method: 'get',
66
+ url: 'https://preview.twilio.com/Authy/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities',
67
+ ))).to eq(true)
68
+ end
69
+
70
+ it "receives read_empty responses" do
71
+ @holodeck.mock(Twilio::Response.new(
72
+ 200,
73
+ %q[
74
+ {
75
+ "entities": [],
76
+ "meta": {
77
+ "page": 0,
78
+ "page_size": 50,
79
+ "first_page_url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
80
+ "previous_page_url": null,
81
+ "url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
82
+ "next_page_url": null,
83
+ "key": "entities"
84
+ }
85
+ }
86
+ ]
87
+ ))
88
+
89
+ actual = @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
90
+ .entities.list()
91
+
92
+ expect(actual).to_not eq(nil)
93
+ end
94
+
95
+ it "receives read_full responses" do
96
+ @holodeck.mock(Twilio::Response.new(
97
+ 200,
98
+ %q[
99
+ {
100
+ "entities": [
101
+ {
102
+ "sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
103
+ "identity": "ff483d1ff591898a9942916050d2ca3f",
104
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
105
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
106
+ "date_created": "2015-07-30T20:00:00Z",
107
+ "date_updated": "2015-07-30T20:00:00Z",
108
+ "url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f",
109
+ "links": {
110
+ "factors": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
111
+ }
112
+ }
113
+ ],
114
+ "meta": {
115
+ "page": 0,
116
+ "page_size": 50,
117
+ "first_page_url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
118
+ "previous_page_url": null,
119
+ "url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities?PageSize=50&Page=0",
120
+ "next_page_url": null,
121
+ "key": "entities"
122
+ }
123
+ }
124
+ ]
125
+ ))
126
+
127
+ actual = @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
128
+ .entities.list()
129
+
130
+ expect(actual).to_not eq(nil)
131
+ end
132
+
133
+ it "can fetch" do
134
+ @holodeck.mock(Twilio::Response.new(500, ''))
135
+
136
+ expect {
137
+ @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
138
+ .entities('identity').fetch()
139
+ }.to raise_exception(Twilio::REST::TwilioError)
140
+
141
+ values = {}
142
+ expect(
143
+ @holodeck.has_request?(Holodeck::Request.new(
144
+ method: 'get',
145
+ url: 'https://preview.twilio.com/Authy/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities/identity',
146
+ ))).to eq(true)
147
+ end
148
+
149
+ it "receives fetch responses" do
150
+ @holodeck.mock(Twilio::Response.new(
151
+ 200,
152
+ %q[
153
+ {
154
+ "sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
155
+ "identity": "ff483d1ff591898a9942916050d2ca3f",
156
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
157
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
158
+ "date_created": "2015-07-30T20:00:00Z",
159
+ "date_updated": "2015-07-30T20:00:00Z",
160
+ "url": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f",
161
+ "links": {
162
+ "factors": "https://preview.twilio.com/Authy/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors"
163
+ }
164
+ }
165
+ ]
166
+ ))
167
+
168
+ actual = @client.preview.authy.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
169
+ .entities('identity').fetch()
170
+
171
+ expect(actual).to_not eq(nil)
172
+ end
173
+ end