plivo 4.29.0 → 4.30.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec364fb43089ee282e74b34a0583506cf779b969
4
- data.tar.gz: 35c6813354cbc974ebe0643b00c74d1032c7b8cd
3
+ metadata.gz: df70128a07a0430abad9476ef3c28a3930d0dc99
4
+ data.tar.gz: 84b5800642445b7c44959917d3e42f69329f0223
5
5
  SHA512:
6
- metadata.gz: 72145e3123568e80e427b3335877943bb75ffac9afb88d16f222c9e5622e8876d9342697c749b1c04e912d2c92b35063ef82cdc89ef3ca78b7fc71542d903354
7
- data.tar.gz: 6f52fa44fc0f450b0f0aeee39a076bb0bf7c4021575d41cf4d23f861bd9270044c37974518d862403921fbee13238254c037f11de7b99aa2cf91115425b7b8e3
6
+ metadata.gz: fa6f07a105ca3ef10f022ceda259119c13fde1673bc5e8e8229240cb86f82cd5c343c89c311d59554562049be034091c8c0325ddffee812e65877b07a9e28a7f
7
+ data.tar.gz: e6b8a56daa10be1973c9487083a77bd99cbaf8a5e227ac7e19ce794b0b53057c3797923f23795e2d891c6da424e8d1b4b9ddcc2c24931313042a42507e2002e9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.30.1](https://github.com/plivo/plivo-go/tree/v4.30.1) (2022-09-20)
4
+ **stability - faraday upgrade**
5
+ - faraday version upgrade
6
+
7
+ ## [4.30.0](https://github.com/plivo/plivo-go/tree/v4.30.0) (2022-08-26)
8
+ **Feature - 10DLC APIs**
9
+ - Added new 10DLC APIs
10
+
3
11
  ## [4.29.0](https://github.com/plivo/plivo-go/tree/v4.29.0) (2022-08-01)
4
12
  **Feature - Token Creation**
5
13
  - `JWT Token Creation API` added functionality to create a new JWT token.
data/README.md CHANGED
@@ -9,7 +9,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'plivo', '>= 4.29.0'
12
+ gem 'plivo', '>= 4.30.1'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -54,7 +54,7 @@ module Plivo
54
54
 
55
55
  def perform_create(params, use_multipart_conn=false)
56
56
  Response.new(
57
- @_client.send_request(@_resource_uri, 'POST', params, nil, use_multipart_conn, is_voice_request: @_is_voice_request),
57
+ @_client.send_request(@_resource_uri, 'POST', params, 10, use_multipart_conn, is_voice_request: @_is_voice_request),
58
58
  @_identifier_string
59
59
  )
60
60
  end
@@ -98,6 +98,14 @@ module Plivo
98
98
  self
99
99
  end
100
100
 
101
+ def perform_action_with_identifier(identifier = nil, method = 'GET', params = nil)
102
+ resource_path = identifier ? @_resource_uri + identifier + '/' : @_resource_uri
103
+ Response.new(
104
+ @_client.send_request(resource_path, method, params, nil, false, is_voice_request: @_is_voice_request),
105
+ @_identifier_string
106
+ )
107
+ end
108
+
101
109
  def perform_list_without_object(params = nil)
102
110
  response_json = @_client.send_request(@_resource_uri, 'GET', params, nil, false, is_voice_request: @_is_voice_request)
103
111
  parse_and_set(response_json)
@@ -137,7 +137,7 @@ module Plivo
137
137
  # DANGER: Basic auth should always come after headers, else
138
138
  # The headers will replace the basic_auth
139
139
 
140
- faraday.basic_auth(auth_id, auth_token)
140
+ faraday.request(:basic_auth, auth_id, auth_token)
141
141
 
142
142
  faraday.proxy=@proxy_hash if @proxy_hash
143
143
  faraday.response :json, content_type: /\bjson$/
@@ -150,7 +150,7 @@ module Plivo
150
150
  # DANGER: Basic auth should always come after headers, else
151
151
  # The headers will replace the basic_auth
152
152
 
153
- faraday.basic_auth(auth_id, auth_token)
153
+ faraday.request(:basic_auth, auth_id, auth_token)
154
154
 
155
155
  faraday.proxy=@proxy_hash if @proxy_hash
156
156
  faraday.response :json, content_type: /\bjson$/
@@ -163,7 +163,7 @@ module Plivo
163
163
  # DANGER: Basic auth should always come after headers, else
164
164
  # The headers will replace the basic_auth
165
165
 
166
- faraday.basic_auth(auth_id, auth_token)
166
+ faraday.request(:basic_auth, auth_id, auth_token)
167
167
 
168
168
  faraday.proxy=@proxy_hash if @proxy_hash
169
169
  faraday.response :json, content_type: /\bjson$/
@@ -176,7 +176,7 @@ module Plivo
176
176
  # DANGER: Basic auth should always come after headers, else
177
177
  # The headers will replace the basic_auth
178
178
 
179
- faraday.basic_auth(auth_id, auth_token)
179
+ faraday.request(:basic_auth, auth_id, auth_token)
180
180
 
181
181
  faraday.proxy=@proxy_hash if @proxy_hash
182
182
  faraday.response :json, content_type: /\bjson$/
@@ -189,7 +189,7 @@ module Plivo
189
189
  # DANGER: Basic auth should always come after headers, else
190
190
  # The headers will replace the basic_auth
191
191
 
192
- faraday.basic_auth(auth_id, auth_token)
192
+ faraday.request(:basic_auth, auth_id, auth_token)
193
193
 
194
194
  faraday.proxy=@proxy_hash if @proxy_hash
195
195
  faraday.response :json, content_type: /\bjson$/
@@ -202,7 +202,7 @@ module Plivo
202
202
  # DANGER: Basic auth should always come after headers, else
203
203
  # The headers will replace the basic_auth
204
204
 
205
- faraday.basic_auth(auth_id, auth_token)
205
+ faraday.request(:basic_auth, auth_id, auth_token)
206
206
 
207
207
  faraday.proxy=@proxy_hash if @proxy_hash
208
208
  faraday.response :json, content_type: /\bjson$/
@@ -255,7 +255,7 @@ module Plivo
255
255
 
256
256
  faraday.request :multipart
257
257
  faraday.request :url_encoded
258
- faraday.basic_auth(auth_id, auth_token)
258
+ faraday.request(:basic_auth, auth_id, auth_token)
259
259
 
260
260
  faraday.proxy=@proxy_hash if @proxy_hash
261
261
  faraday.response :json, content_type: /\bjson$/
@@ -38,24 +38,43 @@ module Plivo
38
38
  # @param [Hash] options
39
39
  # @option options [String] :type
40
40
  # @option options [Status] :status
41
+ # @option options [Status] :limit
42
+ # @option options [Status] :offset
41
43
  # @return [Hash]
42
44
  def list(options=nil)
43
45
  return perform_list_without_object if options.nil?
44
46
 
45
47
  params = {}
46
- %i[status type].each do |param|
48
+ %i[status type limit offset].each do |param|
47
49
  if options.key?(param) && valid_param?(param, options[param],
48
- [String], true)
50
+ [String, Integer], true)
49
51
  params[param] = options[param]
50
52
  end
51
- end
53
+ end
54
+ if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
55
+ raise_invalid_request('The maximum number of results that can be '\
56
+ "fetched is 20. limit can't be more than 20 or less than 1")
57
+ end
58
+ if options.key?(:offset) && options[:offset] < 0
59
+ raise_invalid_request("Offset can't be negative")
60
+ end
52
61
  perform_list_without_object(params)
53
62
  end
54
63
 
55
64
  ##
56
65
  # Create a new brand
57
- def create(params)
58
- perform_create(params)
66
+ def create(options=nil)
67
+ valid_param?(:options, options, Hash, true)
68
+ if not options[:brand_alias]
69
+ raise_invalid_request("brand_alias must be provided")
70
+ end
71
+ if not options[:brand_type]
72
+ raise_invalid_request("brand_type must be provided")
73
+ end
74
+ if not options[:profile_uuid]
75
+ raise_invalid_request("profile_uuid must be provided")
76
+ end
77
+ perform_create(options)
59
78
  end
60
79
  end
61
80
  end
@@ -38,25 +38,90 @@ module Plivo
38
38
  # @param [Hash] options
39
39
  # @option options [String] :brand
40
40
  # @option options [Status] :usecase
41
+ # @option options [Status] :limit
42
+ # @option options [Status] :offset
41
43
  # @return [Hash]
42
44
  def list(options=nil)
43
45
  return perform_list_without_object if options.nil?
44
46
 
45
47
  params = {}
46
- %i[usecase brand].each do |param|
48
+ %i[usecase brand limit offset].each do |param|
47
49
  if options.key?(param) && valid_param?(param, options[param],
48
- [String], true)
50
+ [String, Integer], true)
49
51
  params[param] = options[param]
50
52
  end
53
+ end
54
+ if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
55
+ raise_invalid_request('The maximum number of results that can be '\
56
+ "fetched is 20. limit can't be more than 20 or less than 1")
57
+ end
58
+ if options.key?(:offset) && options[:offset] < 0
59
+ raise_invalid_request("Offset can't be negative")
51
60
  end
52
61
  perform_list_without_object(params)
53
62
  end
54
63
 
55
64
  ##
56
65
  # Create a new Camapign
57
- def create(params)
58
- perform_create(params)
66
+ def create(options=nil)
67
+ valid_param?(:options, options, Hash, true)
68
+ if not options[:brand_id]
69
+ raise_invalid_request("brand_id must be provided")
70
+ end
71
+ if not options[:vertical]
72
+ raise_invalid_request("vertical must be provided")
73
+ end
74
+ if not options[:usecase]
75
+ raise_invalid_request("usecase must be provided")
76
+ end
77
+ perform_create(options)
78
+ end
79
+ ##
80
+ # campaign number link
81
+ #
82
+ def number_link(options=nil)
83
+ valid_param?(:options, options, Hash, true)
84
+ if not options[:campaign_id]
85
+ raise_invalid_request("campaign_id must be provided")
86
+ end
87
+ action = options[:campaign_id] + '/Number'
88
+ perform_action_with_identifier(action, 'POST', options)
89
+ end
90
+ ##
91
+ #get campaign numbers
92
+ #
93
+ def get_numbers(campaign_id, options = nil)
94
+ params = {}
95
+ %i[offset limit].each do |param|
96
+ if options.key?(param) && valid_param?(param, options[param],
97
+ [Integer, Integer], true)
98
+ params[param] = options[param]
99
+ end
100
+ end
101
+ if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
102
+ raise_invalid_request('The maximum number of results that can be '\
103
+ "fetched is 20. limit can't be more than 20 or less than 1")
104
+ end
105
+ if options.key?(:offset) && options[:offset] < 0
106
+ raise_invalid_request("Offset can't be negative")
107
+ end
108
+ action = campaign_id + '/Number'
109
+ perform_action_with_identifier(action, 'GET', params)
110
+ end
111
+ ##
112
+ #get campaign number
113
+ #
114
+ def get_number(campaign_id, number)
115
+ action = campaign_id + '/Number/' + number
116
+ perform_action_with_identifier(action, 'GET', nil)
117
+ end
118
+ ##
119
+ #unlink campaign number
120
+ #
121
+ def number_unlink(campaign_id, number, options = nil)
122
+ action = campaign_id + '/Number/' + number
123
+ perform_action_with_identifier(action, 'DELETE', nil)
59
124
  end
60
125
  end
61
126
  end
62
- end
127
+ end
@@ -0,0 +1,93 @@
1
+ module Plivo
2
+ module Resources
3
+ include Plivo::Utils
4
+ class Profile < Base::Resource
5
+ def initialize(client, options = nil)
6
+ @_name = 'Profile'
7
+ @_identifier_string = 'profile_uuid'
8
+ super
9
+ end
10
+
11
+ def to_s
12
+ {
13
+ api_id: @api_id,
14
+ profile: @profile
15
+ }.to_s
16
+ end
17
+ end
18
+ class ProfileInterface < Base::ResourceInterface
19
+ def initialize(client, resource_list_json = nil)
20
+ @_name = 'Profile'
21
+ @_resource_type = Profile
22
+ @_identifier_string = 'profile_uuid'
23
+ super
24
+ end
25
+
26
+ ##
27
+ # Get an Profile
28
+ # @param [String] profile_uuid
29
+ # @return [Profile] Profile
30
+ def get(profile_uuid)
31
+ valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
32
+ perform_get(profile_uuid)
33
+ end
34
+
35
+ # List all Profile
36
+ def list(options = nil)
37
+ return perform_list_without_object if options.nil?
38
+ params = {}
39
+ %i[offset limit].each do |param|
40
+ if options.key?(param) && valid_param?(param, options[param],
41
+ [Integer, Integer], true)
42
+ params[param] = options[param]
43
+ end
44
+ end
45
+ if options.key?(:limit) && (options[:limit] > 20 || options[:limit] <= 0)
46
+ raise_invalid_request('The maximum number of results that can be '\
47
+ "fetched is 20. limit can't be more than 20 or less than 1")
48
+ end
49
+ if options.key?(:offset) && options[:offset] < 0
50
+ raise_invalid_request("Offset can't be negative")
51
+ end
52
+ perform_list_without_object(params)
53
+ end
54
+
55
+ # Delete an Profile
56
+ # @param [String] profile_uuid
57
+ def delete(profile_uuid)
58
+ valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
59
+ perform_action_with_identifier(profile_uuid, 'DELETE', nil)
60
+ end
61
+
62
+ ##
63
+ # Create a new Profile
64
+ def create(options = nil)
65
+ valid_param?(:options, options, Hash, true)
66
+ if not options[:profile_alias]
67
+ raise_invalid_request("profile_alias must be provided")
68
+ end
69
+ if not options[:customer_type]
70
+ raise_invalid_request("customer_type must be provided")
71
+ end
72
+ if not options[:entity_type]
73
+ raise_invalid_request("entity_type must be provided")
74
+ end
75
+ if not options[:company_name]
76
+ raise_invalid_request("company_name must be provided")
77
+ end
78
+ if not options[:vertical]
79
+ raise_invalid_request("vertical must be provided")
80
+ end
81
+ perform_create(options)
82
+ end
83
+
84
+ ##
85
+ # Update a Profile
86
+ # {'address': {}, 'authorized_contact': {}, 'entity_type':'', 'vertical': '', 'company_name': '', 'website':''}
87
+ def update(profile_uuid, options = nil)
88
+ valid_param?(:options, options, Hash, true)
89
+ perform_action_with_identifier(profile_uuid, "POST", options)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -18,6 +18,7 @@ require_relative 'resources/call_feedback'
18
18
  require_relative 'resources/media'
19
19
  require_relative 'resources/brand'
20
20
  require_relative 'resources/campaign'
21
+ require_relative 'resources/profile'
21
22
  require_relative 'resources/lookup'
22
23
  require_relative 'resources/regulatory_compliance'
23
24
  require_relative 'resources/multipartycalls'
@@ -15,7 +15,7 @@ module Plivo
15
15
  attr_reader :powerpacks
16
16
  attr_reader :powerpacks, :media
17
17
  attr_reader :lookup
18
- attr_reader :brand, :campaign
18
+ attr_reader :brand, :campaign, :profile
19
19
  attr_reader :end_users
20
20
  attr_reader :compliance_document_types, :compliance_documents, :compliance_requirements, :compliance_applications
21
21
 
@@ -43,6 +43,7 @@ module Plivo
43
43
  @media = Resources::MediaInterface.new(self)
44
44
  @brand = Resources::BrandInterface.new(self)
45
45
  @campaign = Resources::CampaignInterface.new(self)
46
+ @profile = Resources::ProfileInterface.new(self)
46
47
  @subaccounts = Resources::SubaccountInterface.new(self)
47
48
  @recordings = Resources::RecordingInterface.new(self)
48
49
  @pricings = Resources::PricingInterface.new(self)
data/lib/plivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plivo
2
- VERSION = "4.29.0".freeze
2
+ VERSION = "4.30.1".freeze
3
3
  end
data/plivo.gemspec CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.required_ruby_version = '>= 2.0.0'
33
33
 
34
- spec.add_dependency 'faraday', '~> 1.0.1'
35
- spec.add_dependency 'faraday_middleware', '~> 1.0.0'
34
+ spec.add_dependency 'faraday', '~> 1.0'
35
+ spec.add_dependency 'faraday_middleware', '~> 1.0'
36
36
  spec.add_dependency 'htmlentities'
37
37
  spec.add_dependency 'jwt'
38
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.29.0
4
+ version: 4.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Plivo SDKs Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-12 00:00:00.000000000 Z
11
+ date: 2022-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.1
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +199,7 @@ files:
199
199
  - lib/plivo/resources/phlos.rb
200
200
  - lib/plivo/resources/powerpacks.rb
201
201
  - lib/plivo/resources/pricings.rb
202
+ - lib/plivo/resources/profile.rb
202
203
  - lib/plivo/resources/recordings.rb
203
204
  - lib/plivo/resources/regulatory_compliance.rb
204
205
  - lib/plivo/resources/token.rb