twilio-ruby 5.14.1 → 5.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +33 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +2 -1
- data/lib/twilio-ruby/rest/authy.rb +55 -0
- data/lib/twilio-ruby/rest/authy/v1.rb +59 -0
- data/lib/twilio-ruby/rest/authy/v1/form.rb +190 -0
- data/lib/twilio-ruby/rest/authy/v1/service.rb +378 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity.rb +372 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +474 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +405 -0
- data/lib/twilio-ruby/rest/autopilot.rb +47 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +43 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +606 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +215 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +205 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +417 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +393 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +390 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +443 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent.rb → autopilot/v1/assistant/task.rb} +91 -84
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +377 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +442 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +244 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent/intent_statistics.rb → autopilot/v1/assistant/task/task_statistics.rb} +49 -51
- data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/client.rb +14 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/preview/understand.rb +2 -1
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +59 -29
- data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +17 -13
- data/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +505 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/field.rb +25 -25
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/sample.rb +30 -30
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent/intent_actions.rb → task/task_actions.rb} +50 -54
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +224 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +7 -7
- data/lib/twilio-ruby/rest/verify/v1/service.rb +45 -6
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +9 -2
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +32 -5
- data/lib/twilio-ruby/twiml/voice_response.rb +66 -5
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/recording_spec.rb +3 -3
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +42 -1
- data/spec/integration/api/v2010/account/conference/recording_spec.rb +2 -2
- data/spec/integration/authy/v1/form_spec.rb +48 -0
- data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +267 -0
- data/spec/integration/authy/v1/service/entity/factor_spec.rb +269 -0
- data/spec/integration/authy/v1/service/entity_spec.rb +201 -0
- data/spec/integration/authy/v1/service_spec.rb +227 -0
- data/spec/integration/autopilot/v1/assistant/defaults_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/dialogue_spec.rb +47 -0
- data/spec/integration/autopilot/v1/assistant/field_type/field_value_spec.rb +210 -0
- data/spec/integration/autopilot/v1/assistant/field_type_spec.rb +246 -0
- data/spec/integration/autopilot/v1/assistant/model_build_spec.rb +241 -0
- data/spec/integration/autopilot/v1/assistant/query_spec.rb +306 -0
- data/spec/integration/autopilot/v1/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/task/field_spec.rb +207 -0
- data/spec/integration/autopilot/v1/assistant/task/sample_spec.rb +253 -0
- data/spec/integration/autopilot/v1/assistant/task/task_actions_spec.rb +87 -0
- data/spec/integration/autopilot/v1/assistant/task/task_statistics_spec.rb +50 -0
- data/spec/integration/autopilot/v1/assistant/task_spec.rb +262 -0
- data/spec/integration/autopilot/v1/assistant_spec.rb +270 -0
- data/spec/integration/preview/understand/assistant/query_spec.rb +8 -8
- data/spec/integration/preview/understand/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/preview/understand/assistant/{intent → task}/field_spec.rb +23 -23
- data/spec/integration/preview/understand/assistant/{intent → task}/sample_spec.rb +28 -28
- data/spec/integration/preview/understand/assistant/{intent/intent_actions_spec.rb → task/task_actions_spec.rb} +15 -15
- data/spec/integration/preview/understand/assistant/{intent/intent_statistics_spec.rb → task/task_statistics_spec.rb} +6 -6
- data/spec/integration/preview/understand/assistant/{intent_spec.rb → task_spec.rb} +53 -49
- data/spec/integration/preview/understand/assistant_spec.rb +12 -8
- data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +3 -7
- data/spec/integration/verify/v1/service_spec.rb +30 -0
- data/spec/integration/wireless/v1/command_spec.rb +99 -2
- data/spec/twiml/voice_response_spec.rb +25 -2
- metadata +78 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82c6b89bf22181ab4c74c1214738562fbfd45806
|
4
|
+
data.tar.gz: 711415d89893d32bc5c8d35c3e2431a96e047d34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd5ca81977cc69f73e9bfe379c17a569e6a8ef07ccdf3e5c3b0a9c1621dba9a91b4f9eefc4b29f8ea98e67fe83dad8b5d1a9eaf42ab230707646cc5a81422f2
|
7
|
+
data.tar.gz: f04fdf23b7966d7dcdb33ad324d23087a1bdff8751049328094e734737c08b0e7635b03ce9b296ae853a8024ba95de196b29df598c17ba22b2cc5e98f9b071fe
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,39 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2018-10-15] Version 5.15.0
|
5
|
+
----------------------------
|
6
|
+
**Library**
|
7
|
+
- PR #428: Fix custom param tests. Thanks to @ryan-rowland!
|
8
|
+
|
9
|
+
**Api**
|
10
|
+
- Add `coaching` and `call_sid_to_coach` to participant properties, create and update requests.
|
11
|
+
|
12
|
+
**Authy**
|
13
|
+
- Set public library visibility, and added PII stanza
|
14
|
+
- Dropped support for `FactorType` param given new Factor prefixes **(breaking change)**
|
15
|
+
- Supported `DELETE` actions for Authy resources
|
16
|
+
- Move Authy Services resources to `authy` subdomain
|
17
|
+
|
18
|
+
**Autopilot**
|
19
|
+
- Introduce `autopilot` subdomain with all resources from `preview.understand`
|
20
|
+
|
21
|
+
**Preview**
|
22
|
+
- Renamed Understand intent to task **(breaking change)**
|
23
|
+
- Deprecated Authy endpoints from `preview` to `authy` subdomain
|
24
|
+
|
25
|
+
**Taskrouter**
|
26
|
+
- Allow TaskQueue ReservationActivitySid and AssignmentActivitySid to not be configured for MultiTask Workspaces
|
27
|
+
|
28
|
+
**Verify**
|
29
|
+
- Add `LookupEnabled` optional parameter on Service resource creation or update.
|
30
|
+
- Add `SendDigits` optional parameter on Verification creation.
|
31
|
+
- Add delete action on Service resourse.
|
32
|
+
|
33
|
+
**Twiml**
|
34
|
+
- Add custom parameters to TwiML `Client` noun and renamed the optional `name` field to `identity`. This is a breaking change in Ruby, and applications will need to transition from `dial.client ''` and `dial.client 'alice'` formats to `dial.client` and `dial.client(identity: alice)` formats. **(breaking change)**
|
35
|
+
|
36
|
+
|
4
37
|
[2018-10-04] Version 5.14.1
|
5
38
|
----------------------------
|
6
39
|
**Twiml**
|
data/README.md
CHANGED
@@ -27,13 +27,13 @@ in-line code documentation here in the library.
|
|
27
27
|
To install using [Bundler][bundler] grab the latest stable version:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
gem 'twilio-ruby', '~> 5.
|
30
|
+
gem 'twilio-ruby', '~> 5.15.0'
|
31
31
|
```
|
32
32
|
|
33
33
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
34
34
|
|
35
35
|
```bash
|
36
|
-
gem install twilio-ruby -v 5.
|
36
|
+
gem install twilio-ruby -v 5.15.0
|
37
37
|
```
|
38
38
|
|
39
39
|
To build and install the development branch yourself from the latest source:
|
@@ -39,7 +39,8 @@ module Twilio
|
|
39
39
|
# values separate them with a space. Defaults to `completed`.
|
40
40
|
# @param [String] recording_status_callback The URL which Twilio will make its GET
|
41
41
|
# or POST request to for the recording events specified in parameter
|
42
|
-
# RecordingStatusCallbackEvent.
|
42
|
+
# RecordingStatusCallbackEvent. See [RecordingStatusCallback
|
43
|
+
# parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback) for more details.
|
43
44
|
# @param [String] recording_status_callback_method The HTTP method Twilio should
|
44
45
|
# use when making a request to the RecordingStatusCallback URL. Possible values:
|
45
46
|
# `GET`, `POST`. Defaults to `POST`.
|
@@ -0,0 +1,55 @@
|
|
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 Authy < Domain
|
12
|
+
##
|
13
|
+
# Initialize the Authy Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://authy.twilio.com'
|
18
|
+
@host = 'authy.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of authy
|
27
|
+
def v1
|
28
|
+
@v1 ||= V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] sid A 34 character string that uniquely identifies this Service.
|
33
|
+
# @return [Twilio::REST::Authy::V1::ServiceInstance] if sid was passed.
|
34
|
+
# @return [Twilio::REST::Authy::V1::ServiceList]
|
35
|
+
def services(sid=:unset)
|
36
|
+
self.v1.services(sid)
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# @param [form.FormType] form_type The Form Type of this Form. One of
|
41
|
+
# `form-app-push`, `form-sms` or `form-totp`.
|
42
|
+
# @return [Twilio::REST::Authy::V1::FormInstance] if form_type was passed.
|
43
|
+
# @return [Twilio::REST::Authy::V1::FormList]
|
44
|
+
def forms(form_type=:unset)
|
45
|
+
self.v1.forms(form_type)
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Provide a user friendly representation
|
50
|
+
def to_s
|
51
|
+
'#<Twilio::REST::Authy>'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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 Authy
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of Authy
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@services = nil
|
19
|
+
@forms = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @param [String] sid A 34 character string that uniquely identifies this Service.
|
24
|
+
# @return [Twilio::REST::Authy::V1::ServiceContext] if sid was passed.
|
25
|
+
# @return [Twilio::REST::Authy::V1::ServiceList]
|
26
|
+
def services(sid=:unset)
|
27
|
+
if sid.nil?
|
28
|
+
raise ArgumentError, 'sid cannot be nil'
|
29
|
+
elsif sid == :unset
|
30
|
+
@services ||= ServiceList.new self
|
31
|
+
else
|
32
|
+
ServiceContext.new(self, sid)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# @param [form.FormType] form_type The Form Type of this Form. One of
|
38
|
+
# `form-app-push`, `form-sms` or `form-totp`.
|
39
|
+
# @return [Twilio::REST::Authy::V1::FormContext] if form_type was passed.
|
40
|
+
# @return [Twilio::REST::Authy::V1::FormList]
|
41
|
+
def forms(form_type=:unset)
|
42
|
+
if form_type.nil?
|
43
|
+
raise ArgumentError, 'form_type cannot be nil'
|
44
|
+
elsif form_type == :unset
|
45
|
+
@forms ||= FormList.new self
|
46
|
+
else
|
47
|
+
FormContext.new(self, form_type)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Provide a user friendly representation
|
53
|
+
def to_s
|
54
|
+
'<Twilio::REST::Authy::V1>'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,190 @@
|
|
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 Authy < Domain
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class FormList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the FormList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [FormList] FormList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.Authy.V1.FormList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
36
|
+
class FormPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the FormPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [FormPage] FormPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of FormInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [FormInstance] FormInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
FormInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Authy.V1.FormPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
67
|
+
class FormContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the FormContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [form.FormType] form_type The Form Type of this Form. One of
|
72
|
+
# `form-app-push`, `form-sms` or `form-totp`.
|
73
|
+
# @return [FormContext] FormContext
|
74
|
+
def initialize(version, form_type)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {form_type: form_type, }
|
79
|
+
@uri = "/Forms/#{@solution[:form_type]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Fetch a FormInstance
|
84
|
+
# @return [FormInstance] Fetched FormInstance
|
85
|
+
def fetch
|
86
|
+
params = Twilio::Values.of({})
|
87
|
+
|
88
|
+
payload = @version.fetch(
|
89
|
+
'GET',
|
90
|
+
@uri,
|
91
|
+
params,
|
92
|
+
)
|
93
|
+
|
94
|
+
FormInstance.new(@version, payload, form_type: @solution[:form_type], )
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Provide a user friendly representation
|
99
|
+
def to_s
|
100
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
101
|
+
"#<Twilio.Authy.V1.FormContext #{context}>"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
107
|
+
class FormInstance < InstanceResource
|
108
|
+
##
|
109
|
+
# Initialize the FormInstance
|
110
|
+
# @param [Version] version Version that contains the resource
|
111
|
+
# @param [Hash] payload payload that contains response from Twilio
|
112
|
+
# @param [form.FormType] form_type The Form Type of this Form. One of
|
113
|
+
# `form-app-push`, `form-sms` or `form-totp`.
|
114
|
+
# @return [FormInstance] FormInstance
|
115
|
+
def initialize(version, payload, form_type: nil)
|
116
|
+
super(version)
|
117
|
+
|
118
|
+
# Marshaled Properties
|
119
|
+
@properties = {
|
120
|
+
'form_type' => payload['form_type'],
|
121
|
+
'forms' => payload['forms'],
|
122
|
+
'form_meta' => payload['form_meta'],
|
123
|
+
'url' => payload['url'],
|
124
|
+
}
|
125
|
+
|
126
|
+
# Context
|
127
|
+
@instance_context = nil
|
128
|
+
@params = {'form_type' => form_type || @properties['form_type'], }
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Generate an instance context for the instance, the context is capable of
|
133
|
+
# performing various actions. All instance actions are proxied to the context
|
134
|
+
# @return [FormContext] FormContext for this FormInstance
|
135
|
+
def context
|
136
|
+
unless @instance_context
|
137
|
+
@instance_context = FormContext.new(@version, @params['form_type'], )
|
138
|
+
end
|
139
|
+
@instance_context
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# @return [form.FormType] The Form Type of this Form
|
144
|
+
def form_type
|
145
|
+
@properties['form_type']
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# @return [Hash] Object that contains the available forms for this form type.
|
150
|
+
def forms
|
151
|
+
@properties['forms']
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# @return [Hash] Additional information for the available forms for this form type.
|
156
|
+
def form_meta
|
157
|
+
@properties['form_meta']
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# @return [String] The URL to access the forms for this form type.
|
162
|
+
def url
|
163
|
+
@properties['url']
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Fetch a FormInstance
|
168
|
+
# @return [FormInstance] Fetched FormInstance
|
169
|
+
def fetch
|
170
|
+
context.fetch
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Provide a user friendly representation
|
175
|
+
def to_s
|
176
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
177
|
+
"<Twilio.Authy.V1.FormInstance #{values}>"
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Provide a detailed, user friendly representation
|
182
|
+
def inspect
|
183
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
184
|
+
"<Twilio.Authy.V1.FormInstance #{values}>"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,378 @@
|
|
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 Authy < Domain
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class ServiceList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the ServiceList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [ServiceList] ServiceList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Services"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
30
|
+
# Request is executed immediately.
|
31
|
+
# @param [String] friendly_name A human readable description of this resource, up
|
32
|
+
# to 64 characters.
|
33
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
34
|
+
def create(friendly_name: nil)
|
35
|
+
data = Twilio::Values.of({'FriendlyName' => friendly_name, })
|
36
|
+
|
37
|
+
payload = @version.create(
|
38
|
+
'POST',
|
39
|
+
@uri,
|
40
|
+
data: data
|
41
|
+
)
|
42
|
+
|
43
|
+
ServiceInstance.new(@version, payload, )
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Lists ServiceInstance records from the API as a list.
|
48
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
49
|
+
# memory before returning.
|
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
|
53
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
54
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
55
|
+
# efficient page size, i.e. min(limit, 1000)
|
56
|
+
# @return [Array] Array of up to limit results
|
57
|
+
def list(limit: nil, page_size: nil)
|
58
|
+
self.stream(limit: limit, page_size: page_size).entries
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
63
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
64
|
+
# is reached.
|
65
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
66
|
+
# guarantees to never return more than limit. Default is no limit.
|
67
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
68
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
69
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
70
|
+
# efficient page size, i.e. min(limit, 1000)
|
71
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
72
|
+
def stream(limit: nil, page_size: nil)
|
73
|
+
limits = @version.read_limits(limit, page_size)
|
74
|
+
|
75
|
+
page = self.page(page_size: limits[:page_size], )
|
76
|
+
|
77
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# When passed a block, yields ServiceInstance records from the API.
|
82
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
83
|
+
# is reached.
|
84
|
+
def each
|
85
|
+
limits = @version.read_limits
|
86
|
+
|
87
|
+
page = self.page(page_size: limits[:page_size], )
|
88
|
+
|
89
|
+
@version.stream(page,
|
90
|
+
limit: limits[:limit],
|
91
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
96
|
+
# Request is executed immediately.
|
97
|
+
# @param [String] page_token PageToken provided by the API
|
98
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
99
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
100
|
+
# @return [Page] Page of ServiceInstance
|
101
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
102
|
+
params = Twilio::Values.of({
|
103
|
+
'PageToken' => page_token,
|
104
|
+
'Page' => page_number,
|
105
|
+
'PageSize' => page_size,
|
106
|
+
})
|
107
|
+
response = @version.page(
|
108
|
+
'GET',
|
109
|
+
@uri,
|
110
|
+
params
|
111
|
+
)
|
112
|
+
ServicePage.new(@version, response, @solution)
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
117
|
+
# Request is executed immediately.
|
118
|
+
# @param [String] target_url API-generated URL for the requested results page
|
119
|
+
# @return [Page] Page of ServiceInstance
|
120
|
+
def get_page(target_url)
|
121
|
+
response = @version.domain.request(
|
122
|
+
'GET',
|
123
|
+
target_url
|
124
|
+
)
|
125
|
+
ServicePage.new(@version, response, @solution)
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Provide a user friendly representation
|
130
|
+
def to_s
|
131
|
+
'#<Twilio.Authy.V1.ServiceList>'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
137
|
+
class ServicePage < Page
|
138
|
+
##
|
139
|
+
# Initialize the ServicePage
|
140
|
+
# @param [Version] version Version that contains the resource
|
141
|
+
# @param [Response] response Response from the API
|
142
|
+
# @param [Hash] solution Path solution for the resource
|
143
|
+
# @return [ServicePage] ServicePage
|
144
|
+
def initialize(version, response, solution)
|
145
|
+
super(version, response)
|
146
|
+
|
147
|
+
# Path Solution
|
148
|
+
@solution = solution
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# Build an instance of ServiceInstance
|
153
|
+
# @param [Hash] payload Payload response from the API
|
154
|
+
# @return [ServiceInstance] ServiceInstance
|
155
|
+
def get_instance(payload)
|
156
|
+
ServiceInstance.new(@version, payload, )
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Provide a user friendly representation
|
161
|
+
def to_s
|
162
|
+
'<Twilio.Authy.V1.ServicePage>'
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
168
|
+
class ServiceContext < InstanceContext
|
169
|
+
##
|
170
|
+
# Initialize the ServiceContext
|
171
|
+
# @param [Version] version Version that contains the resource
|
172
|
+
# @param [String] sid A 34 character string that uniquely identifies this Service.
|
173
|
+
# @return [ServiceContext] ServiceContext
|
174
|
+
def initialize(version, sid)
|
175
|
+
super(version)
|
176
|
+
|
177
|
+
# Path Solution
|
178
|
+
@solution = {sid: sid, }
|
179
|
+
@uri = "/Services/#{@solution[:sid]}"
|
180
|
+
|
181
|
+
# Dependents
|
182
|
+
@entities = nil
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Deletes the ServiceInstance
|
187
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
188
|
+
def delete
|
189
|
+
@version.delete('delete', @uri)
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Fetch a ServiceInstance
|
194
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
195
|
+
def fetch
|
196
|
+
params = Twilio::Values.of({})
|
197
|
+
|
198
|
+
payload = @version.fetch(
|
199
|
+
'GET',
|
200
|
+
@uri,
|
201
|
+
params,
|
202
|
+
)
|
203
|
+
|
204
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Update the ServiceInstance
|
209
|
+
# @param [String] friendly_name A human readable description of this resource, up
|
210
|
+
# to 64 characters.
|
211
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
212
|
+
def update(friendly_name: :unset)
|
213
|
+
data = Twilio::Values.of({'FriendlyName' => friendly_name, })
|
214
|
+
|
215
|
+
payload = @version.update(
|
216
|
+
'POST',
|
217
|
+
@uri,
|
218
|
+
data: data,
|
219
|
+
)
|
220
|
+
|
221
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
|
222
|
+
end
|
223
|
+
|
224
|
+
##
|
225
|
+
# Access the entities
|
226
|
+
# @return [EntityList]
|
227
|
+
# @return [EntityContext] if identity was passed.
|
228
|
+
def entities(identity=:unset)
|
229
|
+
raise ArgumentError, 'identity cannot be nil' if identity.nil?
|
230
|
+
|
231
|
+
if identity != :unset
|
232
|
+
return EntityContext.new(@version, @solution[:sid], identity, )
|
233
|
+
end
|
234
|
+
|
235
|
+
unless @entities
|
236
|
+
@entities = EntityList.new(@version, service_sid: @solution[:sid], )
|
237
|
+
end
|
238
|
+
|
239
|
+
@entities
|
240
|
+
end
|
241
|
+
|
242
|
+
##
|
243
|
+
# Provide a user friendly representation
|
244
|
+
def to_s
|
245
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
246
|
+
"#<Twilio.Authy.V1.ServiceContext #{context}>"
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
252
|
+
class ServiceInstance < InstanceResource
|
253
|
+
##
|
254
|
+
# Initialize the ServiceInstance
|
255
|
+
# @param [Version] version Version that contains the resource
|
256
|
+
# @param [Hash] payload payload that contains response from Twilio
|
257
|
+
# @param [String] sid A 34 character string that uniquely identifies this Service.
|
258
|
+
# @return [ServiceInstance] ServiceInstance
|
259
|
+
def initialize(version, payload, sid: nil)
|
260
|
+
super(version)
|
261
|
+
|
262
|
+
# Marshaled Properties
|
263
|
+
@properties = {
|
264
|
+
'sid' => payload['sid'],
|
265
|
+
'friendly_name' => payload['friendly_name'],
|
266
|
+
'account_sid' => payload['account_sid'],
|
267
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
268
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
269
|
+
'url' => payload['url'],
|
270
|
+
'links' => payload['links'],
|
271
|
+
}
|
272
|
+
|
273
|
+
# Context
|
274
|
+
@instance_context = nil
|
275
|
+
@params = {'sid' => sid || @properties['sid'], }
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# Generate an instance context for the instance, the context is capable of
|
280
|
+
# performing various actions. All instance actions are proxied to the context
|
281
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
282
|
+
def context
|
283
|
+
unless @instance_context
|
284
|
+
@instance_context = ServiceContext.new(@version, @params['sid'], )
|
285
|
+
end
|
286
|
+
@instance_context
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# @return [String] A string that uniquely identifies this Service.
|
291
|
+
def sid
|
292
|
+
@properties['sid']
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# @return [String] A human readable description of this resource.
|
297
|
+
def friendly_name
|
298
|
+
@properties['friendly_name']
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# @return [String] Account Sid.
|
303
|
+
def account_sid
|
304
|
+
@properties['account_sid']
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# @return [Time] The date this Service was created
|
309
|
+
def date_created
|
310
|
+
@properties['date_created']
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# @return [Time] The date this Service was updated
|
315
|
+
def date_updated
|
316
|
+
@properties['date_updated']
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# @return [String] The URL of this resource.
|
321
|
+
def url
|
322
|
+
@properties['url']
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# @return [String] Nested resource URLs.
|
327
|
+
def links
|
328
|
+
@properties['links']
|
329
|
+
end
|
330
|
+
|
331
|
+
##
|
332
|
+
# Deletes the ServiceInstance
|
333
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
334
|
+
def delete
|
335
|
+
context.delete
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# Fetch a ServiceInstance
|
340
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
341
|
+
def fetch
|
342
|
+
context.fetch
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# Update the ServiceInstance
|
347
|
+
# @param [String] friendly_name A human readable description of this resource, up
|
348
|
+
# to 64 characters.
|
349
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
350
|
+
def update(friendly_name: :unset)
|
351
|
+
context.update(friendly_name: friendly_name, )
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# Access the entities
|
356
|
+
# @return [entities] entities
|
357
|
+
def entities
|
358
|
+
context.entities
|
359
|
+
end
|
360
|
+
|
361
|
+
##
|
362
|
+
# Provide a user friendly representation
|
363
|
+
def to_s
|
364
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
365
|
+
"<Twilio.Authy.V1.ServiceInstance #{values}>"
|
366
|
+
end
|
367
|
+
|
368
|
+
##
|
369
|
+
# Provide a detailed, user friendly representation
|
370
|
+
def inspect
|
371
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
372
|
+
"<Twilio.Authy.V1.ServiceInstance #{values}>"
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|