plivo 4.29.0 → 4.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec364fb43089ee282e74b34a0583506cf779b969
4
- data.tar.gz: 35c6813354cbc974ebe0643b00c74d1032c7b8cd
3
+ metadata.gz: e9dc7434e8982f184b0e1896144431f32fc82a1e
4
+ data.tar.gz: 975f64c13a825a1aba8558b821fb2032557648a5
5
5
  SHA512:
6
- metadata.gz: 72145e3123568e80e427b3335877943bb75ffac9afb88d16f222c9e5622e8876d9342697c749b1c04e912d2c92b35063ef82cdc89ef3ca78b7fc71542d903354
7
- data.tar.gz: 6f52fa44fc0f450b0f0aeee39a076bb0bf7c4021575d41cf4d23f861bd9270044c37974518d862403921fbee13238254c037f11de7b99aa2cf91115425b7b8e3
6
+ metadata.gz: 24a3cb5257654ae4e8c200cec5ac0291fa407fe669832887258f4e06a7bf9f6715549c4ec0c59f058d6ed9c47d49a387019eae8ee23642725204a54f82bee039
7
+ data.tar.gz: 65c9323280aa2390745ee00d16e0505ee82802896d3d8fb4b0ef81f8e8d44d6ccf602fb133c8cdc8cf2e588177c02359b5a57fa755ddf9e1e40f768948cc8e06
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.30.0](https://github.com/plivo/plivo-go/tree/v4.30.0) (2022-08-26)
4
+ **Feature - 10DLC APIs**
5
+ - Added new 10DLC APIs
6
+
3
7
  ## [4.29.0](https://github.com/plivo/plivo-go/tree/v4.29.0) (2022-08-01)
4
8
  **Feature - Token Creation**
5
9
  - `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.0'
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)
@@ -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.0".freeze
3
3
  end
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.0
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-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -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