bandwidth-sdk 0.1.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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +1 -0
  4. data/lib/bandwidth.rb +37 -0
  5. data/lib/bandwidth/api_helper.rb +280 -0
  6. data/lib/bandwidth/client.rb +32 -0
  7. data/lib/bandwidth/configuration.rb +111 -0
  8. data/lib/bandwidth/exceptions/api_exception.rb +20 -0
  9. data/lib/bandwidth/http/api_response.rb +36 -0
  10. data/lib/bandwidth/http/auth/voice_basic_auth.rb +22 -0
  11. data/lib/bandwidth/http/faraday_client.rb +64 -0
  12. data/lib/bandwidth/http/http_call_back.rb +24 -0
  13. data/lib/bandwidth/http/http_client.rb +104 -0
  14. data/lib/bandwidth/http/http_method_enum.rb +13 -0
  15. data/lib/bandwidth/http/http_request.rb +50 -0
  16. data/lib/bandwidth/http/http_response.rb +29 -0
  17. data/lib/bandwidth/models/base_model.rb +36 -0
  18. data/lib/bandwidth/voice_lib/voice.rb +23 -0
  19. data/lib/bandwidth/voice_lib/voice/bxml/bxml.rb +36 -0
  20. data/lib/bandwidth/voice_lib/voice/bxml/verbs/forward.rb +19 -0
  21. data/lib/bandwidth/voice_lib/voice/bxml/verbs/gather.rb +37 -0
  22. data/lib/bandwidth/voice_lib/voice/bxml/verbs/hangup.rb +14 -0
  23. data/lib/bandwidth/voice_lib/voice/bxml/verbs/pause.rb +15 -0
  24. data/lib/bandwidth/voice_lib/voice/bxml/verbs/phone_number.rb +18 -0
  25. data/lib/bandwidth/voice_lib/voice/bxml/verbs/play_audio.rb +17 -0
  26. data/lib/bandwidth/voice_lib/voice/bxml/verbs/redirect.rb +20 -0
  27. data/lib/bandwidth/voice_lib/voice/bxml/verbs/send_dtmf.rb +12 -0
  28. data/lib/bandwidth/voice_lib/voice/bxml/verbs/speak_sentence.rb +18 -0
  29. data/lib/bandwidth/voice_lib/voice/bxml/verbs/transfer.rb +37 -0
  30. data/lib/bandwidth/voice_lib/voice/bxml/verbs/xml_verb.rb +26 -0
  31. data/lib/bandwidth/voice_lib/voice/client.rb +36 -0
  32. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +49 -0
  33. data/lib/bandwidth/voice_lib/voice/controllers/calls_controller.rb +88 -0
  34. data/lib/bandwidth/voice_lib/voice/models/answer_method_enum.rb +35 -0
  35. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +116 -0
  36. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +125 -0
  37. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +80 -0
  38. data/lib/bandwidth/voice_lib/voice/models/bandwidth_callback_message_voice.rb +98 -0
  39. data/lib/bandwidth/voice_lib/voice/models/disconnect_method_enum.rb +35 -0
  40. data/lib/bandwidth/voice_lib/voice/models/redirect_method_enum.rb +35 -0
  41. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +17 -0
  42. metadata +181 -0
@@ -0,0 +1,116 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ApiCallResponse Model.
8
+ class ApiCallResponse < BaseModel
9
+ # Format is E164
10
+ # @return [String]
11
+ attr_accessor :from
12
+
13
+ # Format is E164
14
+ # @return [String]
15
+ attr_accessor :to
16
+
17
+ # Format is E164
18
+ # @return [Float]
19
+ attr_accessor :call_timeout
20
+
21
+ # Format is E164
22
+ # @return [String]
23
+ attr_accessor :answer_url
24
+
25
+ # Format is E164
26
+ # @return [String]
27
+ attr_accessor :call_id
28
+
29
+ # Format is E164
30
+ # @return [AnswerMethodEnum]
31
+ attr_accessor :answer_method
32
+
33
+ # Format is E164
34
+ # @return [String]
35
+ attr_accessor :disconnect_url
36
+
37
+ # Format is E164
38
+ # @return [DisconnectMethodEnum]
39
+ attr_accessor :disconnect_method
40
+
41
+ # Format is E164
42
+ # @return [String]
43
+ attr_accessor :tag
44
+
45
+ # Format is E164
46
+ # @return [String]
47
+ attr_accessor :application_id
48
+
49
+ # A mapping from model property names to API property names.
50
+ def self.names
51
+ @_hash = {} if @_hash.nil?
52
+ @_hash['from'] = 'from'
53
+ @_hash['to'] = 'to'
54
+ @_hash['call_timeout'] = 'callTimeout'
55
+ @_hash['answer_url'] = 'answerUrl'
56
+ @_hash['call_id'] = 'callId'
57
+ @_hash['answer_method'] = 'answerMethod'
58
+ @_hash['disconnect_url'] = 'disconnectUrl'
59
+ @_hash['disconnect_method'] = 'disconnectMethod'
60
+ @_hash['tag'] = 'tag'
61
+ @_hash['application_id'] = 'applicationId'
62
+ @_hash
63
+ end
64
+
65
+ def initialize(from = nil,
66
+ to = nil,
67
+ answer_url = nil,
68
+ call_id = nil,
69
+ application_id = nil,
70
+ call_timeout = nil,
71
+ answer_method = nil,
72
+ disconnect_url = nil,
73
+ disconnect_method = nil,
74
+ tag = nil)
75
+ @from = from
76
+ @to = to
77
+ @call_timeout = call_timeout
78
+ @answer_url = answer_url
79
+ @call_id = call_id
80
+ @answer_method = answer_method
81
+ @disconnect_url = disconnect_url
82
+ @disconnect_method = disconnect_method
83
+ @tag = tag
84
+ @application_id = application_id
85
+ end
86
+
87
+ # Creates an instance of the object from a hash.
88
+ def self.from_hash(hash)
89
+ return nil unless hash
90
+
91
+ # Extract variables from the hash.
92
+ from = hash['from']
93
+ to = hash['to']
94
+ answer_url = hash['answerUrl']
95
+ call_id = hash['callId']
96
+ application_id = hash['applicationId']
97
+ call_timeout = hash['callTimeout']
98
+ answer_method = hash['answerMethod']
99
+ disconnect_url = hash['disconnectUrl']
100
+ disconnect_method = hash['disconnectMethod']
101
+ tag = hash['tag']
102
+
103
+ # Create object from extracted values.
104
+ ApiCallResponse.new(from,
105
+ to,
106
+ answer_url,
107
+ call_id,
108
+ application_id,
109
+ call_timeout,
110
+ answer_method,
111
+ disconnect_url,
112
+ disconnect_method,
113
+ tag)
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,125 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ApiCreateCallRequest Model.
8
+ class ApiCreateCallRequest < BaseModel
9
+ # Format is E164
10
+ # @return [String]
11
+ attr_accessor :from
12
+
13
+ # Format is E164
14
+ # @return [String]
15
+ attr_accessor :to
16
+
17
+ # Format is E164
18
+ # @return [Float]
19
+ attr_accessor :call_timeout
20
+
21
+ # Format is E164
22
+ # @return [String]
23
+ attr_accessor :answer_url
24
+
25
+ # Format is E164
26
+ # @return [String]
27
+ attr_accessor :username
28
+
29
+ # Format is E164
30
+ # @return [String]
31
+ attr_accessor :password
32
+
33
+ # Format is E164
34
+ # @return [AnswerMethodEnum]
35
+ attr_accessor :answer_method
36
+
37
+ # Format is E164
38
+ # @return [String]
39
+ attr_accessor :disconnect_url
40
+
41
+ # Format is E164
42
+ # @return [DisconnectMethodEnum]
43
+ attr_accessor :disconnect_method
44
+
45
+ # Format is E164
46
+ # @return [String]
47
+ attr_accessor :tag
48
+
49
+ # Format is E164
50
+ # @return [String]
51
+ attr_accessor :application_id
52
+
53
+ # A mapping from model property names to API property names.
54
+ def self.names
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['from'] = 'from'
57
+ @_hash['to'] = 'to'
58
+ @_hash['call_timeout'] = 'callTimeout'
59
+ @_hash['answer_url'] = 'answerUrl'
60
+ @_hash['username'] = 'username'
61
+ @_hash['password'] = 'password'
62
+ @_hash['answer_method'] = 'answerMethod'
63
+ @_hash['disconnect_url'] = 'disconnectUrl'
64
+ @_hash['disconnect_method'] = 'disconnectMethod'
65
+ @_hash['tag'] = 'tag'
66
+ @_hash['application_id'] = 'applicationId'
67
+ @_hash
68
+ end
69
+
70
+ def initialize(from = nil,
71
+ to = nil,
72
+ answer_url = nil,
73
+ application_id = nil,
74
+ call_timeout = nil,
75
+ username = nil,
76
+ password = nil,
77
+ answer_method = nil,
78
+ disconnect_url = nil,
79
+ disconnect_method = nil,
80
+ tag = nil)
81
+ @from = from
82
+ @to = to
83
+ @call_timeout = call_timeout
84
+ @answer_url = answer_url
85
+ @username = username
86
+ @password = password
87
+ @answer_method = answer_method
88
+ @disconnect_url = disconnect_url
89
+ @disconnect_method = disconnect_method
90
+ @tag = tag
91
+ @application_id = application_id
92
+ end
93
+
94
+ # Creates an instance of the object from a hash.
95
+ def self.from_hash(hash)
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash.
99
+ from = hash['from']
100
+ to = hash['to']
101
+ answer_url = hash['answerUrl']
102
+ application_id = hash['applicationId']
103
+ call_timeout = hash['callTimeout']
104
+ username = hash['username']
105
+ password = hash['password']
106
+ answer_method = hash['answerMethod']
107
+ disconnect_url = hash['disconnectUrl']
108
+ disconnect_method = hash['disconnectMethod']
109
+ tag = hash['tag']
110
+
111
+ # Create object from extracted values.
112
+ ApiCreateCallRequest.new(from,
113
+ to,
114
+ answer_url,
115
+ application_id,
116
+ call_timeout,
117
+ username,
118
+ password,
119
+ answer_method,
120
+ disconnect_url,
121
+ disconnect_method,
122
+ tag)
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,80 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ApiModifyCallRequest Model.
8
+ class ApiModifyCallRequest < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [StateEnum]
11
+ attr_accessor :state
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :redirect_url
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [RedirectMethodEnum]
19
+ attr_accessor :redirect_method
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :username
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :password
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :tag
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['state'] = 'state'
37
+ @_hash['redirect_url'] = 'redirectUrl'
38
+ @_hash['redirect_method'] = 'redirectMethod'
39
+ @_hash['username'] = 'username'
40
+ @_hash['password'] = 'password'
41
+ @_hash['tag'] = 'tag'
42
+ @_hash
43
+ end
44
+
45
+ def initialize(redirect_url = nil,
46
+ state = nil,
47
+ redirect_method = nil,
48
+ username = nil,
49
+ password = nil,
50
+ tag = nil)
51
+ @state = state
52
+ @redirect_url = redirect_url
53
+ @redirect_method = redirect_method
54
+ @username = username
55
+ @password = password
56
+ @tag = tag
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ redirect_url = hash['redirectUrl']
65
+ state = hash['state']
66
+ redirect_method = hash['redirectMethod']
67
+ username = hash['username']
68
+ password = hash['password']
69
+ tag = hash['tag']
70
+
71
+ # Create object from extracted values.
72
+ ApiModifyCallRequest.new(redirect_url,
73
+ state,
74
+ redirect_method,
75
+ username,
76
+ password,
77
+ tag)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,98 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # BandwidthCallbackMessageVoice Model.
8
+ class BandwidthCallbackMessageVoice < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :call_id
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :start_time
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :direction
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :from
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :to
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :digits
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :event_type
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :call_url
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['call_id'] = 'callId'
45
+ @_hash['start_time'] = 'startTime'
46
+ @_hash['direction'] = 'direction'
47
+ @_hash['from'] = 'from'
48
+ @_hash['to'] = 'to'
49
+ @_hash['digits'] = 'digits'
50
+ @_hash['event_type'] = 'eventType'
51
+ @_hash['call_url'] = 'callUrl'
52
+ @_hash
53
+ end
54
+
55
+ def initialize(call_id = nil,
56
+ start_time = nil,
57
+ direction = nil,
58
+ from = nil,
59
+ to = nil,
60
+ digits = nil,
61
+ event_type = nil,
62
+ call_url = nil)
63
+ @call_id = call_id
64
+ @start_time = start_time
65
+ @direction = direction
66
+ @from = from
67
+ @to = to
68
+ @digits = digits
69
+ @event_type = event_type
70
+ @call_url = call_url
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ call_id = hash['callId']
79
+ start_time = hash['startTime']
80
+ direction = hash['direction']
81
+ from = hash['from']
82
+ to = hash['to']
83
+ digits = hash['digits']
84
+ event_type = hash['eventType']
85
+ call_url = hash['callUrl']
86
+
87
+ # Create object from extracted values.
88
+ BandwidthCallbackMessageVoice.new(call_id,
89
+ start_time,
90
+ direction,
91
+ from,
92
+ to,
93
+ digits,
94
+ event_type,
95
+ call_url)
96
+ end
97
+ end
98
+ 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
+ # DisconnectMethod.
8
+ class DisconnectMethodEnum
9
+ DISCONNECT_METHOD_ENUM = [
10
+ # TODO: Write general description for GET
11
+ GET = 'GET'.freeze,
12
+
13
+ # TODO: Write general description for HEAD
14
+ HEAD = 'HEAD'.freeze,
15
+
16
+ # TODO: Write general description for POST
17
+ POST = 'POST'.freeze,
18
+
19
+ # TODO: Write general description for PUT
20
+ PUT = 'PUT'.freeze,
21
+
22
+ # TODO: Write general description for PATCH
23
+ PATCH = 'PATCH'.freeze,
24
+
25
+ # TODO: Write general description for DELETE
26
+ DELETE = 'DELETE'.freeze,
27
+
28
+ # TODO: Write general description for OPTIONS
29
+ OPTIONS = 'OPTIONS'.freeze,
30
+
31
+ # TODO: Write general description for TRACE
32
+ TRACE = 'TRACE'.freeze
33
+ ].freeze
34
+ end
35
+ end