bandwidth-sdk 0.1.0 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +27 -27
  3. data/README.md +115 -1
  4. data/lib/bandwidth.rb +39 -37
  5. data/lib/bandwidth/api_helper.rb +280 -280
  6. data/lib/bandwidth/client.rb +41 -32
  7. data/lib/bandwidth/configuration.rb +130 -111
  8. data/lib/bandwidth/exceptions/api_exception.rb +20 -20
  9. data/lib/bandwidth/http/api_response.rb +36 -36
  10. data/lib/bandwidth/http/auth/messaging_basic_auth.rb +22 -0
  11. data/lib/bandwidth/http/auth/voice_basic_auth.rb +22 -22
  12. data/lib/bandwidth/http/faraday_client.rb +64 -64
  13. data/lib/bandwidth/http/http_call_back.rb +24 -24
  14. data/lib/bandwidth/http/http_client.rb +104 -104
  15. data/lib/bandwidth/http/http_method_enum.rb +13 -13
  16. data/lib/bandwidth/http/http_request.rb +50 -50
  17. data/lib/bandwidth/http/http_response.rb +29 -29
  18. data/lib/bandwidth/messaging_lib/messaging.rb +23 -0
  19. data/lib/bandwidth/messaging_lib/messaging/client.rb +40 -0
  20. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +406 -0
  21. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +49 -0
  22. data/lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb +46 -0
  23. data/lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb +49 -0
  24. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +80 -0
  25. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +125 -0
  26. data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +44 -0
  27. data/lib/bandwidth/messaging_lib/messaging/models/field_error.rb +44 -0
  28. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +123 -0
  29. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +80 -0
  30. data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +44 -0
  31. data/lib/bandwidth/models/base_model.rb +36 -36
  32. data/lib/bandwidth/voice_lib/bxml/bxml.rb +40 -0
  33. data/lib/bandwidth/voice_lib/bxml/verbs/forward.rb +19 -0
  34. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +38 -0
  35. data/lib/bandwidth/voice_lib/bxml/verbs/hangup.rb +15 -0
  36. data/lib/bandwidth/voice_lib/bxml/verbs/pause.rb +16 -0
  37. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +19 -0
  38. data/lib/bandwidth/voice_lib/bxml/verbs/play_audio.rb +18 -0
  39. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +21 -0
  40. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +14 -0
  41. data/lib/bandwidth/voice_lib/bxml/verbs/speak_sentence.rb +19 -0
  42. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +38 -0
  43. data/lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb +27 -0
  44. data/lib/bandwidth/voice_lib/voice.rb +27 -23
  45. data/lib/bandwidth/voice_lib/voice/client.rb +40 -36
  46. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +184 -0
  47. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +49 -49
  48. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb +51 -0
  49. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_not_found_exception.rb +49 -0
  50. data/lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb +56 -0
  51. data/lib/bandwidth/voice_lib/voice/models/answer_method_enum.rb +35 -35
  52. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +116 -116
  53. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +125 -125
  54. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +80 -80
  55. data/lib/bandwidth/voice_lib/voice/models/bandwidth_callback_message_voice.rb +98 -98
  56. data/lib/bandwidth/voice_lib/voice/models/disconnect_method_enum.rb +35 -35
  57. data/lib/bandwidth/voice_lib/voice/models/field_error.rb +44 -0
  58. data/lib/bandwidth/voice_lib/voice/models/redirect_method_enum.rb +35 -35
  59. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +17 -17
  60. metadata +36 -47
  61. data/lib/bandwidth/voice_lib/voice/bxml/bxml.rb +0 -36
  62. data/lib/bandwidth/voice_lib/voice/bxml/verbs/forward.rb +0 -19
  63. data/lib/bandwidth/voice_lib/voice/bxml/verbs/gather.rb +0 -37
  64. data/lib/bandwidth/voice_lib/voice/bxml/verbs/hangup.rb +0 -14
  65. data/lib/bandwidth/voice_lib/voice/bxml/verbs/pause.rb +0 -15
  66. data/lib/bandwidth/voice_lib/voice/bxml/verbs/phone_number.rb +0 -18
  67. data/lib/bandwidth/voice_lib/voice/bxml/verbs/play_audio.rb +0 -17
  68. data/lib/bandwidth/voice_lib/voice/bxml/verbs/redirect.rb +0 -20
  69. data/lib/bandwidth/voice_lib/voice/bxml/verbs/send_dtmf.rb +0 -12
  70. data/lib/bandwidth/voice_lib/voice/bxml/verbs/speak_sentence.rb +0 -18
  71. data/lib/bandwidth/voice_lib/voice/bxml/verbs/transfer.rb +0 -37
  72. data/lib/bandwidth/voice_lib/voice/bxml/verbs/xml_verb.rb +0 -26
  73. data/lib/bandwidth/voice_lib/voice/controllers/calls_controller.rb +0 -88
@@ -1,80 +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
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
@@ -1,98 +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
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
@@ -1,35 +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
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
@@ -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
+ # FieldError Model.
8
+ class FieldError < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :field_name
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :description
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['field_name'] = 'fieldName'
21
+ @_hash['description'] = 'description'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(field_name = nil,
26
+ description = nil)
27
+ @field_name = field_name
28
+ @description = description
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
+ field_name = hash['fieldName']
37
+ description = hash['description']
38
+
39
+ # Create object from extracted values.
40
+ FieldError.new(field_name,
41
+ description)
42
+ end
43
+ end
44
+ end