twilio-ruby 5.15.1 → 5.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +15 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api.rb +6 -0
  5. data/lib/twilio-ruby/rest/api/v2010.rb +4 -0
  6. data/lib/twilio-ruby/rest/api/v2010/account.rb +20 -0
  7. data/lib/twilio-ruby/rest/api/v2010/account/balance.rb +131 -0
  8. data/lib/twilio-ruby/rest/authy.rb +8 -8
  9. data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
  10. data/lib/twilio-ruby/rest/autopilot.rb +1 -1
  11. data/lib/twilio-ruby/rest/autopilot/v1.rb +2 -1
  12. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +44 -30
  13. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +6 -4
  14. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +5 -4
  15. data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +6 -4
  16. data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +33 -25
  17. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +23 -13
  18. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +14 -12
  19. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +37 -26
  20. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +7 -5
  21. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb +14 -8
  22. data/lib/twilio-ruby/rest/client.rb +6 -0
  23. data/lib/twilio-ruby/rest/preview.rb +8 -8
  24. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  25. data/lib/twilio-ruby/rest/proxy/v1/service.rb +22 -3
  26. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +5 -1
  27. data/lib/twilio-ruby/rest/video.rb +9 -9
  28. data/lib/twilio-ruby/rest/video/v1.rb +16 -16
  29. data/lib/twilio-ruby/version.rb +1 -1
  30. data/spec/integration/api/v2010/account/balance_spec.rb +45 -0
  31. data/spec/integration/api/v2010/account_spec.rb +6 -3
  32. data/spec/integration/proxy/v1/service_spec.rb +3 -0
  33. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a227849b2942687808bcf7cb51c513840576e503
4
- data.tar.gz: 7c0cda0691761ffacc08e23488a132969b2064f1
2
+ SHA256:
3
+ metadata.gz: ea1ce62604d7c72923190c05d2ecf648ebb1450fc0fd2de2e3ea657cebd22914
4
+ data.tar.gz: 94a73b9d229bc6ba59a2c911934e619e9fc3f156c7aa5b87c56d31692b594771
5
5
  SHA512:
6
- metadata.gz: d876dfee60d643e27076ca5d0ebecc6e2c2c767caa0731d4a77e59e02d1a55dbee4ae93580cd2ea3e5412bc594a3555fba7a7d5da81abd086f34f544f3775d5e
7
- data.tar.gz: c0113b1e3412e7a63aefaa4de7fc27c8f22b6ebab77603649e5cc011b76bbddc64176b4cd989a5c566ea4cf2beb2f1d34c829b2c80f7b98686b6fbf4f910c3fa
6
+ metadata.gz: a4fa9b6784a16a34bf69f7ba4ef91a1f20f61a1e4dfeb20f25bd06f719dca189decbab72a269cba07fac42b1e3b63a5745cffd93a3c1ded29d4d9ee5b1a03ddf
7
+ data.tar.gz: 64a8d949246525d06dd54288e5ef2737fcbd8a32e749df7708a5b2917863195fd16af0f11b7d5cbd7b8d478f1459de69c3bbb8a15ae6f411cbcfd7d0a041a99d
data/CHANGES.md CHANGED
@@ -1,6 +1,21 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2018-10-29] Version 5.15.2
5
+ ----------------------------
6
+ **Api**
7
+ - Add new Balance resource:
8
+ - url: '/v1/Accounts/{account sid}/Balance'
9
+ - supported methods: GET
10
+ - returns the balance of the account
11
+
12
+ **Proxy**
13
+ - Add chat_instance_sid to Service
14
+
15
+ **Verify**
16
+ - Add `Locale` optional parameter on Verification creation.
17
+
18
+
4
19
  [2018-10-15] Version 5.15.1
5
20
  ----------------------------
6
21
  **Api**
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.15.1'
30
+ gem 'twilio-ruby', '~> 5.15.2'
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.15.1
36
+ gem install twilio-ruby -v 5.15.2
37
37
  ```
38
38
 
39
39
  To build and install the development branch yourself from the latest source:
@@ -77,6 +77,12 @@ module Twilio
77
77
  self.account.available_phone_numbers(country_code)
78
78
  end
79
79
 
80
+ ##
81
+ # @return [Twilio::REST::Api::V2010::AccountContext::BalanceInstance]
82
+ def balance
83
+ self.account.balance()
84
+ end
85
+
80
86
  ##
81
87
  # @param [String] sid A 34-character string that uniquely identifies the Call
82
88
  # resource.
@@ -62,6 +62,10 @@ module Twilio
62
62
  self.account.available_phone_numbers(country_code)
63
63
  end
64
64
 
65
+ def balance
66
+ self.account.balance()
67
+ end
68
+
65
69
  def calls(sid=:unset)
66
70
  self.account.calls(sid)
67
71
  end
@@ -197,6 +197,7 @@ module Twilio
197
197
  @applications = nil
198
198
  @authorized_connect_apps = nil
199
199
  @available_phone_numbers = nil
200
+ @balance = nil
200
201
  @calls = nil
201
202
  @conferences = nil
202
203
  @connect_apps = nil
@@ -328,6 +329,18 @@ module Twilio
328
329
  @available_phone_numbers
329
330
  end
330
331
 
332
+ ##
333
+ # Access the balance
334
+ # @return [BalanceList]
335
+ # @return [BalanceContext]
336
+ def balance
337
+ unless @balance
338
+ @balance = BalanceList.new(@version, account_sid: @solution[:sid], )
339
+ end
340
+
341
+ @balance
342
+ end
343
+
331
344
  ##
332
345
  # Access the calls
333
346
  # @return [CallList]
@@ -790,6 +803,13 @@ module Twilio
790
803
  context.available_phone_numbers
791
804
  end
792
805
 
806
+ ##
807
+ # Access the balance
808
+ # @return [balance] balance
809
+ def balance
810
+ context.balance
811
+ end
812
+
793
813
  ##
794
814
  # Access the calls
795
815
  # @return [calls] calls
@@ -0,0 +1,131 @@
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 Api < Domain
12
+ class V2010 < Version
13
+ class AccountContext < InstanceContext
14
+ class BalanceList < ListResource
15
+ ##
16
+ # Initialize the BalanceList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] account_sid The unique SID identifier of the Account.
19
+ # @return [BalanceList] BalanceList
20
+ def initialize(version, account_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {account_sid: account_sid}
25
+ @uri = "/Accounts/#{@solution[:account_sid]}/Balance.json"
26
+ end
27
+
28
+ ##
29
+ # Fetch a BalanceInstance
30
+ # @return [BalanceInstance] Fetched BalanceInstance
31
+ def fetch
32
+ params = Twilio::Values.of({})
33
+
34
+ payload = @version.fetch(
35
+ 'GET',
36
+ @uri,
37
+ params,
38
+ )
39
+
40
+ BalanceInstance.new(@version, payload, account_sid: @solution[:account_sid], )
41
+ end
42
+
43
+ ##
44
+ # Provide a user friendly representation
45
+ def to_s
46
+ '#<Twilio.Api.V2010.BalanceList>'
47
+ end
48
+ end
49
+
50
+ class BalancePage < Page
51
+ ##
52
+ # Initialize the BalancePage
53
+ # @param [Version] version Version that contains the resource
54
+ # @param [Response] response Response from the API
55
+ # @param [Hash] solution Path solution for the resource
56
+ # @return [BalancePage] BalancePage
57
+ def initialize(version, response, solution)
58
+ super(version, response)
59
+
60
+ # Path Solution
61
+ @solution = solution
62
+ end
63
+
64
+ ##
65
+ # Build an instance of BalanceInstance
66
+ # @param [Hash] payload Payload response from the API
67
+ # @return [BalanceInstance] BalanceInstance
68
+ def get_instance(payload)
69
+ BalanceInstance.new(@version, payload, account_sid: @solution[:account_sid], )
70
+ end
71
+
72
+ ##
73
+ # Provide a user friendly representation
74
+ def to_s
75
+ '<Twilio.Api.V2010.BalancePage>'
76
+ end
77
+ end
78
+
79
+ class BalanceInstance < InstanceResource
80
+ ##
81
+ # Initialize the BalanceInstance
82
+ # @param [Version] version Version that contains the resource
83
+ # @param [Hash] payload payload that contains response from Twilio
84
+ # @param [String] account_sid The unique SID identifier of the Account.
85
+ # @return [BalanceInstance] BalanceInstance
86
+ def initialize(version, payload, account_sid: nil)
87
+ super(version)
88
+
89
+ # Marshaled Properties
90
+ @properties = {
91
+ 'account_sid' => payload['account_sid'],
92
+ 'balance' => payload['balance'],
93
+ 'currency' => payload['currency'],
94
+ }
95
+ end
96
+
97
+ ##
98
+ # @return [String] Account Sid.
99
+ def account_sid
100
+ @properties['account_sid']
101
+ end
102
+
103
+ ##
104
+ # @return [String] Account balance
105
+ def balance
106
+ @properties['balance']
107
+ end
108
+
109
+ ##
110
+ # @return [String] Currency units
111
+ def currency
112
+ @properties['currency']
113
+ end
114
+
115
+ ##
116
+ # Provide a user friendly representation
117
+ def to_s
118
+ "<Twilio.Api.V2010.BalanceInstance>"
119
+ end
120
+
121
+ ##
122
+ # Provide a detailed, user friendly representation
123
+ def inspect
124
+ "<Twilio.Api.V2010.BalanceInstance>"
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
@@ -28,14 +28,6 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
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
31
  ##
40
32
  # @param [form.FormType] form_type The Form Type of this Form. One of
41
33
  # `form-app-push`, `form-sms` or `form-totp`.
@@ -45,6 +37,14 @@ module Twilio
45
37
  self.v1.forms(form_type)
46
38
  end
47
39
 
40
+ ##
41
+ # @param [String] sid A 34 character string that uniquely identifies this Service.
42
+ # @return [Twilio::REST::Authy::V1::ServiceInstance] if sid was passed.
43
+ # @return [Twilio::REST::Authy::V1::ServiceList]
44
+ def services(sid=:unset)
45
+ self.v1.services(sid)
46
+ end
47
+
48
48
  ##
49
49
  # Provide a user friendly representation
50
50
  def to_s
@@ -15,22 +15,8 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
- @services = nil
19
18
  @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
19
+ @services = nil
34
20
  end
35
21
 
36
22
  ##
@@ -48,6 +34,20 @@ module Twilio
48
34
  end
49
35
  end
50
36
 
37
+ ##
38
+ # @param [String] sid A 34 character string that uniquely identifies this Service.
39
+ # @return [Twilio::REST::Authy::V1::ServiceContext] if sid was passed.
40
+ # @return [Twilio::REST::Authy::V1::ServiceList]
41
+ def services(sid=:unset)
42
+ if sid.nil?
43
+ raise ArgumentError, 'sid cannot be nil'
44
+ elsif sid == :unset
45
+ @services ||= ServiceList.new self
46
+ else
47
+ ServiceContext.new(self, sid)
48
+ end
49
+ end
50
+
51
51
  ##
52
52
  # Provide a user friendly representation
53
53
  def to_s
@@ -29,7 +29,7 @@ module Twilio
29
29
  end
30
30
 
31
31
  ##
32
- # @param [String] sid A 34 character string that uniquely identifies this
32
+ # @param [String] sid A 34-character string that uniquely identifies this
33
33
  # resource.
34
34
  # @return [Twilio::REST::Autopilot::V1::AssistantInstance] if sid was passed.
35
35
  # @return [Twilio::REST::Autopilot::V1::AssistantList]
@@ -19,7 +19,8 @@ module Twilio
19
19
  end
20
20
 
21
21
  ##
22
- # @param [String] sid The sid
22
+ # @param [String] sid A 34-character string that uniquely identifies this
23
+ # resource.
23
24
  # @return [Twilio::REST::Autopilot::V1::AssistantContext] if sid was passed.
24
25
  # @return [Twilio::REST::Autopilot::V1::AssistantList]
25
26
  def assistants(sid=:unset)
@@ -113,16 +113,20 @@ module Twilio
113
113
  # @param [String] friendly_name A text description for the Assistant. It is
114
114
  # non-unique and can be up to 255 characters long.
115
115
  # @param [Boolean] log_queries A boolean that specifies whether queries should be
116
- # logged for 30 days further training. If false, no queries will be stored, if
117
- # true, queries will be stored for 30 days and deleted thereafter. Defaults to
118
- # true if no value is provided.
116
+ # logged for 30 days past training. If `false`, no queries will be stored. If
117
+ # `true`, queries will be stored for 30 days and deleted thereafter. Defaults to
118
+ # `true` if no value is provided.
119
119
  # @param [String] unique_name A user-provided string that uniquely identifies this
120
- # resource as an alternative to the sid. Unique up to 64 characters long.
120
+ # resource as an alternative to the sid. You can use the unique name in the URL
121
+ # path when addressing this resource. Unique up to 64 characters long.
121
122
  # @param [String] callback_url The callback_url
122
- # @param [String] callback_events The callback_events
123
- # @param [Hash] style_sheet A JSON object that defines the assistant style sheet
124
- # @param [Hash] defaults A JSON object that defines the assistant's default tasks
125
- # for various scenarios
123
+ # @param [String] callback_events A space-separated list of callback events that
124
+ # will trigger callbacks
125
+ # @param [Hash] style_sheet A JSON object that defines the assistant [style
126
+ # sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet)
127
+ # @param [Hash] defaults A JSON object that defines the assistant's [default
128
+ # tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various
129
+ # scenarios, including initation actions and fallback tasks.
126
130
  # @return [AssistantInstance] Newly created AssistantInstance
127
131
  def create(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset)
128
132
  data = Twilio::Values.of({
@@ -188,7 +192,8 @@ module Twilio
188
192
  ##
189
193
  # Initialize the AssistantContext
190
194
  # @param [Version] version Version that contains the resource
191
- # @param [String] sid The sid
195
+ # @param [String] sid A 34-character string that uniquely identifies this
196
+ # resource.
192
197
  # @return [AssistantContext] AssistantContext
193
198
  def initialize(version, sid)
194
199
  super(version)
@@ -227,16 +232,20 @@ module Twilio
227
232
  # @param [String] friendly_name A text description for the Assistant. It is
228
233
  # non-unique and can be up to 255 characters long.
229
234
  # @param [Boolean] log_queries A boolean that specifies whether queries should be
230
- # logged for 30 days further training. If false, no queries will be stored, if
231
- # true, queries will be stored for 30 days and deleted thereafter. Defaults to
232
- # true if no value is provided.
235
+ # logged for 30 days past training. If `false`, no queries will be stored. If
236
+ # `true`, queries will be stored for 30 days and deleted thereafter. Defaults to
237
+ # `true` if no value is provided.
233
238
  # @param [String] unique_name A user-provided string that uniquely identifies this
234
- # resource as an alternative to the sid. Unique up to 64 characters long.
239
+ # resource as an alternative to the sid. You can use the unique name in the URL
240
+ # path when addressing this resource. Unique up to 64 characters long.
235
241
  # @param [String] callback_url The callback_url
236
- # @param [String] callback_events The callback_events
237
- # @param [Hash] style_sheet A JSON object that defines the assistant style sheet
238
- # @param [Hash] defaults A JSON object that defines the assistant's default tasks
239
- # for various scenarios
242
+ # @param [String] callback_events A space-separated list of callback events that
243
+ # will trigger callbacks
244
+ # @param [Hash] style_sheet A JSON object that defines the assistant [style
245
+ # sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet)
246
+ # @param [Hash] defaults A JSON object that defines the assistant's [default
247
+ # tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various
248
+ # scenarios, including initation actions and fallback tasks.
240
249
  # @return [AssistantInstance] Updated AssistantInstance
241
250
  def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset)
242
251
  data = Twilio::Values.of({
@@ -386,7 +395,8 @@ module Twilio
386
395
  # Initialize the AssistantInstance
387
396
  # @param [Version] version Version that contains the resource
388
397
  # @param [Hash] payload payload that contains response from Twilio
389
- # @param [String] sid The sid
398
+ # @param [String] sid A 34-character string that uniquely identifies this
399
+ # resource.
390
400
  # @return [AssistantInstance] AssistantInstance
391
401
  def initialize(version, payload, sid: nil)
392
402
  super(version)
@@ -448,7 +458,7 @@ module Twilio
448
458
  end
449
459
 
450
460
  ##
451
- # @return [String] The unique ID (Sid) of the latest model build. Null if no model has been built.
461
+ # @return [String] The latest_model_build_sid
452
462
  def latest_model_build_sid
453
463
  @properties['latest_model_build_sid']
454
464
  end
@@ -460,19 +470,19 @@ module Twilio
460
470
  end
461
471
 
462
472
  ##
463
- # @return [Boolean] A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter.
473
+ # @return [Boolean] A boolean that specifies whether queries should be logged for 30 days past training. If `false`, no queries will be stored. If `true`, queries will be stored for 30 days and deleted thereafter.
464
474
  def log_queries
465
475
  @properties['log_queries']
466
476
  end
467
477
 
468
478
  ##
469
- # @return [String] A 34 character string that uniquely identifies this resource.
479
+ # @return [String] A 34-character string that uniquely identifies this resource.
470
480
  def sid
471
481
  @properties['sid']
472
482
  end
473
483
 
474
484
  ##
475
- # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long.
485
+ # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
476
486
  def unique_name
477
487
  @properties['unique_name']
478
488
  end
@@ -507,16 +517,20 @@ module Twilio
507
517
  # @param [String] friendly_name A text description for the Assistant. It is
508
518
  # non-unique and can be up to 255 characters long.
509
519
  # @param [Boolean] log_queries A boolean that specifies whether queries should be
510
- # logged for 30 days further training. If false, no queries will be stored, if
511
- # true, queries will be stored for 30 days and deleted thereafter. Defaults to
512
- # true if no value is provided.
520
+ # logged for 30 days past training. If `false`, no queries will be stored. If
521
+ # `true`, queries will be stored for 30 days and deleted thereafter. Defaults to
522
+ # `true` if no value is provided.
513
523
  # @param [String] unique_name A user-provided string that uniquely identifies this
514
- # resource as an alternative to the sid. Unique up to 64 characters long.
524
+ # resource as an alternative to the sid. You can use the unique name in the URL
525
+ # path when addressing this resource. Unique up to 64 characters long.
515
526
  # @param [String] callback_url The callback_url
516
- # @param [String] callback_events The callback_events
517
- # @param [Hash] style_sheet A JSON object that defines the assistant style sheet
518
- # @param [Hash] defaults A JSON object that defines the assistant's default tasks
519
- # for various scenarios
527
+ # @param [String] callback_events A space-separated list of callback events that
528
+ # will trigger callbacks
529
+ # @param [Hash] style_sheet A JSON object that defines the assistant [style
530
+ # sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet)
531
+ # @param [Hash] defaults A JSON object that defines the assistant's [default
532
+ # tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various
533
+ # scenarios, including initation actions and fallback tasks.
520
534
  # @return [AssistantInstance] Updated AssistantInstance
521
535
  def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset)
522
536
  context.update(