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
@@ -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
+ # 404 Not Found
8
+ class BandwidthNotFoundException < APIException
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :timestamp
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :status
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :error
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :message
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :path
28
+
29
+ # The constructor.
30
+ # @param [String] The reason for raising an exception.
31
+ # @param [HttpResponse] The HttpReponse of the API call.
32
+ def initialize(reason, response)
33
+ super(reason, response)
34
+ hash = APIHelper.json_deserialize(@response.raw_body)
35
+ unbox(hash)
36
+ end
37
+
38
+ # Populates this object by extracting properties from a hash.
39
+ # @param [Hash] The deserialized response sent by the server in the
40
+ # response body.
41
+ def unbox(hash)
42
+ @timestamp = hash['timestamp']
43
+ @status = hash['status']
44
+ @error = hash['error']
45
+ @message = hash['message']
46
+ @path = hash['path']
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,56 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # BandwidthRateLimitError class.
8
+ class BandwidthRateLimitErrorException < APIException
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :type
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :description
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :status
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [List of FieldError]
27
+ attr_accessor :field_errors
28
+
29
+ # The constructor.
30
+ # @param [String] The reason for raising an exception.
31
+ # @param [HttpResponse] The HttpReponse of the API call.
32
+ def initialize(reason, response)
33
+ super(reason, response)
34
+ hash = APIHelper.json_deserialize(@response.raw_body)
35
+ unbox(hash)
36
+ end
37
+
38
+ # Populates this object by extracting properties from a hash.
39
+ # @param [Hash] The deserialized response sent by the server in the
40
+ # response body.
41
+ def unbox(hash)
42
+ @type = hash['type']
43
+ @description = hash['description']
44
+ @id = hash['id']
45
+ @status = hash['status']
46
+ # Parameter is an array, so we need to iterate through it
47
+ @field_errors = nil
48
+ unless hash['fieldErrors'].nil?
49
+ @field_errors = []
50
+ hash['fieldErrors'].each do |structure|
51
+ @field_errors << (FieldError.from_hash(structure) if structure)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ 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
- # AnswerMethod.
8
- class AnswerMethodEnum
9
- ANSWER_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
+ # AnswerMethod.
8
+ class AnswerMethodEnum
9
+ ANSWER_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,116 +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
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
@@ -1,125 +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
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