twilio-ruby 5.31.2 → 5.31.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGES.md +31 -0
  4. data/CODE_OF_CONDUCT.md +73 -0
  5. data/ISSUE_TEMPLATE.md +13 -13
  6. data/LICENSE.md +1 -1
  7. data/PULL_REQUEST_TEMPLATE.md +31 -0
  8. data/README.md +3 -2
  9. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +35 -1
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +0 -14
  11. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +359 -0
  12. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +12 -6
  13. data/lib/twilio-ruby/rest/preview.rb +2 -9
  14. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +2 -2
  15. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +5 -5
  16. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +5 -5
  17. data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +21 -0
  18. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +21 -13
  19. data/lib/twilio-ruby/rest/studio/v2/flow.rb +5 -5
  20. data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +2 -2
  21. data/lib/twilio-ruby/rest/verify/v2/service.rb +19 -3
  22. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -1
  23. data/lib/twilio-ruby/twiml/voice_response.rb +9 -6
  24. data/lib/twilio-ruby/version.rb +1 -1
  25. data/spec/integration/api/v2010/account/call/notification_spec.rb +8 -44
  26. data/spec/integration/api/v2010/account/call/payment_spec.rb +135 -0
  27. data/spec/integration/api/v2010/account/call_spec.rb +20 -10
  28. data/spec/integration/preview/bulk_exports/export/job_spec.rb +3 -0
  29. data/spec/integration/studio/v2/flow_spec.rb +7 -3
  30. data/spec/integration/studio/v2/flow_validate_spec.rb +7 -3
  31. data/spec/integration/verify/v2/service/verification_check_spec.rb +26 -0
  32. data/spec/integration/verify/v2/service_spec.rb +4 -0
  33. metadata +7 -12
  34. data/lib/twilio-ruby/rest/preview/acc_security.rb +0 -43
  35. data/lib/twilio-ruby/rest/preview/acc_security/service.rb +0 -395
  36. data/lib/twilio-ruby/rest/preview/acc_security/service/verification.rb +0 -185
  37. data/lib/twilio-ruby/rest/preview/acc_security/service/verification_check.rb +0 -182
  38. data/spec/integration/preview/acc_security/service/verification_check_spec.rb +0 -52
  39. data/spec/integration/preview/acc_security/service/verification_spec.rb +0 -52
  40. data/spec/integration/preview/acc_security/service_spec.rb +0 -185
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97e9af8abf406d407ed5b2ac3335d5920a14b3f15c57959ccb08f19d767380bd
4
- data.tar.gz: 45777c544fddd89d53041a640e43d3eef9efb62d3b14a89955c42dc031a113ca
3
+ metadata.gz: 236e413c122b4f2876aad35e70b6980b58cfe80266dba55d42c87b842ab08136
4
+ data.tar.gz: bde3f07e1175e3a15457b866af0554560efd3ab368cd02d469e0422318465284
5
5
  SHA512:
6
- metadata.gz: d1166fef8722efcdf85db0594e8ffc1b94612d3ac64f78c0caf955e55a98f7c73cd437a731bab380daff56ac297a0f1e4badc68b42214dab5c4c716105eaa14d
7
- data.tar.gz: 0a135ab533b362d551dc6832925fbcf8e295165d020a08c9108dd35c85ae931750fe8463d67135b24b316a09efdb15fbabc3f94dd6f352d7403ceac6907e6c30
6
+ metadata.gz: c16f6ab3796ceecae3569e8490ec437d27561613fae35c338e59661c5bf4b0d84ca2462c7df336c84bdc27ba6d9ea260e5ddf859e23e571e07b4b7563e3330d8
7
+ data.tar.gz: 2f7f7ecdec0b96df316c9daaacc7740344e198cb8384bf63dcc8a368e633212ce6c2224081cbe77a5fdd3e222a4651ce8da8e9ab87b72acdfad172722742e54f
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ bundler_args: --without development
5
5
 
6
6
  rvm:
7
7
  - ruby-head
8
+ - 2.7
8
9
  - 2.6
9
10
  - 2.5
10
11
  - 2.4
data/CHANGES.md CHANGED
@@ -1,6 +1,37 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2020-01-22] Version 5.31.3
5
+ ---------------------------
6
+ **Library - Docs**
7
+ - [PR #492](https://github.com/twilio/twilio-ruby/pull/492): baseline all the templated markdown docs. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
8
+
9
+ **Library - Chore**
10
+ - [PR #490](https://github.com/twilio/twilio-ruby/pull/490): add support for Ruby 2.7. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
11
+
12
+ **Api**
13
+ - Add payments public APIs
14
+ - Add optional parameter `byoc` to call create request.
15
+
16
+ **Flex**
17
+ - Updating a Flex Flow `creation_on_message` parameter documentation
18
+
19
+ **Preview**
20
+ -
21
+ - Removed Verify v2 from preview in favor of its own namespace as GA **(breaking change)**
22
+
23
+ **Studio**
24
+ - Flow definition type update from string to object
25
+
26
+ **Verify**
27
+ - Add `AppHash` parameter when creating a Verification.
28
+ - Add `DoNotShareWarningEnabled` parameter to the Service resource.
29
+
30
+ **Twiml**
31
+ - Add `track` attribute to siprec noun.
32
+ - Add attribute `byoc` to `<Number>`
33
+
34
+
4
35
  [2020-01-08] Version 5.31.2
5
36
  ---------------------------
6
37
  **Library - Chore**
@@ -0,0 +1,73 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at open-source@twilio.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
data/ISSUE_TEMPLATE.md CHANGED
@@ -1,9 +1,14 @@
1
- *Note: These issues are for bugs and feature requests for the helper libraries.
2
- If you need help or support, please email help@twilio.com and one of our experts
3
- will assist you!*
1
+ <!--
2
+ If this is a feature request, make sure you search Issues for an existing request before creating a new one!
3
+ -->
4
4
 
5
+ ### Issue Summary
6
+ A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples.
5
7
 
6
- **Version:**
8
+ ### Steps to Reproduce
9
+ 1. This is the first step
10
+ 2. This is the second step
11
+ 3. Further steps, etc.
7
12
 
8
13
  ### Code Snippet
9
14
  ```ruby
@@ -12,15 +17,10 @@ will assist you!*
12
17
 
13
18
  ### Exception/Log
14
19
  ```
15
- <place exception/log here>
20
+ # paste exception/log here
16
21
  ```
17
22
 
18
- ### Steps to Reproduce
19
- 1.
20
- 2.
21
- 3.
22
-
23
+ ### Technical details:
24
+ * twilio-ruby version:
25
+ * ruby version:
23
26
 
24
- ### Feature Request
25
- _If this is a feature request, make sure you search Issues for an existing
26
- request before creating a new one!_
data/LICENSE.md CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ <!--
2
+ We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below.
3
+
4
+ Please format the PR title appropriately based on the type of change:
5
+ <type>[!]: <description>
6
+ Where <type> is one of: docs, chore, feat, fix, test.
7
+ Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature).
8
+
9
+ **All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.**
10
+
11
+ Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
12
+ e.g.
13
+ Fixes #1
14
+ Closes #2
15
+ -->
16
+
17
+ # Fixes #
18
+
19
+ A short description of what this PR does.
20
+
21
+ ### Checklist
22
+ - [ ] I acknowledge that all my contributions will be made under the project's license
23
+ - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
24
+ - [ ] I have read the [Contribution Guidelines](CONTRIBUTING.md) and my PR follows them
25
+ - [ ] I have titled the PR appropriately
26
+ - [ ] I have updated my branch with the master branch
27
+ - [ ] I have added tests that prove my fix is effective or that my feature works
28
+ - [ ] I have added necessary documentation about the functionality in the appropriate .md file
29
+ - [ ] I have added inline documentation to the code I modified
30
+
31
+ If you have questions, please file a [support ticket](https://twilio.com/help/contact), or create a GitHub Issue in this repository.
data/README.md CHANGED
@@ -21,6 +21,7 @@ This library supports the following Ruby implementations:
21
21
  * Ruby 2.4
22
22
  * Ruby 2.5
23
23
  * Ruby 2.6
24
+ * Ruby 2.7
24
25
 
25
26
  ### Migrating from 4.x
26
27
 
@@ -31,13 +32,13 @@ This library supports the following Ruby implementations:
31
32
  To install using [Bundler][bundler] grab the latest stable version:
32
33
 
33
34
  ```ruby
34
- gem 'twilio-ruby', '~> 5.31.2'
35
+ gem 'twilio-ruby', '~> 5.31.3'
35
36
  ```
36
37
 
37
38
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
38
39
 
39
40
  ```bash
40
- gem install twilio-ruby -v 5.31.2
41
+ gem install twilio-ruby -v 5.31.3
41
42
  ```
42
43
 
43
44
  To build and install the development branch yourself from the latest source:
@@ -127,6 +127,9 @@ module Twilio
127
127
  # @param [String] machine_detection_silence_timeout The number of milliseconds of
128
128
  # initial silence after which an `unknown` AnsweredBy result will be returned.
129
129
  # Possible Values: 2000-10000. Default: 5000.
130
+ # @param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route
131
+ # this call with. Note that `byoc` is only meaningful when `to` is a phone number;
132
+ # it will otherwise be ignored. (Beta)
130
133
  # @param [String] url The absolute URL that returns the TwiML instructions for the
131
134
  # call. We will call this URL using the `method` when the call connects. For more
132
135
  # information, see the [Url
@@ -138,7 +141,7 @@ module Twilio
138
141
  # @param [String] application_sid The SID of the Application resource that will
139
142
  # handle the call, if the call will be handled by an application.
140
143
  # @return [CallInstance] Newly created CallInstance
141
- def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, url: :unset, twiml: :unset, application_sid: :unset)
144
+ def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, byoc: :unset, url: :unset, twiml: :unset, application_sid: :unset)
142
145
  data = Twilio::Values.of({
143
146
  'To' => to,
144
147
  'From' => from,
@@ -167,6 +170,7 @@ module Twilio
167
170
  'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold,
168
171
  'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold,
169
172
  'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout,
173
+ 'Byoc' => byoc,
170
174
  })
171
175
 
172
176
  payload = @version.create(
@@ -412,6 +416,7 @@ module Twilio
412
416
  @recordings = nil
413
417
  @notifications = nil
414
418
  @feedback = nil
419
+ @payments = nil
415
420
  end
416
421
 
417
422
  ##
@@ -541,6 +546,28 @@ module Twilio
541
546
  FeedbackContext.new(@version, @solution[:account_sid], @solution[:sid], )
542
547
  end
543
548
 
549
+ ##
550
+ # Access the payments
551
+ # @return [PaymentList]
552
+ # @return [PaymentContext] if sid was passed.
553
+ def payments(sid=:unset)
554
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
555
+
556
+ if sid != :unset
557
+ return PaymentContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
558
+ end
559
+
560
+ unless @payments
561
+ @payments = PaymentList.new(
562
+ @version,
563
+ account_sid: @solution[:account_sid],
564
+ call_sid: @solution[:sid],
565
+ )
566
+ end
567
+
568
+ @payments
569
+ end
570
+
544
571
  ##
545
572
  # Provide a user friendly representation
546
573
  def to_s
@@ -844,6 +871,13 @@ module Twilio
844
871
  context.feedback
845
872
  end
846
873
 
874
+ ##
875
+ # Access the payments
876
+ # @return [payments] payments
877
+ def payments
878
+ context.payments
879
+ end
880
+
847
881
  ##
848
882
  # Provide a user friendly representation
849
883
  def to_s
@@ -231,13 +231,6 @@ module Twilio
231
231
  )
232
232
  end
233
233
 
234
- ##
235
- # Deletes the NotificationInstance
236
- # @return [Boolean] true if delete succeeds, false otherwise
237
- def delete
238
- @version.delete('delete', @uri)
239
- end
240
-
241
234
  ##
242
235
  # Provide a user friendly representation
243
236
  def to_s
@@ -421,13 +414,6 @@ module Twilio
421
414
  context.fetch
422
415
  end
423
416
 
424
- ##
425
- # Deletes the NotificationInstance
426
- # @return [Boolean] true if delete succeeds, false otherwise
427
- def delete
428
- context.delete
429
- end
430
-
431
417
  ##
432
418
  # Provide a user friendly representation
433
419
  def to_s
@@ -0,0 +1,359 @@
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 CallContext < InstanceContext
15
+ ##
16
+ # 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.
17
+ class PaymentList < ListResource
18
+ ##
19
+ # Initialize the PaymentList
20
+ # @param [Version] version Version that contains the resource
21
+ # @param [String] account_sid The SID of the
22
+ # [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments
23
+ # resource.
24
+ # @param [String] call_sid The SID of the
25
+ # [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments
26
+ # resource is associated with. This will refer to the call sid that is producing
27
+ # the payment card (credit/ACH) information thru DTMF.
28
+ # @return [PaymentList] PaymentList
29
+ def initialize(version, account_sid: nil, call_sid: nil)
30
+ super(version)
31
+
32
+ # Path Solution
33
+ @solution = {account_sid: account_sid, call_sid: call_sid}
34
+ @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments.json"
35
+ end
36
+
37
+ ##
38
+ # Retrieve a single page of PaymentInstance records from the API.
39
+ # Request is executed immediately.
40
+ # @param [String] idempotency_key A unique token for each payment session that
41
+ # should be provided to maintain idempotency of the session.
42
+ # @param [String] status_callback The URL we should call using the
43
+ # `status_callback` to send status information of payment session.
44
+ # @param [payment.BankAccountType] bank_account_type If Payment source is ACH,
45
+ # type of bank account. Can be: `consumer-checking`, `consumer-savings`,
46
+ # `commercial-checking`. The default value is `consumer-checking`.
47
+ # @param [String] charge_amount If this field is present and greater than `0.0`
48
+ # payment source will be charged. Otherwise payment source will be tokenized.
49
+ # @param [String] currency Currency `charge_amount` is in. It's format should be
50
+ # as specified in [ISO
51
+ # 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format. The
52
+ # default value is `USD`.
53
+ # @param [String] description Decription of the charge.
54
+ # @param [String] input Kind of medium customer would enter payment source
55
+ # information in. Currently only 'DTMF' is supported, which means customer would
56
+ # use keypad of their phone to enter card number etc.
57
+ # @param [String] min_postal_code_length If postal code is expected, minimum
58
+ # length of the postal code. When user enters postal code, this value will be used
59
+ # to validate.
60
+ # @param [Hash] parameter Additonal data to be sent over to payment provider. It
61
+ # has to be a JSON string with only one level object. This parameter can be used
62
+ # to send information such as customer name, phone number etc. Refer to specific
63
+ # payment provider's documentation in Twilio console for supported
64
+ # names/values/format.
65
+ # @param [String] payment_connector Payment connector that you would like Twilio
66
+ # to use for processing payments. The default value is `Default`, which means you
67
+ # need to have at least one payment connector configured in Twilio with name
68
+ # 'Default'. If not you must provide connector configuration name here.
69
+ # @param [payment.PaymentMethod] payment_method Payment source type. Can be:
70
+ # `credit-card`, `ach-debit`. The default value is `credit-card`.
71
+ # @param [Boolean] postal_code Whether to expect postal code during payment source
72
+ # data gathering. Can be: `true`, `false`. The default value is `true`.
73
+ # @param [Boolean] security_code Whether to expect security code during payment
74
+ # source data gathering. Can be: `true`, `false`. The default value is `true`.
75
+ # @param [String] timeout The number of seconds that we should allow customer to
76
+ # enter payment information. Can be an integer between `5` and `600`, inclusive.
77
+ # The default value is `5`.
78
+ # @param [payment.TokenType] token_type If tokenization of payment source is
79
+ # desired, this represents type of token. Can be: `one-time`, `reusable`. The
80
+ # default value is `reusable`.
81
+ # @param [String] valid_card_types List of card types accepted with each card
82
+ # types separated by space. Can be:
83
+ # `visa`,`nmastercard`,`amex`,`maestro`,`discover`,`optima`,`jcb`,`diners-club`,`enroute`. The default value is `visa mastercard amex`.
84
+ # @return [PaymentInstance] Newly created PaymentInstance
85
+ def create(idempotency_key: nil, status_callback: nil, bank_account_type: :unset, charge_amount: :unset, currency: :unset, description: :unset, input: :unset, min_postal_code_length: :unset, parameter: :unset, payment_connector: :unset, payment_method: :unset, postal_code: :unset, security_code: :unset, timeout: :unset, token_type: :unset, valid_card_types: :unset)
86
+ data = Twilio::Values.of({
87
+ 'IdempotencyKey' => idempotency_key,
88
+ 'StatusCallback' => status_callback,
89
+ 'BankAccountType' => bank_account_type,
90
+ 'ChargeAmount' => charge_amount,
91
+ 'Currency' => currency,
92
+ 'Description' => description,
93
+ 'Input' => input,
94
+ 'MinPostalCodeLength' => min_postal_code_length,
95
+ 'Parameter' => Twilio.serialize_object(parameter),
96
+ 'PaymentConnector' => payment_connector,
97
+ 'PaymentMethod' => payment_method,
98
+ 'PostalCode' => postal_code,
99
+ 'SecurityCode' => security_code,
100
+ 'Timeout' => timeout,
101
+ 'TokenType' => token_type,
102
+ 'ValidCardTypes' => valid_card_types,
103
+ })
104
+
105
+ payload = @version.create(
106
+ 'POST',
107
+ @uri,
108
+ data: data
109
+ )
110
+
111
+ PaymentInstance.new(
112
+ @version,
113
+ payload,
114
+ account_sid: @solution[:account_sid],
115
+ call_sid: @solution[:call_sid],
116
+ )
117
+ end
118
+
119
+ ##
120
+ # Provide a user friendly representation
121
+ def to_s
122
+ '#<Twilio.Api.V2010.PaymentList>'
123
+ end
124
+ end
125
+
126
+ ##
127
+ # 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.
128
+ class PaymentPage < Page
129
+ ##
130
+ # Initialize the PaymentPage
131
+ # @param [Version] version Version that contains the resource
132
+ # @param [Response] response Response from the API
133
+ # @param [Hash] solution Path solution for the resource
134
+ # @return [PaymentPage] PaymentPage
135
+ def initialize(version, response, solution)
136
+ super(version, response)
137
+
138
+ # Path Solution
139
+ @solution = solution
140
+ end
141
+
142
+ ##
143
+ # Build an instance of PaymentInstance
144
+ # @param [Hash] payload Payload response from the API
145
+ # @return [PaymentInstance] PaymentInstance
146
+ def get_instance(payload)
147
+ PaymentInstance.new(
148
+ @version,
149
+ payload,
150
+ account_sid: @solution[:account_sid],
151
+ call_sid: @solution[:call_sid],
152
+ )
153
+ end
154
+
155
+ ##
156
+ # Provide a user friendly representation
157
+ def to_s
158
+ '<Twilio.Api.V2010.PaymentPage>'
159
+ end
160
+ end
161
+
162
+ ##
163
+ # 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.
164
+ class PaymentContext < InstanceContext
165
+ ##
166
+ # Initialize the PaymentContext
167
+ # @param [Version] version Version that contains the resource
168
+ # @param [String] account_sid The SID of the
169
+ # [Account](https://www.twilio.com/docs/iam/api/account) that will update the
170
+ # resource.
171
+ # @param [String] call_sid The SID of the call that will update the resource. This
172
+ # should be the same call sid that was used to create payments resource.
173
+ # @param [String] sid The SID of Payments session that needs to be updated.
174
+ # @return [PaymentContext] PaymentContext
175
+ def initialize(version, account_sid, call_sid, sid)
176
+ super(version)
177
+
178
+ # Path Solution
179
+ @solution = {account_sid: account_sid, call_sid: call_sid, sid: sid, }
180
+ @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments/#{@solution[:sid]}.json"
181
+ end
182
+
183
+ ##
184
+ # Update the PaymentInstance
185
+ # @param [String] idempotency_key A unique token for each payment session that
186
+ # should be provided to maintain idempotency of the session.
187
+ # @param [String] status_callback The URL we should call using the
188
+ # `status_callback` to send status information of payment session.
189
+ # @param [payment.Capture] capture Specific payment source information to expect.
190
+ # Can be:
191
+ # `payment-card-number`,`expiration-date`,`security-code`,`postal-code`,`bank-routing-number`,`bank-account-number`.
192
+ # @param [payment.Status] status Instruction to complete or cancel the
193
+ # transaction. Can be: `complete`, `cancel.`
194
+ # @return [PaymentInstance] Updated PaymentInstance
195
+ def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset)
196
+ data = Twilio::Values.of({
197
+ 'IdempotencyKey' => idempotency_key,
198
+ 'StatusCallback' => status_callback,
199
+ 'Capture' => capture,
200
+ 'Status' => status,
201
+ })
202
+
203
+ payload = @version.update(
204
+ 'POST',
205
+ @uri,
206
+ data: data,
207
+ )
208
+
209
+ PaymentInstance.new(
210
+ @version,
211
+ payload,
212
+ account_sid: @solution[:account_sid],
213
+ call_sid: @solution[:call_sid],
214
+ sid: @solution[:sid],
215
+ )
216
+ end
217
+
218
+ ##
219
+ # Provide a user friendly representation
220
+ def to_s
221
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
222
+ "#<Twilio.Api.V2010.PaymentContext #{context}>"
223
+ end
224
+
225
+ ##
226
+ # Provide a detailed, user friendly representation
227
+ def inspect
228
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
229
+ "#<Twilio.Api.V2010.PaymentContext #{context}>"
230
+ end
231
+ end
232
+
233
+ ##
234
+ # 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.
235
+ class PaymentInstance < InstanceResource
236
+ ##
237
+ # Initialize the PaymentInstance
238
+ # @param [Version] version Version that contains the resource
239
+ # @param [Hash] payload payload that contains response from Twilio
240
+ # @param [String] account_sid The SID of the
241
+ # [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments
242
+ # resource.
243
+ # @param [String] call_sid The SID of the
244
+ # [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments
245
+ # resource is associated with. This will refer to the call sid that is producing
246
+ # the payment card (credit/ACH) information thru DTMF.
247
+ # @param [String] sid The SID of Payments session that needs to be updated.
248
+ # @return [PaymentInstance] PaymentInstance
249
+ def initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil)
250
+ super(version)
251
+
252
+ # Marshaled Properties
253
+ @properties = {
254
+ 'account_sid' => payload['account_sid'],
255
+ 'call_sid' => payload['call_sid'],
256
+ 'sid' => payload['sid'],
257
+ 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
258
+ 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
259
+ 'uri' => payload['uri'],
260
+ }
261
+
262
+ # Context
263
+ @instance_context = nil
264
+ @params = {'account_sid' => account_sid, 'call_sid' => call_sid, 'sid' => sid || @properties['sid'], }
265
+ end
266
+
267
+ ##
268
+ # Generate an instance context for the instance, the context is capable of
269
+ # performing various actions. All instance actions are proxied to the context
270
+ # @return [PaymentContext] PaymentContext for this PaymentInstance
271
+ def context
272
+ unless @instance_context
273
+ @instance_context = PaymentContext.new(
274
+ @version,
275
+ @params['account_sid'],
276
+ @params['call_sid'],
277
+ @params['sid'],
278
+ )
279
+ end
280
+ @instance_context
281
+ end
282
+
283
+ ##
284
+ # @return [String] The SID of the Account that created the Payments resource.
285
+ def account_sid
286
+ @properties['account_sid']
287
+ end
288
+
289
+ ##
290
+ # @return [String] The SID of the Call the resource is associated with.
291
+ def call_sid
292
+ @properties['call_sid']
293
+ end
294
+
295
+ ##
296
+ # @return [String] The SID of the Payments resource.
297
+ def sid
298
+ @properties['sid']
299
+ end
300
+
301
+ ##
302
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was created
303
+ def date_created
304
+ @properties['date_created']
305
+ end
306
+
307
+ ##
308
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was last updated
309
+ def date_updated
310
+ @properties['date_updated']
311
+ end
312
+
313
+ ##
314
+ # @return [String] The URI of the resource, relative to `https://api.twilio.com`
315
+ def uri
316
+ @properties['uri']
317
+ end
318
+
319
+ ##
320
+ # Update the PaymentInstance
321
+ # @param [String] idempotency_key A unique token for each payment session that
322
+ # should be provided to maintain idempotency of the session.
323
+ # @param [String] status_callback The URL we should call using the
324
+ # `status_callback` to send status information of payment session.
325
+ # @param [payment.Capture] capture Specific payment source information to expect.
326
+ # Can be:
327
+ # `payment-card-number`,`expiration-date`,`security-code`,`postal-code`,`bank-routing-number`,`bank-account-number`.
328
+ # @param [payment.Status] status Instruction to complete or cancel the
329
+ # transaction. Can be: `complete`, `cancel.`
330
+ # @return [PaymentInstance] Updated PaymentInstance
331
+ def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset)
332
+ context.update(
333
+ idempotency_key: idempotency_key,
334
+ status_callback: status_callback,
335
+ capture: capture,
336
+ status: status,
337
+ )
338
+ end
339
+
340
+ ##
341
+ # Provide a user friendly representation
342
+ def to_s
343
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
344
+ "<Twilio.Api.V2010.PaymentInstance #{values}>"
345
+ end
346
+
347
+ ##
348
+ # Provide a detailed, user friendly representation
349
+ def inspect
350
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
351
+ "<Twilio.Api.V2010.PaymentInstance #{values}>"
352
+ end
353
+ end
354
+ end
355
+ end
356
+ end
357
+ end
358
+ end
359
+ end