vonage 7.20.0 → 8.0.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +87 -386
  3. data/lib/vonage/applications.rb +4 -12
  4. data/lib/vonage/client.rb +0 -42
  5. data/lib/vonage/client_error.rb +1 -1
  6. data/lib/vonage/config.rb +1 -9
  7. data/lib/vonage/errors.rb +20 -37
  8. data/lib/vonage/gsm7.rb +1 -1
  9. data/lib/vonage/jwt.rb +0 -17
  10. data/lib/vonage/keys.rb +0 -2
  11. data/lib/vonage/logger.rb +3 -5
  12. data/lib/vonage/messaging/channels/viber.rb +1 -8
  13. data/lib/vonage/messaging/channels/whats_app.rb +1 -3
  14. data/lib/vonage/messaging.rb +0 -11
  15. data/lib/vonage/namespace.rb +57 -128
  16. data/lib/vonage/numbers.rb +6 -29
  17. data/lib/vonage/server_error.rb +1 -1
  18. data/lib/vonage/signature.rb +5 -5
  19. data/lib/vonage/sms.rb +20 -20
  20. data/lib/vonage/version.rb +1 -1
  21. data/lib/vonage/video/archives.rb +53 -18
  22. data/lib/vonage/video/list_response.rb +11 -0
  23. data/lib/vonage/video/moderation.rb +22 -7
  24. data/lib/vonage/video/signals.rb +9 -4
  25. data/lib/vonage/video/streams.rb +12 -6
  26. data/lib/vonage/video.rb +13 -31
  27. data/lib/vonage/voice/actions/connect.rb +3 -27
  28. data/lib/vonage/voice/actions/conversation.rb +2 -2
  29. data/lib/vonage/voice/actions/pay.rb +107 -0
  30. data/lib/vonage/voice/actions/talk.rb +2 -11
  31. data/lib/vonage/voice/talk.rb +1 -11
  32. data/lib/vonage/voice.rb +0 -22
  33. data/lib/vonage.rb +0 -2
  34. data/vonage.gemspec +1 -2
  35. metadata +9 -65
  36. data/lib/vonage/api_error.rb +0 -33
  37. data/lib/vonage/meetings/applications.rb +0 -25
  38. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  39. data/lib/vonage/meetings/dial_in_numbers.rb +0 -23
  40. data/lib/vonage/meetings/recordings.rb +0 -36
  41. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  42. data/lib/vonage/meetings/rooms.rb +0 -155
  43. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  44. data/lib/vonage/meetings/sessions.rb +0 -28
  45. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  46. data/lib/vonage/meetings/themes.rb +0 -218
  47. data/lib/vonage/meetings.rb +0 -38
  48. data/lib/vonage/number_insight_2.rb +0 -36
  49. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  50. data/lib/vonage/proactive_connect/events.rb +0 -68
  51. data/lib/vonage/proactive_connect/item.rb +0 -104
  52. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  53. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  54. data/lib/vonage/proactive_connect/items.rb +0 -107
  55. data/lib/vonage/proactive_connect/list.rb +0 -168
  56. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  57. data/lib/vonage/proactive_connect/lists.rb +0 -35
  58. data/lib/vonage/proactive_connect.rb +0 -33
  59. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  60. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  61. data/lib/vonage/subaccounts/list_response.rb +0 -15
  62. data/lib/vonage/subaccounts.rb +0 -203
  63. data/lib/vonage/users/list_response.rb +0 -11
  64. data/lib/vonage/users.rb +0 -156
  65. data/lib/vonage/verify2/channels/email.rb +0 -36
  66. data/lib/vonage/verify2/channels/silent_auth.rb +0 -45
  67. data/lib/vonage/verify2/channels/sms.rb +0 -53
  68. data/lib/vonage/verify2/channels/voice.rb +0 -32
  69. data/lib/vonage/verify2/channels/whats_app.rb +0 -38
  70. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  71. data/lib/vonage/verify2/start_verification_options.rb +0 -62
  72. data/lib/vonage/verify2/workflow.rb +0 -39
  73. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  74. data/lib/vonage/verify2.rb +0 -93
  75. data/lib/vonage/video/archives/list_response.rb +0 -11
  76. data/lib/vonage/video/broadcasts/list_response.rb +0 -11
  77. data/lib/vonage/video/broadcasts.rb +0 -75
  78. data/lib/vonage/video/sip.rb +0 -48
  79. data/lib/vonage/video/streams/list_response.rb +0 -11
@@ -1,32 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::ProactiveConnect::Items::FileResponse < Vonage::Response
4
- DEFAULT_FILENAME = 'vonage-proactive-connect-list-items.csv'
5
-
6
- attr_accessor :filename
7
-
8
- def initialize(entity=nil, http_response=nil)
9
- super
10
- self.filename = initial_filename
11
- end
12
-
13
- def save(filepath:)
14
- pn = Pathname.new(filepath)
15
- raise ArgumentError, ':filepath not a directory' unless pn.directory?
16
- raise ArgumentError, ':filepath not absolute' unless pn.absolute?
17
- raise ArgumentError, ':filepath not writable' unless pn.writable?
18
-
19
- File.open("#{pn.cleanpath}/#{filename}", 'w') {|f| f.write(http_response.body) }
20
- end
21
-
22
- def data
23
- http_response ? http_response.body : nil
24
- end
25
-
26
- private
27
-
28
- def initial_filename
29
- match_data = http_response['Content-Disposition'].match(/filename=(\"?)(.+)\1/)
30
- match_data ? match_data[2] : DEFAULT_FILENAME
31
- end
32
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::ProactiveConnect::Items::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def each
7
- return enum_for(:each) unless block_given?
8
-
9
- @entity._embedded.items.each { |item| yield item }
10
- end
11
- end
@@ -1,107 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class ProactiveConnect::Items < Namespace
6
- extend T::Sig
7
-
8
- self.authentication = BearerToken
9
-
10
- self.host = :vonage_host
11
-
12
- # Find all list items
13
- #
14
- # @example
15
- # response = proactive_connect.items.list(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
16
- #
17
- # @param [required, String] :list_id
18
- # Unique identifier for the list
19
- #
20
- # @param [optional, String] :page
21
- # Page of results to jump to
22
- #
23
- # @param [optional, String] :page_size
24
- # Number of results per page
25
- #
26
- # @param [optional, String] order
27
- # Sort in either ascending (asc, the default) or descending (desc) order
28
- #
29
- # @see https://developer.vonage.com/en/api/proactive-connect#itemsFindAll
30
- #
31
- def list(list_id:, **params)
32
- path = "/v0.1/bulk/lists/#{list_id}/items"
33
- path += "?#{Params.encode(params)}" unless params.empty?
34
-
35
- request(path, response_class: ListResponse)
36
- end
37
-
38
- # Download list items as a CSV file format
39
- #
40
- # @example
41
- # response = proactive_connect.items.download_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
42
- #
43
- # @param [required, String] :list_id
44
- # ID for the list to download
45
- #
46
- # @param [optional, String] order
47
- # Sort in either ascending (asc, the default) or descending (desc) order
48
- #
49
- # @param [optional, String] :filename
50
- # A name to set for the returned File object. If not set, the File object will use the actual filename (if available)
51
- # or a default of `download.csv` if the actual filename is not available.
52
- #
53
- # @param [optional, String] :filepath
54
- # A filepath to a directory where the file should be written.
55
- # If not set, the file is not written, though the the file can be written at any time by calling `save` on the returned
56
- # object and passing in `:filepath` as an argument to the `save` method, for example:
57
- # response = proactive_connect.items.download_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
58
- # response.save('/files/downloads/')
59
- # If set, the filepath must be:
60
- # - An absolute path
61
- # - For a valid directory
62
- # - The directory must be writable
63
- #
64
- # @see https://developer.vonage.com/en/api/proactive-connect#itemsDownload
65
- #
66
- def download_csv(list_id:, order: 'asc', **params)
67
- response = request("/v0.1/bulk/lists/#{list_id}/items/download?order=#{order}", response_class: FileResponse)
68
-
69
- response.filename = params[:filename] if params[:filename]
70
- response.save(filepath: params[:filepath]) if params[:filepath]
71
-
72
- response
73
- end
74
-
75
- # Import list items from a CSV file
76
- #
77
- # @example
78
- # response = proactive_connect.items.upload_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', filepath: '/files/import.csv')
79
- #
80
- # @param [required, String] :list_id
81
- # ID for the list to download
82
- #
83
- # @param [optional, String] order
84
- # Sort in either ascending (asc, the default) or descending (desc) order
85
- #
86
- # @param [optional, String] :filename
87
- # A name to set for the returned File object. If not set, the File object will use the actual filename (if available)
88
- # or a default of `download.csv` if the actual filename is not available.
89
- #
90
- # @param [required, String] :filepath
91
- # A filepath for the file to import. The file must be:
92
- # - A valid file
93
- # - Readable
94
- # - Must have a `.csv` extension
95
- #
96
- # @see https://developer.vonage.com/en/api/proactive-connect#itemsImport
97
- #
98
- def upload_csv(list_id:, filepath:)
99
- pn = Pathname.new(filepath)
100
- raise ArgumentError, ':filepath not for a file' unless pn.file?
101
- raise ArgumentError, 'file at :filepath not readable' unless pn.readable?
102
- raise ArgumentError, 'file at :filepath not csv' unless pn.extname == '.csv'
103
-
104
- multipart_post_request("/v0.1/bulk/lists/#{list_id}/items/import", filepath: filepath, file_name: pn.basename, mime_type: 'text/csv')
105
- end
106
- end
107
- end
@@ -1,168 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class ProactiveConnect::List < Namespace
6
- extend T::Sig
7
-
8
- self.authentication = BearerToken
9
-
10
- self.host = :vonage_host
11
-
12
- self.request_body = JSON
13
-
14
- # Create list
15
- #
16
- # @example
17
- # response = proactive_connect.list.create(name: 'List Number 1')
18
- #
19
- # @param [required, String] :name
20
- # A name for the list
21
- #
22
- # @param [optional, String] :description
23
- # A description of the list
24
- #
25
- # @param [optional, Array] :tags
26
- # An Array of up to 10 Strings assigining tags to the list. Each String must be between 1 and 15 characters
27
- #
28
- # @param [optional, Array] :attributes
29
- # Array of Hash objects. Each Hash represents an attribute for the list.
30
- #
31
- # @option attributes [required, String] :name
32
- # The name of the attribute
33
- #
34
- # @option attributes [optional, String] :alias
35
- # Alternative name to use for this attribute.
36
- # Use when you wish to correlate between 2 or more list that are using different attribute names for the same semantic data
37
- #
38
- # @option attributes [optional, Boolean] :key
39
- # Set to `true` if this attribute should be used to correlate between 2 or more lists. Default is `false`
40
- #
41
- # @param [optional, Hash] :datasource
42
- # Datasource for the list
43
- #
44
- # @option datasource [required, String] :type
45
- # Must be set to `manual`, which is the default
46
- #
47
- # @see https://developer.vonage.com/en/api/proactive-connect#listsCreate
48
- #
49
- def create(name:, **params)
50
- request(
51
- "/v0.1/bulk/lists",
52
- params: params.merge({ name: name }),
53
- type: Post
54
- )
55
- end
56
-
57
- # Get list by id
58
- #
59
- # @example
60
- # response = proactive_connect.list.find(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
61
- #
62
- # @param [required, String] :id
63
- # Unique identifier for the list
64
- #
65
- # @see https://developer.vonage.com/en/api/proactive-connect#listsGet
66
- #
67
- def find(id:)
68
- request("/v0.1/bulk/lists/#{id}")
69
- end
70
-
71
- # Update list
72
- #
73
- # @example
74
- # response = proactive_connect.list.update(name: 'List Number 1')
75
- #
76
- # @param [required, String] :id
77
- # The id of the list to update
78
- #
79
- # @param [required, String] :name
80
- # The name of the list
81
- #
82
- # @param [optional, String] :description
83
- # A description of the list
84
- #
85
- # @param [optional, Array] :tags
86
- # An Array of up to 10 Strings assigining tags to the list. Each String must be between 1 and 15 characters
87
- #
88
- # @param [optional, Array] :attributes
89
- # Array of Hash objects. Each Hash represents an attribute for the list.
90
- #
91
- # @option attributes [required, String] :name
92
- # The name of the attribute
93
- #
94
- # @option attributes [optional, String] :alias
95
- # Alternative name to use for this attribute.
96
- # Use when you wish to correlate between 2 or more list that are using different attribute names for the same semantic data
97
- #
98
- # @option attributes [optional, Boolean] :key
99
- # Set to `true` if this attribute should be used to correlate between 2 or more lists. Default is `false`
100
- #
101
- # @param [optional, Hash] :datasource
102
- # Datasource for the list
103
- #
104
- # @option datasource [required, String] :type
105
- # Must be set to `manual`, which is the default
106
- #
107
- # @see https://developer.vonage.com/en/api/proactive-connect#listsUpdate
108
- #
109
- def update(id:, name:, **params)
110
- request(
111
- "/v0.1/bulk/lists/#{id}",
112
- params: params.merge({ name: name }),
113
- type: Put
114
- )
115
- end
116
-
117
- # Delete a list by id
118
- #
119
- # @example
120
- # response = proactive_connect.list.delete(id: '74ea1ecf-06c9-4072-a285-61677bd353e8')
121
- #
122
- # @param [required, String] :id
123
- # Unique identifier for the list
124
- #
125
- # @see https://developer.vonage.com/en/api/proactive-connect#listsDelete
126
- #
127
- def delete(id:)
128
- request(
129
- "/v0.1/bulk/lists/#{id}",
130
- type: Delete
131
- )
132
- end
133
-
134
- # Clear list by deleting all items
135
- #
136
- # @example
137
- # response = proactive_connect.list.clear_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
138
- #
139
- # @param [required, String] :id
140
- # Unique identifier for the list
141
- #
142
- # @see https://developer.vonage.com/en/api/proactive-connect#listsClear
143
- #
144
- def clear_items(id:)
145
- request(
146
- "/v0.1/bulk/lists/#{id}/clear",
147
- type: Post
148
- )
149
- end
150
-
151
- # Fetch and replace all items from datasource
152
- #
153
- # @example
154
- # response = proactive_connect.list.fetch_and_replace_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
155
- #
156
- # @param [required, String] :id
157
- # Unique identifier for the list
158
- #
159
- # @see https://developer.vonage.com/en/api/proactive-connect#listsFetch
160
- #
161
- def fetch_and_replace_items(id:)
162
- request(
163
- "/v0.1/bulk/lists/#{id}/fetch",
164
- type: Post
165
- )
166
- end
167
- end
168
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::ProactiveConnect::Lists::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def each
7
- return enum_for(:each) unless block_given?
8
-
9
- @entity._embedded.lists.each { |item| yield item }
10
- end
11
- end
@@ -1,35 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class ProactiveConnect::Lists < Namespace
6
- extend T::Sig
7
-
8
- self.authentication = BearerToken
9
-
10
- self.host = :vonage_host
11
-
12
- # Find all lists
13
- #
14
- # @example
15
- # response = proactive_connect.lists.list
16
- #
17
- # @param [optional, String] :page
18
- # Page of results to jump to
19
- #
20
- # @param [optional, String] :page_size
21
- # Number of results per page
22
- #
23
- # @param [optional, String] order
24
- # Sort in either ascending (asc, the default) or descending (desc) order
25
- #
26
- # @see https://developer.vonage.com/en/api/proactive-connect#listsFindAll
27
- #
28
- def list(**params)
29
- path = "/v0.1/bulk/lists"
30
- path += "?#{Params.encode(params)}" unless params.empty?
31
-
32
- request(path, response_class: ListResponse)
33
- end
34
- end
35
- end
@@ -1,33 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class ProactiveConnect < Namespace
6
- extend T::Sig
7
-
8
- sig { returns(T.nilable(Vonage::ProactiveConnect::Lists)) }
9
- def lists
10
- @lists ||= Lists.new(@config)
11
- end
12
-
13
- sig { returns(T.nilable(Vonage::ProactiveConnect::List)) }
14
- def list
15
- @list ||= List.new(@config)
16
- end
17
-
18
- sig { returns(T.nilable(Vonage::ProactiveConnect::Items)) }
19
- def items
20
- @items ||= Items.new(@config)
21
- end
22
-
23
- sig { returns(T.nilable(Vonage::ProactiveConnect::Item)) }
24
- def item
25
- @item ||= Item.new(@config)
26
- end
27
-
28
- sig { returns(T.nilable(Vonage::ProactiveConnect::Events)) }
29
- def events
30
- @events ||= Events.new(@config)
31
- end
32
- end
33
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::Subaccounts::BalanceTransfers::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def each
7
- return enum_for(:each) unless block_given?
8
-
9
- @entity._embedded.balance_transfers.each { |item| yield item }
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::Subaccounts::CreditTransfers::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def each
7
- return enum_for(:each) unless block_given?
8
-
9
- @entity._embedded.credit_transfers.each { |item| yield item }
10
- end
11
- end
@@ -1,15 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::Subaccounts::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def primary_account
7
- @entity._embedded.primary_account
8
- end
9
-
10
- def each
11
- return enum_for(:each) unless block_given?
12
-
13
- @entity._embedded.subaccounts.each { |item| yield item }
14
- end
15
- end
@@ -1,203 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class Subaccounts < Namespace
6
- self.authentication = Basic
7
-
8
- self.request_body = JSON
9
-
10
- # Retrieve list of subaccounts.
11
- #
12
- # @example
13
- # response = client.subaccounts.list
14
- #
15
- # @see https://developer.vonage.com/en/api/subaccounts#retrieveSubaccountsList
16
- #
17
- def list
18
- request("/accounts/#{@config.api_key}/subaccounts", response_class: ListResponse)
19
- end
20
-
21
- # Retrieve a subaccount.
22
- #
23
- # @example
24
- # response = client.subaccounts.find(subaccount_key: 'abc123')
25
- #
26
- # @option params [required, String] :subaccount_key
27
- # The API key for the subaccount you want to retrieve
28
- #
29
- # @see https://developer.vonage.com/en/api/subaccounts#retrieveSubaccount
30
- #
31
- def find(subaccount_key:)
32
- request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}")
33
- end
34
-
35
- # Create a subaccount.
36
- #
37
- # @example
38
- # response = client.subaccounts.create(name: 'Foo')
39
- #
40
- # @option params [required, String] :name
41
- # The name of the subaccount
42
- #
43
- # @option params [optional, String] :secret
44
- # An account secret for use by the subaccount. Can be used in combination with your API key to authenticate your API requests.
45
- # Requirements:
46
- # - 8 characters and no more than 25
47
- # - 1 lower-case letter
48
- # - 1 capital letter
49
- # - 1 digit
50
- # - must be unique
51
- #
52
- # @option params [optional, Boolean] :use_primary_account_balance
53
- # Whether the subaccount uses the primary account balance (true, the default) or has its own balance (false).
54
- # Once set to `false` cannot be changed back to `true`
55
- #
56
- # @see https://developer.vonage.com/en/api/subaccounts#createSubAccount
57
- #
58
- def create(name:, **params)
59
- request("/accounts/#{@config.api_key}/subaccounts", params: params.merge(name: name), type: Post)
60
- end
61
-
62
- # Modify a subaccount.
63
- #
64
- # @example
65
- # response = client.subaccounts.update(name: 'Bar')
66
- #
67
- # @option params [required, String] :subaccount_key
68
- # The API key for the subaccount you want to modify
69
- #
70
- # @option params [optional, String] :name
71
- # The name of the subaccount
72
- #
73
- # @option params [optional, Boolean] :use_primary_account_balance
74
- # Whether the subaccount uses the primary account balance (true, the default) or has its own balance (false).
75
- # Once set to `false` cannot be changed back to `true`
76
- #
77
- # @option params [optional, String] :suspended
78
- # Whether the subaccount is suspended (true) or not (false, the default)
79
- #
80
- # @see https://developer.vonage.com/en/api/subaccounts#modifySubaccount
81
- #
82
- def update(subaccount_key:, **params)
83
- request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}", params: params, type: Patch)
84
- end
85
-
86
- # Retrieve list of credit transfers.
87
- #
88
- # @example
89
- # response = client.subaccounts.list_credit_transfers(start_date: "2023-06-15T15:53:50Z")
90
- #
91
- # @option params [optional, String] :start_date
92
- # The ISO format datetime from which to list transfers. Example: 2019-03-02T16:34:49Z.
93
- # Defaults to "1970-01-01T00:00:00Z" if omitted
94
- #
95
- # @option params [optional, String] :end_date
96
- # The ISO format datetime to which to list transfers. Example: 2019-03-02T16:34:49Z.
97
- # If absent then all transfers until now is returned.
98
- #
99
- # @option params [optional, String] :subaccount
100
- # Subaccount to filter by.
101
- #
102
- # @see https://developer.vonage.com/en/api/subaccounts#retrieveCreditTransfers
103
- #
104
- def list_credit_transfers(start_date: "1970-01-01T00:00:00Z", **params)
105
- path = "/accounts/#{@config.api_key}/credit-transfers?#{Params.encode(params.merge(start_date: start_date))}"
106
-
107
- request(path, response_class: CreditTransfers::ListResponse)
108
- end
109
-
110
- # Transfer credit.
111
- #
112
- # @example
113
- # response = client.subaccounts.transfer_credit(from: 'abc123', to: 'def456', amount: 10.00)
114
- #
115
- # @option params [required, String] :from
116
- # The API key of the account or subaccount to transfer credit from.
117
- #
118
- # @option params [required, String] :to
119
- # The API key of the account or subaccount to transfer credit to.
120
- #
121
- # @option params [required, Number] :amount
122
- # The amount to transfer
123
- #
124
- # @option params [optional, String] :reference
125
- # A reference for the transfer.
126
- #
127
- # @see https://developer.vonage.com/en/api/subaccounts#transferCredit
128
- #
129
- def transfer_credit(from:, to:, amount:, **params)
130
- request("/accounts/#{@config.api_key}/credit-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post)
131
- end
132
-
133
- # Retrieve list of balance transfers.
134
- #
135
- # @example
136
- # response = client.subaccounts.list_balance_transfers(start_date: "2023-06-15T15:53:50Z")
137
- #
138
- # @option params [optional, String] :start_date
139
- # The ISO format datetime from which to list transfers. Example: 2019-03-02T16:34:49Z.
140
- # Defaults to "1970-01-01T00:00:00Z" if omitted
141
- #
142
- # @option params [optional, String] :end_date
143
- # The ISO format datetime to which to list transfers. Example: 2019-03-02T16:34:49Z.
144
- # If absent then all transfers until now is returned.
145
- #
146
- # @option params [optional, String] :subaccount
147
- # Subaccount to filter by.
148
- #
149
- # @see https://developer.vonage.com/en/api/subaccounts#retrieveBalanceTransfers
150
- #
151
- def list_balance_transfers(start_date: "1970-01-01T00:00:00Z", **params)
152
- path = "/accounts/#{@config.api_key}/balance-transfers?#{Params.encode(params.merge(start_date: start_date))}"
153
-
154
- request(path, response_class: BalanceTransfers::ListResponse)
155
- end
156
-
157
- # Transfer balance.
158
- #
159
- # @example
160
- # response = client.subaccounts.transfer_balance(from: 'abc123', to: 'def456', amount: 10.00)
161
- #
162
- # @option params [required, String] :from
163
- # The API key of the account or subaccount to transfer balance from.
164
- #
165
- # @option params [required, String] :to
166
- # The API key of the account or subaccount to transfer balance to.
167
- #
168
- # @option params [required, Number] :amount
169
- # The amount to transfer
170
- #
171
- # @option params [optional, String] :reference
172
- # A reference for the transfer.
173
- #
174
- # @see https://developer.vonage.com/en/api/subaccounts#transferBalance
175
- #
176
- def transfer_balance(from:, to:, amount:, **params)
177
- request("/accounts/#{@config.api_key}/balance-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post)
178
- end
179
-
180
- # Transfer number.
181
- #
182
- # @example
183
- # response = client.subaccounts.transfer_number(from: 'abc123', to: 'def456', number: 447900000000, country: 'GB')
184
- #
185
- # @option params [required, String] :from
186
- # The API key of the account or subaccount to transfer the number from.
187
- #
188
- # @option params [required, String] :to
189
- # The API key of the account or subaccount to transfer the number to.
190
- #
191
- # @option params [required, Number] :number
192
- # The number to transfer
193
- #
194
- # @option params [required, String] :country
195
- # An ISO-3166-1 alpha 2 code representing the country for the number, e.g. GB.
196
- #
197
- # @see https://developer.vonage.com/en/api/subaccounts#transferNumber
198
- #
199
- def transfer_number(from:, to:, number:, country:)
200
- request("/accounts/#{@config.api_key}/transfer-number", params: {from: from, to: to, number: number, country: country}, type: Post)
201
- end
202
- end
203
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::Users::ListResponse < Vonage::Response
4
- include Enumerable
5
-
6
- def each
7
- return enum_for(:each) unless block_given?
8
-
9
- @entity._embedded.users.each { |item| yield item }
10
- end
11
- end