bandwidth-sdk 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +27 -27
  3. data/README.md +18 -59
  4. data/lib/bandwidth/api_helper.rb +4 -0
  5. data/lib/bandwidth/client.rb +1 -1
  6. data/lib/bandwidth/configuration.rb +2 -2
  7. data/lib/bandwidth/messaging_lib/messaging/client.rb +1 -1
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  9. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +26 -0
  10. data/lib/bandwidth/voice_lib/voice.rb +6 -5
  11. data/lib/bandwidth/voice_lib/voice/client.rb +1 -1
  12. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +178 -98
  13. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  14. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +67 -40
  15. data/lib/bandwidth/voice_lib/voice/models/direction_enum.rb +17 -0
  16. data/lib/bandwidth/voice_lib/voice/models/duration.rb +78 -0
  17. data/lib/bandwidth/voice_lib/voice/models/file_format_enum.rb +17 -0
  18. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +152 -0
  19. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +2 -2
  20. data/lib/bandwidth/voice_lib/voice/models/temporal_unit.rb +62 -0
  21. data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +20 -0
  22. metadata +15 -13
  23. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb +0 -51
  24. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_not_found_exception.rb +0 -49
  25. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb +0 -56
  26. data/lib/bandwidth/voice_lib/voice/models/bandwidth_callback_message_voice.rb +0 -98
  27. data/lib/bandwidth/voice_lib/voice/models/field_error.rb +0 -44
@@ -29,7 +29,7 @@ module Bandwidth
29
29
  @http_call_back.on_before_request(request) if @http_call_back
30
30
 
31
31
  APIHelper.clean_hash(request.headers)
32
- request.headers = @global_headers.clone.merge(request.headers)
32
+ request.headers.merge!(@global_headers)
33
33
 
34
34
  response = if binary
35
35
  config.http_client.execute_as_binary(request)
@@ -6,82 +6,103 @@
6
6
  module Bandwidth
7
7
  # ApiCallResponse Model.
8
8
  class ApiCallResponse < BaseModel
9
- # Format is E164
9
+ # TODO: Write general description for this method
10
10
  # @return [String]
11
- attr_accessor :from
11
+ attr_accessor :username
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :password
12
16
 
13
- # Format is E164
17
+ # TODO: Write general description for this method
14
18
  # @return [String]
15
19
  attr_accessor :to
16
20
 
17
- # Format is E164
18
- # @return [Float]
19
- attr_accessor :call_timeout
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :from
20
24
 
21
- # Format is E164
25
+ # TODO: Write general description for this method
22
26
  # @return [String]
23
- attr_accessor :answer_url
27
+ attr_accessor :application_id
24
28
 
25
- # Format is E164
29
+ # TODO: Write general description for this method
26
30
  # @return [String]
27
31
  attr_accessor :call_id
28
32
 
29
- # Format is E164
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :call_url
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [Float]
39
+ attr_accessor :call_timeout
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :answer_url
44
+
45
+ # TODO: Write general description for this method
30
46
  # @return [AnswerMethodEnum]
31
47
  attr_accessor :answer_method
32
48
 
33
- # Format is E164
49
+ # TODO: Write general description for this method
34
50
  # @return [String]
35
51
  attr_accessor :disconnect_url
36
52
 
37
- # Format is E164
53
+ # TODO: Write general description for this method
38
54
  # @return [DisconnectMethodEnum]
39
55
  attr_accessor :disconnect_method
40
56
 
41
- # Format is E164
57
+ # TODO: Write general description for this method
42
58
  # @return [String]
43
59
  attr_accessor :tag
44
60
 
45
- # Format is E164
46
- # @return [String]
47
- attr_accessor :application_id
48
-
49
61
  # A mapping from model property names to API property names.
50
62
  def self.names
51
63
  @_hash = {} if @_hash.nil?
52
- @_hash['from'] = 'from'
64
+ @_hash['username'] = 'username'
65
+ @_hash['password'] = 'password'
53
66
  @_hash['to'] = 'to'
67
+ @_hash['from'] = 'from'
68
+ @_hash['application_id'] = 'applicationId'
69
+ @_hash['call_id'] = 'callId'
70
+ @_hash['call_url'] = 'callUrl'
54
71
  @_hash['call_timeout'] = 'callTimeout'
55
72
  @_hash['answer_url'] = 'answerUrl'
56
- @_hash['call_id'] = 'callId'
57
73
  @_hash['answer_method'] = 'answerMethod'
58
74
  @_hash['disconnect_url'] = 'disconnectUrl'
59
75
  @_hash['disconnect_method'] = 'disconnectMethod'
60
76
  @_hash['tag'] = 'tag'
61
- @_hash['application_id'] = 'applicationId'
62
77
  @_hash
63
78
  end
64
79
 
65
- def initialize(from = nil,
66
- to = nil,
67
- answer_url = nil,
68
- call_id = nil,
80
+ def initialize(to = nil,
81
+ from = nil,
69
82
  application_id = nil,
70
- call_timeout = nil,
83
+ call_id = nil,
84
+ call_url = nil,
85
+ answer_url = nil,
71
86
  answer_method = nil,
72
- disconnect_url = nil,
73
87
  disconnect_method = nil,
88
+ username = nil,
89
+ password = nil,
90
+ call_timeout = nil,
91
+ disconnect_url = nil,
74
92
  tag = nil)
75
- @from = from
93
+ @username = username
94
+ @password = password
76
95
  @to = to
96
+ @from = from
97
+ @application_id = application_id
98
+ @call_id = call_id
99
+ @call_url = call_url
77
100
  @call_timeout = call_timeout
78
101
  @answer_url = answer_url
79
- @call_id = call_id
80
102
  @answer_method = answer_method
81
103
  @disconnect_url = disconnect_url
82
104
  @disconnect_method = disconnect_method
83
105
  @tag = tag
84
- @application_id = application_id
85
106
  end
86
107
 
87
108
  # Creates an instance of the object from a hash.
@@ -89,27 +110,33 @@ module Bandwidth
89
110
  return nil unless hash
90
111
 
91
112
  # Extract variables from the hash.
92
- from = hash['from']
93
113
  to = hash['to']
94
- answer_url = hash['answerUrl']
95
- call_id = hash['callId']
114
+ from = hash['from']
96
115
  application_id = hash['applicationId']
97
- call_timeout = hash['callTimeout']
116
+ call_id = hash['callId']
117
+ call_url = hash['callUrl']
118
+ answer_url = hash['answerUrl']
98
119
  answer_method = hash['answerMethod']
99
- disconnect_url = hash['disconnectUrl']
100
120
  disconnect_method = hash['disconnectMethod']
121
+ username = hash['username']
122
+ password = hash['password']
123
+ call_timeout = hash['callTimeout']
124
+ disconnect_url = hash['disconnectUrl']
101
125
  tag = hash['tag']
102
126
 
103
127
  # Create object from extracted values.
104
- ApiCallResponse.new(from,
105
- to,
106
- answer_url,
107
- call_id,
128
+ ApiCallResponse.new(to,
129
+ from,
108
130
  application_id,
109
- call_timeout,
131
+ call_id,
132
+ call_url,
133
+ answer_url,
110
134
  answer_method,
111
- disconnect_url,
112
135
  disconnect_method,
136
+ username,
137
+ password,
138
+ call_timeout,
139
+ disconnect_url,
113
140
  tag)
114
141
  end
115
142
  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
+ # Direction.
8
+ class DirectionEnum
9
+ DIRECTION_ENUM = [
10
+ # TODO: Write general description for INBOUND
11
+ INBOUND = 'inbound'.freeze,
12
+
13
+ # TODO: Write general description for OUTBOUND
14
+ OUTBOUND = 'outbound'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -0,0 +1,78 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Duration Model.
8
+ class Duration < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Long]
11
+ attr_accessor :seconds
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :nano
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Boolean]
19
+ attr_accessor :negative
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Boolean]
23
+ attr_accessor :zero
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [List of TemporalUnit]
27
+ attr_accessor :units
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['seconds'] = 'seconds'
33
+ @_hash['nano'] = 'nano'
34
+ @_hash['negative'] = 'negative'
35
+ @_hash['zero'] = 'zero'
36
+ @_hash['units'] = 'units'
37
+ @_hash
38
+ end
39
+
40
+ def initialize(seconds = nil,
41
+ nano = nil,
42
+ negative = nil,
43
+ zero = nil,
44
+ units = nil)
45
+ @seconds = seconds
46
+ @nano = nano
47
+ @negative = negative
48
+ @zero = zero
49
+ @units = units
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ seconds = hash['seconds']
58
+ nano = hash['nano']
59
+ negative = hash['negative']
60
+ zero = hash['zero']
61
+ # Parameter is an array, so we need to iterate through it
62
+ units = nil
63
+ unless hash['units'].nil?
64
+ units = []
65
+ hash['units'].each do |structure|
66
+ units << (TemporalUnit.from_hash(structure) if structure)
67
+ end
68
+ end
69
+
70
+ # Create object from extracted values.
71
+ Duration.new(seconds,
72
+ nano,
73
+ negative,
74
+ zero,
75
+ units)
76
+ end
77
+ end
78
+ 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
+ # FileFormat.
8
+ class FileFormatEnum
9
+ FILE_FORMAT_ENUM = [
10
+ # TODO: Write general description for MP3
11
+ MP3 = 'mp3'.freeze,
12
+
13
+ # TODO: Write general description for WAV
14
+ WAV = 'wav'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -0,0 +1,152 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # RecordingMetadataResponse Model.
8
+ class RecordingMetadataResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :account_id
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :call_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :recording_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :to
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :from
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [Duration]
31
+ attr_accessor :duration
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [DirectionEnum]
35
+ attr_accessor :direction
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [Integer]
39
+ attr_accessor :channels
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [Long]
43
+ attr_accessor :start_time
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [Long]
47
+ attr_accessor :end_time
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [FileFormatEnum]
51
+ attr_accessor :file_format
52
+
53
+ # TODO: Write general description for this method
54
+ # @return [TranscriptionStatusEnum]
55
+ attr_accessor :transcription_status
56
+
57
+ # TODO: Write general description for this method
58
+ # @return [String]
59
+ attr_accessor :media_url
60
+
61
+ # TODO: Write general description for this method
62
+ # @return [String]
63
+ attr_accessor :transcription_url
64
+
65
+ # A mapping from model property names to API property names.
66
+ def self.names
67
+ @_hash = {} if @_hash.nil?
68
+ @_hash['account_id'] = 'accountId'
69
+ @_hash['call_id'] = 'callId'
70
+ @_hash['recording_id'] = 'recordingId'
71
+ @_hash['to'] = 'to'
72
+ @_hash['from'] = 'from'
73
+ @_hash['duration'] = 'duration'
74
+ @_hash['direction'] = 'direction'
75
+ @_hash['channels'] = 'channels'
76
+ @_hash['start_time'] = 'startTime'
77
+ @_hash['end_time'] = 'endTime'
78
+ @_hash['file_format'] = 'fileFormat'
79
+ @_hash['transcription_status'] = 'transcriptionStatus'
80
+ @_hash['media_url'] = 'mediaUrl'
81
+ @_hash['transcription_url'] = 'transcriptionUrl'
82
+ @_hash
83
+ end
84
+
85
+ def initialize(account_id = nil,
86
+ call_id = nil,
87
+ recording_id = nil,
88
+ to = nil,
89
+ from = nil,
90
+ duration = nil,
91
+ direction = nil,
92
+ channels = nil,
93
+ start_time = nil,
94
+ end_time = nil,
95
+ file_format = nil,
96
+ transcription_status = nil,
97
+ media_url = nil,
98
+ transcription_url = nil)
99
+ @account_id = account_id
100
+ @call_id = call_id
101
+ @recording_id = recording_id
102
+ @to = to
103
+ @from = from
104
+ @duration = duration
105
+ @direction = direction
106
+ @channels = channels
107
+ @start_time = start_time
108
+ @end_time = end_time
109
+ @file_format = file_format
110
+ @transcription_status = transcription_status
111
+ @media_url = media_url
112
+ @transcription_url = transcription_url
113
+ end
114
+
115
+ # Creates an instance of the object from a hash.
116
+ def self.from_hash(hash)
117
+ return nil unless hash
118
+
119
+ # Extract variables from the hash.
120
+ account_id = hash['accountId']
121
+ call_id = hash['callId']
122
+ recording_id = hash['recordingId']
123
+ to = hash['to']
124
+ from = hash['from']
125
+ duration = Duration.from_hash(hash['duration']) if hash['duration']
126
+ direction = hash['direction']
127
+ channels = hash['channels']
128
+ start_time = hash['startTime']
129
+ end_time = hash['endTime']
130
+ file_format = hash['fileFormat']
131
+ transcription_status = hash['transcriptionStatus']
132
+ media_url = hash['mediaUrl']
133
+ transcription_url = hash['transcriptionUrl']
134
+
135
+ # Create object from extracted values.
136
+ RecordingMetadataResponse.new(account_id,
137
+ call_id,
138
+ recording_id,
139
+ to,
140
+ from,
141
+ duration,
142
+ direction,
143
+ channels,
144
+ start_time,
145
+ end_time,
146
+ file_format,
147
+ transcription_status,
148
+ media_url,
149
+ transcription_url)
150
+ end
151
+ end
152
+ end