bandwidth-sdk 3.6.0 → 3.7.0

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.
@@ -0,0 +1,49 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # BaseController.
8
+ class BaseController
9
+ attr_accessor :config, :http_call_back
10
+
11
+ def initialize(config, http_call_back: nil)
12
+ @config = config
13
+ @http_call_back = http_call_back
14
+
15
+ @global_headers = {
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.7.0'
17
+ }
18
+ end
19
+
20
+ def validate_parameters(args)
21
+ args.each do |_name, value|
22
+ if value.nil?
23
+ raise ArgumentError, "Required parameter #{_name} cannot be nil."
24
+ end
25
+ end
26
+ end
27
+
28
+ def execute_request(request, binary: false)
29
+ @http_call_back.on_before_request(request) if @http_call_back
30
+
31
+ APIHelper.clean_hash(request.headers)
32
+ request.headers.merge!(@global_headers)
33
+
34
+ response = if binary
35
+ config.http_client.execute_as_binary(request)
36
+ else
37
+ config.http_client.execute_as_string(request)
38
+ end
39
+ @http_call_back.on_after_response(response) if @http_call_back
40
+
41
+ response
42
+ end
43
+
44
+ def validate_response(response)
45
+ raise APIException.new 'HTTP Response Not OK', response unless
46
+ response.status_code.between?(200, 208) # [200,208] = HTTP OK
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,34 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Error class.
8
+ class ErrorException < APIException
9
+ # TODO: Write general description for this method
10
+ # @return [Integer]
11
+ attr_accessor :code
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :message
16
+
17
+ # The constructor.
18
+ # @param [String] The reason for raising an exception.
19
+ # @param [HttpResponse] The HttpReponse of the API call.
20
+ def initialize(reason, response)
21
+ super(reason, response)
22
+ hash = APIHelper.json_deserialize(@response.raw_body)
23
+ unbox(hash)
24
+ end
25
+
26
+ # Populates this object by extracting properties from a hash.
27
+ # @param [Hash] The deserialized response sent by the server in the
28
+ # response body.
29
+ def unbox(hash)
30
+ @code = hash['code']
31
+ @message = hash['message']
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,47 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # AccountsParticipantsResponse Model.
8
+ class AccountsParticipantsResponse < BaseModel
9
+ # A participant object
10
+ # @return [Participant]
11
+ attr_accessor :participant
12
+
13
+ # Auth token for the returned participant
14
+ # This should be passed to the participant so that they can connect to the
15
+ # platform
16
+ # @return [String]
17
+ attr_accessor :token
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['participant'] = 'participant'
23
+ @_hash['token'] = 'token'
24
+ @_hash
25
+ end
26
+
27
+ def initialize(participant = nil,
28
+ token = nil)
29
+ @participant = participant
30
+ @token = token
31
+ end
32
+
33
+ # Creates an instance of the object from a hash.
34
+ def self.from_hash(hash)
35
+ return nil unless hash
36
+
37
+ # Extract variables from the hash.
38
+ participant = Participant.from_hash(hash['participant']) if
39
+ hash['participant']
40
+ token = hash['token']
41
+
42
+ # Create object from extracted values.
43
+ AccountsParticipantsResponse.new(participant,
44
+ token)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,83 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # A participant object
8
+ class Participant < BaseModel
9
+ # Unique id of the participant
10
+ # @return [String]
11
+ attr_accessor :id
12
+
13
+ # Full callback url to use for notifications about this participant
14
+ # @return [String]
15
+ attr_accessor :callback_url
16
+
17
+ # Defines if this participant can publish audio or video
18
+ # @return [List of PublishPermissionEnum]
19
+ attr_accessor :publish_permissions
20
+
21
+ # List of session ids this participant is associated with
22
+ # Capped to one
23
+ # @return [List of String]
24
+ attr_accessor :sessions
25
+
26
+ # List of session ids this participant is associated with
27
+ # Capped to one
28
+ # @return [Subscriptions]
29
+ attr_accessor :subscriptions
30
+
31
+ # User defined tag to associate with the participant
32
+ # @return [String]
33
+ attr_accessor :tag
34
+
35
+ # A mapping from model property names to API property names.
36
+ def self.names
37
+ @_hash = {} if @_hash.nil?
38
+ @_hash['id'] = 'id'
39
+ @_hash['callback_url'] = 'callbackUrl'
40
+ @_hash['publish_permissions'] = 'publishPermissions'
41
+ @_hash['sessions'] = 'sessions'
42
+ @_hash['subscriptions'] = 'subscriptions'
43
+ @_hash['tag'] = 'tag'
44
+ @_hash
45
+ end
46
+
47
+ def initialize(id = nil,
48
+ callback_url = nil,
49
+ publish_permissions = nil,
50
+ sessions = nil,
51
+ subscriptions = nil,
52
+ tag = nil)
53
+ @id = id
54
+ @callback_url = callback_url
55
+ @publish_permissions = publish_permissions
56
+ @sessions = sessions
57
+ @subscriptions = subscriptions
58
+ @tag = tag
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ id = hash['id']
67
+ callback_url = hash['callbackUrl']
68
+ publish_permissions = hash['publishPermissions']
69
+ sessions = hash['sessions']
70
+ subscriptions = Subscriptions.from_hash(hash['subscriptions']) if
71
+ hash['subscriptions']
72
+ tag = hash['tag']
73
+
74
+ # Create object from extracted values.
75
+ Participant.new(id,
76
+ callback_url,
77
+ publish_permissions,
78
+ sessions,
79
+ subscriptions,
80
+ tag)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ParticipantSubscription Model.
8
+ class ParticipantSubscription < BaseModel
9
+ # Participant the subscriber should be subscribed to
10
+ # @return [String]
11
+ attr_accessor :participant_id
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['participant_id'] = 'participantId'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(participant_id = nil)
21
+ @participant_id = participant_id
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ participant_id = hash['participantId']
30
+
31
+ # Create object from extracted values.
32
+ ParticipantSubscription.new(participant_id)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # PublishPermission.
8
+ class PublishPermissionEnum
9
+ PUBLISH_PERMISSION_ENUM = [
10
+ # TODO: Write general description for AUDIO
11
+ AUDIO = 'AUDIO'.freeze,
12
+
13
+ # TODO: Write general description for VIDEO
14
+ VIDEO = 'VIDEO'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # A session object
8
+ class Session < BaseModel
9
+ # Unique id of the session
10
+ # @return [String]
11
+ attr_accessor :id
12
+
13
+ # User defined tag to associate with the session
14
+ # @return [String]
15
+ attr_accessor :tag
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['id'] = 'id'
21
+ @_hash['tag'] = 'tag'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(id = nil,
26
+ tag = nil)
27
+ @id = id
28
+ @tag = tag
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ id = hash['id']
37
+ tag = hash['tag']
38
+
39
+ # Create object from extracted values.
40
+ Session.new(id,
41
+ tag)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,54 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Subscriptions Model.
8
+ class Subscriptions < BaseModel
9
+ # Session the subscriptions are associated with
10
+ # If this is the only field, the subscriber will be subscribed to all
11
+ # participants in the session (including any participants that are later
12
+ # added to the session)
13
+ # @return [String]
14
+ attr_accessor :session_id
15
+
16
+ # Subset of participants to subscribe to in the session. Optional.
17
+ # @return [List of ParticipantSubscription]
18
+ attr_accessor :participants
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['session_id'] = 'sessionId'
24
+ @_hash['participants'] = 'participants'
25
+ @_hash
26
+ end
27
+
28
+ def initialize(session_id = nil,
29
+ participants = nil)
30
+ @session_id = session_id
31
+ @participants = participants
32
+ end
33
+
34
+ # Creates an instance of the object from a hash.
35
+ def self.from_hash(hash)
36
+ return nil unless hash
37
+
38
+ # Extract variables from the hash.
39
+ session_id = hash['sessionId']
40
+ # Parameter is an array, so we need to iterate through it
41
+ participants = nil
42
+ unless hash['participants'].nil?
43
+ participants = []
44
+ hash['participants'].each do |structure|
45
+ participants << (ParticipantSubscription.from_hash(structure) if structure)
46
+ end
47
+ end
48
+
49
+ # Create object from extracted values.
50
+ Subscriptions.new(session_id,
51
+ participants)
52
+ end
53
+ end
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandwidth-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic SDK Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -111,6 +111,7 @@ files:
111
111
  - lib/bandwidth/http/auth/messaging_basic_auth.rb
112
112
  - lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb
113
113
  - lib/bandwidth/http/auth/voice_basic_auth.rb
114
+ - lib/bandwidth/http/auth/web_rtc_basic_auth.rb
114
115
  - lib/bandwidth/http/faraday_client.rb
115
116
  - lib/bandwidth/http/http_call_back.rb
116
117
  - lib/bandwidth/http/http_client.rb
@@ -188,6 +189,17 @@ files:
188
189
  - lib/bandwidth/voice_lib/voice/models/transcript.rb
189
190
  - lib/bandwidth/voice_lib/voice/models/transcription.rb
190
191
  - lib/bandwidth/voice_lib/voice/models/transcription_response.rb
192
+ - lib/bandwidth/web_rtc_lib/web_rtc.rb
193
+ - lib/bandwidth/web_rtc_lib/web_rtc/client.rb
194
+ - lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb
195
+ - lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb
196
+ - lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb
197
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb
198
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb
199
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb
200
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb
201
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb
202
+ - lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb
191
203
  homepage: https://apimatic.io
192
204
  licenses:
193
205
  - MIT