freeclimb 2.0.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +105 -0
  3. data/README.md +12 -5
  4. data/docs/AccountResult.md +2 -2
  5. data/docs/AccountResultAllOf.md +2 -2
  6. data/docs/DefaultApi.md +46 -46
  7. data/docs/Hangup.md +17 -0
  8. data/docs/HangupAllOf.md +17 -0
  9. data/docs/MakeCallRequest.md +5 -3
  10. data/docs/MessageResult.md +1 -1
  11. data/docs/MessageResultAllOf.md +1 -1
  12. data/docs/RecordUtterance.md +3 -1
  13. data/docs/RecordUtteranceAllOf.md +3 -1
  14. data/docs/Redirect.md +1 -1
  15. data/docs/RedirectAllOf.md +1 -1
  16. data/docs/Reject.md +17 -0
  17. data/docs/RejectAllOf.md +17 -0
  18. data/freeclimb-2.0.3.gem +0 -0
  19. data/freeclimb-2.1.0.gem +0 -0
  20. data/freeclimb-2.1.1.gem +0 -0
  21. data/freeclimb-2.1.2.gem +0 -0
  22. data/lib/freeclimb.rb +4 -0
  23. data/lib/freeclimb/api_client.rb +1 -1
  24. data/lib/freeclimb/models/account_result.rb +8 -8
  25. data/lib/freeclimb/models/account_result_all_of.rb +8 -8
  26. data/lib/freeclimb/models/hangup.rb +220 -0
  27. data/lib/freeclimb/models/hangup_all_of.rb +207 -0
  28. data/lib/freeclimb/models/make_call_request.rb +16 -11
  29. data/lib/freeclimb/models/message_result.rb +3 -3
  30. data/lib/freeclimb/models/message_result_all_of.rb +3 -3
  31. data/lib/freeclimb/models/record_utterance.rb +14 -4
  32. data/lib/freeclimb/models/record_utterance_all_of.rb +14 -4
  33. data/lib/freeclimb/models/redirect.rb +7 -2
  34. data/lib/freeclimb/models/redirect_all_of.rb +6 -1
  35. data/lib/freeclimb/models/reject.rb +220 -0
  36. data/lib/freeclimb/models/reject_all_of.rb +207 -0
  37. data/lib/freeclimb/version.rb +1 -1
  38. data/spec/api/web_mocks.rb +1 -1
  39. data/spec/models/hangup_spec.rb +41 -0
  40. data/spec/models/reject_spec.rb +41 -0
  41. metadata +19 -2
data/docs/Hangup.md ADDED
@@ -0,0 +1,17 @@
1
+ # Freeclimb::Hangup
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **reason** | **String** | The user defined reason for the hangup. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the Call flows for the given application. | [optional]
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'freeclimb'
13
+
14
+ instance = Freeclimb::Hangup.new(reason: nil)
15
+ ```
16
+
17
+
@@ -0,0 +1,17 @@
1
+ # Freeclimb::HangupAllOf
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **reason** | **String** | The user defined reason for the hangup. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the Call flows for the given application. | [optional]
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'freeclimb'
13
+
14
+ instance = Freeclimb::HangupAllOf.new(reason: nil)
15
+ ```
16
+
17
+
@@ -6,13 +6,14 @@ Name | Type | Description | Notes
6
6
  ------------ | ------------- | ------------- | -------------
7
7
  **from** | **String** | Phone number to use as the caller ID. This can be: (a) The To or From number provided in FreeClimb's initial request to your app or (b) Any incoming phone number you have purchased from FreeClimb. |
8
8
  **to** | **String** | Phone number to place the Call to. |
9
- **application_id** | **String** | ID of the application FreeClimb should use to handle this phone call. FreeClimb will use the `callConnectUrl` and `statusCallbackUrl` set on the application. The application must have a `callConnectUrl` associated with it or an error will be returned. The application’s `voiceUrl` parameter is not used for outbound calls. |
9
+ **application_id** | **String** | Required if no `parentCallId` or `callConnectUrl` has been provided. ID of the application FreeClimb should use to handle this phone call. FreeClimb will use the `callConnectUrl` and `statusCallbackUrl` set on the application unless the `callConnectUrl` attribute is also provided with the request. In this case, the URL specified in that `callConnectUrl` attribute will be used as a replacement of the `callConnectUrl` originally assigned in the application. If the `callConnectUrl` is not set as either an attribute of the request or as part of the specified application, an error will be provided. The application’s voiceUrl parameter is not used for outbound calls. | [optional]
10
10
  **send_digits** | **String** | String of digits to dial after connecting to the number. It can include digits `0-9`, `*`, and `#`, and allows embedding a pause between the output of individual digits. The default pause is 500 milliseconds. So, a string such as *1234#* will be played in 2 seconds because of the 4 standard pauses implied within the string. A custom pause is specified by including a positive integer wrapped in curly braces: {n}. For more information, see **sendDigits examples** below. | [optional]
11
11
  **if_machine** | **String** | Specifies how FreeClimb should handle this Call if an answering machine answers it. | [optional]
12
12
  **if_machine_url** | **String** | This attribute specifies a URL to which FreeClimb will make a POST request when an answering machine or a fax machine is detected. This URL is required if the ifMachine flag is set to redirect. When ifMachine is set to hangup, ifMachineUrl must not be included in the request. For more information, see **ifMachineUrl example** below. | [optional]
13
13
  **timeout** | **Integer** | Number of seconds that FreeClimb should allow the phone to ring before assuming there is no answer. Default is 30 seconds. Maximum allowed ring-time is determined by the target phone's provider. Note that most providers limit ring-time to 120 seconds. | [optional]
14
- **parent_call_id** | **String** | The ID of the parent Call in the case that this new Call is meant to be treated as a child of an existing Call. This attribute should be included when possible to reduce latency when adding child calls to Conferences containing the parent Call. A call can only be used as a parent once the call is in progress or as an inbound call that is still ringing. An outbound call is considered to be in progress once the outdialConnect or outdialApiConnect webhook is invoked. An inbound call is ringing when the inbound webhook is invoked. | [optional]
14
+ **parent_call_id** | **String** | Required if no `applicationId` or `callConnectUrl` has been provided. The ID of the parent Call in the case that this new Call is meant to be treated as a child of an existing Call. This attribute should be included when possible to reduce latency when adding child calls to Conferences containing the parent Call. A call can only be used as a parent once the call is in progress or as an inbound call that is still ringing. An outbound call is considered to be in progress once the `outdialConnect` or `outdialApiConnect` webhook is invoked. An inbound call is ringing when the inbound webhook is invoked. If a `callConnectUrl` attribute is also included with the `parentCallId` in the request, this URL will be used as a replacement of the `callConnectUrl` originally assigned in the parent call. | [optional]
15
15
  **privacy_mode** | **Boolean** | Activate privacy mode in order to obscure log data that can potentially expose private information. | [optional]
16
+ **call_connect_url** | **String** | The URL that FreeClimb should use to handle this phone call. If an applicationId or parentCallId have already been provided, this callConnectUrl attribute will be used as a replacement of the callConnectUrl originally assigned in the application or parent call. | [optional]
16
17
 
17
18
  ## Code Sample
18
19
 
@@ -27,7 +28,8 @@ instance = Freeclimb::MakeCallRequest.new(from: nil,
27
28
  if_machine_url: nil,
28
29
  timeout: nil,
29
30
  parent_call_id: nil,
30
- privacy_mode: nil)
31
+ privacy_mode: nil,
32
+ call_connect_url: nil)
31
33
  ```
32
34
 
33
35
 
@@ -10,7 +10,7 @@ Name | Type | Description | Notes
10
10
  **revision** | **Integer** | Revision count for the resource. This count is set to 1 on creation and is incremented every time it is updated. | [optional]
11
11
  **account_id** | **String** | String that uniquely identifies this account resource. | [optional]
12
12
  **message_id** | **String** | String that uniquely identifies this message resource | [optional]
13
- **status** | **String** | Indicates the state of the message through the message lifecycle including: new, queued, rejected, sending, sent, failed, received | [optional]
13
+ **status** | **String** | Indicates the state of the message through the message lifecycle including: new, queued, rejected, sending, sent, failed, received, undelivered, expired, deleted, and unknown | [optional]
14
14
  **from** | **String** | Phone number in E.164 format that sent the message. | [optional]
15
15
  **to** | **String** | Phone number in E.164 format that received the message. | [optional]
16
16
  **text** | **String** | Message contents | [optional]
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
6
6
  ------------ | ------------- | ------------- | -------------
7
7
  **account_id** | **String** | String that uniquely identifies this account resource. | [optional]
8
8
  **message_id** | **String** | String that uniquely identifies this message resource | [optional]
9
- **status** | **String** | Indicates the state of the message through the message lifecycle including: new, queued, rejected, sending, sent, failed, received | [optional]
9
+ **status** | **String** | Indicates the state of the message through the message lifecycle including: new, queued, rejected, sending, sent, failed, received, undelivered, expired, deleted, and unknown | [optional]
10
10
  **from** | **String** | Phone number in E.164 format that sent the message. | [optional]
11
11
  **to** | **String** | Phone number in E.164 format that received the message. | [optional]
12
12
  **text** | **String** | Message contents | [optional]
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
10
10
  **max_length_sec** | **Integer** | Maximum length for the command execution in seconds. | [optional]
11
11
  **play_beep** | **Boolean** | Indicates whether to play a beep sound before the start of the recording. If set to `false`, no beep is played. | [optional]
12
12
  **auto_start** | **Boolean** | If `false`, recording begins immediately after the RecordUtterance command is processed. If `true`, recording begins when audio is present and if audio begins before the `maxLengthSec` timeout. If no audio begins before `maxLengthSec`, no recording is generated. | [optional]
13
+ **privacy_mode** | **Boolean** | Parameter `privacyMode` will not log the `text` as required by PCI compliance. | [optional]
13
14
 
14
15
  ## Code Sample
15
16
 
@@ -21,7 +22,8 @@ instance = Freeclimb::RecordUtterance.new(action_url: nil,
21
22
  finish_on_key: nil,
22
23
  max_length_sec: nil,
23
24
  play_beep: nil,
24
- auto_start: nil)
25
+ auto_start: nil,
26
+ privacy_mode: nil)
25
27
  ```
26
28
 
27
29
 
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
10
10
  **max_length_sec** | **Integer** | Maximum length for the command execution in seconds. | [optional]
11
11
  **play_beep** | **Boolean** | Indicates whether to play a beep sound before the start of the recording. If set to `false`, no beep is played. | [optional]
12
12
  **auto_start** | **Boolean** | If `false`, recording begins immediately after the RecordUtterance command is processed. If `true`, recording begins when audio is present and if audio begins before the `maxLengthSec` timeout. If no audio begins before `maxLengthSec`, no recording is generated. | [optional]
13
+ **privacy_mode** | **Boolean** | Parameter `privacyMode` will not log the `text` as required by PCI compliance. | [optional]
13
14
 
14
15
  ## Code Sample
15
16
 
@@ -21,7 +22,8 @@ instance = Freeclimb::RecordUtteranceAllOf.new(action_url: nil,
21
22
  finish_on_key: nil,
22
23
  max_length_sec: nil,
23
24
  play_beep: nil,
24
- auto_start: nil)
25
+ auto_start: nil,
26
+ privacy_mode: nil)
25
27
  ```
26
28
 
27
29
 
data/docs/Redirect.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Name | Type | Description | Notes
6
6
  ------------ | ------------- | ------------- | -------------
7
- **action_url** | **String** | Reason for the rejection. This can be any string value. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the call flows for the given application. | [optional]
7
+ **action_url** | **String** | URL to request a new PerCL script to continue with the current Call's processing. When `Redirect` invokes the `actionUrl`, an `inbound` Webhook is sent. This request therefore looks identical to the initial request (made to the `voiceUrl` of the number that was called) for an inbound Call. |
8
8
 
9
9
  ## Code Sample
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Name | Type | Description | Notes
6
6
  ------------ | ------------- | ------------- | -------------
7
- **action_url** | **String** | Reason for the rejection. This can be any string value. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the call flows for the given application. | [optional]
7
+ **action_url** | **String** | URL to request a new PerCL script to continue with the current Call's processing. When `Redirect` invokes the `actionUrl`, an `inbound` Webhook is sent. This request therefore looks identical to the initial request (made to the `voiceUrl` of the number that was called) for an inbound Call. |
8
8
 
9
9
  ## Code Sample
10
10
 
data/docs/Reject.md ADDED
@@ -0,0 +1,17 @@
1
+ # Freeclimb::Reject
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **reason** | **String** | Reason for the rejection. This can be any string value. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the call flows for the given application. | [optional]
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'freeclimb'
13
+
14
+ instance = Freeclimb::Reject.new(reason: nil)
15
+ ```
16
+
17
+
@@ -0,0 +1,17 @@
1
+ # Freeclimb::RejectAllOf
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **reason** | **String** | Reason for the rejection. This can be any string value. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the call flows for the given application. | [optional]
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'freeclimb'
13
+
14
+ instance = Freeclimb::RejectAllOf.new(reason: nil)
15
+ ```
16
+
17
+
Binary file
Binary file
Binary file
Binary file
data/lib/freeclimb.rb CHANGED
@@ -55,6 +55,8 @@ require 'freeclimb/models/get_digits'
55
55
  require 'freeclimb/models/get_digits_all_of'
56
56
  require 'freeclimb/models/get_speech'
57
57
  require 'freeclimb/models/get_speech_all_of'
58
+ require 'freeclimb/models/hangup'
59
+ require 'freeclimb/models/hangup_all_of'
58
60
  require 'freeclimb/models/incoming_number_list'
59
61
  require 'freeclimb/models/incoming_number_list_all_of'
60
62
  require 'freeclimb/models/incoming_number_request'
@@ -98,6 +100,8 @@ require 'freeclimb/models/recording_result'
98
100
  require 'freeclimb/models/recording_result_all_of'
99
101
  require 'freeclimb/models/redirect'
100
102
  require 'freeclimb/models/redirect_all_of'
103
+ require 'freeclimb/models/reject'
104
+ require 'freeclimb/models/reject_all_of'
101
105
  require 'freeclimb/models/remove_from_conference'
102
106
  require 'freeclimb/models/remove_from_conference_all_of'
103
107
  require 'freeclimb/models/say'
@@ -30,7 +30,7 @@ module Freeclimb
30
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
31
  def initialize(config = Configuration.default)
32
32
  @config = config
33
- @user_agent = "FreeClimbSDK/2.0.2/ruby"
33
+ @user_agent = "FreeClimbSDK/2.2.0/ruby"
34
34
  @default_headers = {
35
35
  'Content-Type' => 'application/json',
36
36
  'User-Agent' => @user_agent
@@ -29,8 +29,8 @@ module Freeclimb
29
29
  # String that uniquely identifies this account resource.
30
30
  attr_accessor :account_id
31
31
 
32
- # The authorization token assigned to this account. This token must be kept a secret by the customer.
33
- attr_accessor :auth_token
32
+ # The API key assigned to this account. This token must be kept a secret by the customer.
33
+ attr_accessor :api_key
34
34
 
35
35
  # A description for this account.
36
36
  attr_accessor :_alias
@@ -77,7 +77,7 @@ module Freeclimb
77
77
  :'date_updated' => :'dateUpdated',
78
78
  :'revision' => :'revision',
79
79
  :'account_id' => :'accountId',
80
- :'auth_token' => :'authToken',
80
+ :'api_key' => :'apiKey',
81
81
  :'_alias' => :'alias',
82
82
  :'label' => :'label',
83
83
  :'type' => :'type',
@@ -94,7 +94,7 @@ module Freeclimb
94
94
  :'date_updated' => :'String',
95
95
  :'revision' => :'Integer',
96
96
  :'account_id' => :'String',
97
- :'auth_token' => :'String',
97
+ :'api_key' => :'String',
98
98
  :'_alias' => :'String',
99
99
  :'label' => :'String',
100
100
  :'type' => :'String',
@@ -152,8 +152,8 @@ module Freeclimb
152
152
  self.account_id = attributes[:'account_id']
153
153
  end
154
154
 
155
- if attributes.key?(:'auth_token')
156
- self.auth_token = attributes[:'auth_token']
155
+ if attributes.key?(:'api_key')
156
+ self.api_key = attributes[:'api_key']
157
157
  end
158
158
 
159
159
  if attributes.key?(:'_alias')
@@ -212,7 +212,7 @@ module Freeclimb
212
212
  date_updated == o.date_updated &&
213
213
  revision == o.revision &&
214
214
  account_id == o.account_id &&
215
- auth_token == o.auth_token &&
215
+ api_key == o.api_key &&
216
216
  _alias == o._alias &&
217
217
  label == o.label &&
218
218
  type == o.type &&
@@ -229,7 +229,7 @@ module Freeclimb
229
229
  # Calculates hash code according to all attributes.
230
230
  # @return [Integer] Hash code
231
231
  def hash
232
- [uri, date_created, date_updated, revision, account_id, auth_token, _alias, label, type, status, subresource_uris].hash
232
+ [uri, date_created, date_updated, revision, account_id, api_key, _alias, label, type, status, subresource_uris].hash
233
233
  end
234
234
 
235
235
  # Builds the object from hash
@@ -17,8 +17,8 @@ module Freeclimb
17
17
  # String that uniquely identifies this account resource.
18
18
  attr_accessor :account_id
19
19
 
20
- # The authorization token assigned to this account. This token must be kept a secret by the customer.
21
- attr_accessor :auth_token
20
+ # The API key assigned to this account. This token must be kept a secret by the customer.
21
+ attr_accessor :api_key
22
22
 
23
23
  # A description for this account.
24
24
  attr_accessor :_alias
@@ -61,7 +61,7 @@ module Freeclimb
61
61
  def self.attribute_map
62
62
  {
63
63
  :'account_id' => :'accountId',
64
- :'auth_token' => :'authToken',
64
+ :'api_key' => :'apiKey',
65
65
  :'_alias' => :'alias',
66
66
  :'label' => :'label',
67
67
  :'type' => :'type',
@@ -74,7 +74,7 @@ module Freeclimb
74
74
  def self.openapi_types
75
75
  {
76
76
  :'account_id' => :'String',
77
- :'auth_token' => :'String',
77
+ :'api_key' => :'String',
78
78
  :'_alias' => :'String',
79
79
  :'label' => :'String',
80
80
  :'type' => :'String',
@@ -108,8 +108,8 @@ module Freeclimb
108
108
  self.account_id = attributes[:'account_id']
109
109
  end
110
110
 
111
- if attributes.key?(:'auth_token')
112
- self.auth_token = attributes[:'auth_token']
111
+ if attributes.key?(:'api_key')
112
+ self.api_key = attributes[:'api_key']
113
113
  end
114
114
 
115
115
  if attributes.key?(:'_alias')
@@ -164,7 +164,7 @@ module Freeclimb
164
164
  return true if self.equal?(o)
165
165
  self.class == o.class &&
166
166
  account_id == o.account_id &&
167
- auth_token == o.auth_token &&
167
+ api_key == o.api_key &&
168
168
  _alias == o._alias &&
169
169
  label == o.label &&
170
170
  type == o.type &&
@@ -181,7 +181,7 @@ module Freeclimb
181
181
  # Calculates hash code according to all attributes.
182
182
  # @return [Integer] Hash code
183
183
  def hash
184
- [account_id, auth_token, _alias, label, type, status, subresource_uris].hash
184
+ [account_id, api_key, _alias, label, type, status, subresource_uris].hash
185
185
  end
186
186
 
187
187
  # Builds the object from hash
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #FreeClimb API
3
+
4
+ #FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Freeclimb
16
+ # The `Hangup` command terminates a Call. If `Hangup` is used as the first action in a PerCL response, it does not prevent FreeClimb from answering the Call and billing your account. See the `Reject` command to hang up at no charge.
17
+ class Hangup < PerclCommand
18
+ # The user defined reason for the hangup. In general, applications should use a set of enumerated values that are predefined to cover all exit points of the Call flows for the given application.
19
+ attr_accessor :reason
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'reason' => :'reason'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'reason' => :'String'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # List of class defined in allOf (OpenAPI v3)
42
+ def self.openapi_all_of
43
+ [
44
+ :'HangupAllOf',
45
+ :'PerclCommand'
46
+ ]
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::Hangup` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::Hangup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ # call parent's initialize
65
+ super(attributes)
66
+
67
+ if attributes.key?(:'reason')
68
+ self.reason = attributes[:'reason']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = super
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true && super
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ reason == o.reason && super(o)
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [reason].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ new.build_from_hash(attributes)
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ super(attributes)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ Freeclimb.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = super
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end