freeclimb 2.1.2 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile +0 -1
- data/README.md +6 -5
- data/docs/AccountResult.md +2 -2
- data/docs/AccountResultAllOf.md +2 -2
- data/docs/AddToConference.md +1 -1
- data/docs/AddToConferenceAllOf.md +1 -1
- data/docs/AvailableNumber.md +0 -2
- data/docs/DefaultApi.md +73 -51
- data/lib/freeclimb/api/default_api.rb +33 -3
- data/lib/freeclimb/api_client.rb +1 -1
- data/lib/freeclimb/models/account_result.rb +8 -8
- data/lib/freeclimb/models/account_result_all_of.rb +8 -8
- data/lib/freeclimb/models/add_to_conference.rb +0 -5
- data/lib/freeclimb/models/add_to_conference_all_of.rb +0 -5
- data/lib/freeclimb/models/available_number.rb +1 -11
- data/lib/freeclimb/models/percl_command.rb +1 -0
- data/lib/freeclimb/utils.rb +34 -0
- data/lib/freeclimb/version.rb +1 -1
- data/spec/api/default_api_spec.rb +119 -675
- data/spec/api/web_mocks.rb +1 -1
- data/spec/api_client_spec.rb +3 -3
- data/spec/configuration_spec.rb +18 -10
- data/spec/models/account_request_spec.rb +19 -5
- data/spec/models/account_result_all_of_spec.rb +81 -0
- data/spec/models/account_result_spec.rb +77 -5
- data/spec/models/add_to_conference_all_of_spec.rb +95 -0
- data/spec/models/add_to_conference_spec.rb +2 -2
- data/spec/models/application_list_all_of_spec.rb +41 -0
- data/spec/models/application_list_spec.rb +55 -5
- data/spec/models/application_request_spec.rb +49 -5
- data/spec/models/application_result_all_of_spec.rb +89 -0
- data/spec/models/application_result_spec.rb +85 -5
- data/spec/models/available_number_list_all_of_spec.rb +41 -0
- data/spec/models/available_number_list_spec.rb +55 -6
- data/spec/models/available_number_spec.rb +37 -5
- data/spec/models/buy_incoming_number_request_spec.rb +25 -5
- data/spec/models/call_list_all_of_spec.rb +41 -0
- data/spec/models/call_list_spec.rb +55 -6
- data/spec/models/call_result_all_of_spec.rb +129 -0
- data/spec/models/call_result_spec.rb +124 -5
- data/spec/models/conference_list_all_of_spec.rb +41 -0
- data/spec/models/conference_list_spec.rb +55 -5
- data/spec/models/conference_participant_list_all_of_spec.rb +41 -0
- data/spec/models/conference_participant_list_spec.rb +55 -5
- data/spec/models/conference_participant_result_all_of_spec.rb +71 -0
- data/spec/models/conference_participant_result_spec.rb +67 -5
- data/spec/models/conference_result_all_of_spec.rb +103 -0
- data/spec/models/conference_result_spec.rb +99 -6
- data/spec/models/create_conference_all_of_spec.rb +71 -0
- data/spec/models/create_conference_request_spec.rb +41 -6
- data/spec/models/create_conference_spec.rb +2 -2
- data/spec/models/dequeue_spec.rb +2 -2
- data/spec/models/enqueue_all_of_spec.rb +59 -0
- data/spec/models/enqueue_spec.rb +2 -2
- data/spec/models/filter_logs_request_spec.rb +13 -5
- data/spec/models/get_digits_all_of_spec.rb +89 -0
- data/spec/models/get_digits_spec.rb +8 -2
- data/spec/models/get_speech_all_of_spec.rb +113 -0
- data/spec/models/get_speech_spec.rb +3 -3
- data/spec/models/hangup_all_of_spec.rb +41 -0
- data/spec/models/incoming_number_list_all_of_spec.rb +41 -0
- data/spec/models/incoming_number_list_spec.rb +55 -6
- data/spec/models/incoming_number_request_spec.rb +19 -5
- data/spec/models/incoming_number_result_all_of_spec.rb +89 -0
- data/spec/models/incoming_number_result_spec.rb +85 -6
- data/spec/models/log_list_all_of_spec.rb +41 -0
- data/spec/models/log_list_spec.rb +55 -5
- data/spec/models/log_result_spec.rb +53 -5
- data/spec/models/make_call_request_spec.rb +67 -5
- data/spec/models/message_request_all_of_spec.rb +65 -0
- data/spec/models/message_request_spec.rb +61 -6
- data/spec/models/message_result_all_of_spec.rb +87 -0
- data/spec/models/message_result_spec.rb +83 -5
- data/spec/models/messages_list_all_of_spec.rb +41 -0
- data/spec/models/messages_list_spec.rb +55 -5
- data/spec/models/mutable_resource_model_spec.rb +31 -6
- data/spec/models/out_dial_all_of_spec.rb +95 -0
- data/spec/models/out_dial_spec.rb +8 -2
- data/spec/models/pagination_model_spec.rb +49 -5
- data/spec/models/pause_all_of_spec.rb +41 -0
- data/spec/models/pause_spec.rb +2 -2
- data/spec/models/percl_command_spec.rb +2 -2
- data/spec/models/percl_script_spec.rb +2 -2
- data/spec/models/play_all_of_spec.rb +59 -0
- data/spec/models/play_early_media_all_of_spec.rb +41 -0
- data/spec/models/play_early_media_spec.rb +2 -2
- data/spec/models/play_spec.rb +8 -2
- data/spec/models/queue_list_all_of_spec.rb +41 -0
- data/spec/models/queue_list_spec.rb +54 -5
- data/spec/models/queue_member_list_all_of_spec.rb +41 -0
- data/spec/models/queue_member_list_spec.rb +55 -5
- data/spec/models/queue_member_spec.rb +37 -6
- data/spec/models/queue_request_spec.rb +19 -6
- data/spec/models/queue_result_all_of_spec.rb +77 -0
- data/spec/models/queue_result_spec.rb +73 -5
- data/spec/models/record_utterance_all_of_spec.rb +77 -0
- data/spec/models/record_utterance_spec.rb +8 -2
- data/spec/models/recording_list_all_of_spec.rb +41 -0
- data/spec/models/recording_list_spec.rb +55 -5
- data/spec/models/recording_result_all_of_spec.rb +65 -0
- data/spec/models/recording_result_spec.rb +61 -5
- data/spec/models/redirect_all_of_spec.rb +41 -0
- data/spec/models/redirect_spec.rb +2 -2
- data/spec/models/reject_all_of_spec.rb +41 -0
- data/spec/models/remove_from_conference_all_of_spec.rb +41 -0
- data/spec/models/remove_from_conference_spec.rb +2 -2
- data/spec/models/say_all_of_spec.rb +65 -0
- data/spec/models/say_spec.rb +3 -3
- data/spec/models/send_digits_all_of_spec.rb +53 -0
- data/spec/models/send_digits_spec.rb +8 -2
- data/spec/models/set_listen_all_of_spec.rb +47 -0
- data/spec/models/set_listen_spec.rb +2 -2
- data/spec/models/set_talk_all_of_spec.rb +47 -0
- data/spec/models/set_talk_spec.rb +2 -2
- data/spec/models/sms_all_of_spec.rb +59 -0
- data/spec/models/sms_spec.rb +2 -2
- data/spec/models/start_record_call_spec.rb +2 -2
- data/spec/models/terminate_conference_all_of_spec.rb +41 -0
- data/spec/models/terminate_conference_spec.rb +2 -2
- data/spec/models/update_call_request_spec.rb +17 -5
- data/spec/models/update_conference_participant_request_spec.rb +19 -5
- data/spec/models/update_conference_request_spec.rb +29 -5
- data/spec/spec_helper.rb +4 -7
- metadata +85 -5
- data/freeclimb-2.0.3.gem +0 -0
- data/freeclimb-2.1.0.gem +0 -0
- data/freeclimb-2.1.1.gem +0 -0
@@ -1171,6 +1171,12 @@ module Freeclimb
|
|
1171
1171
|
# Get an Incoming Number
|
1172
1172
|
# @param phone_number_id [String] String that uniquely identifies this phone number resource.
|
1173
1173
|
# @param [Hash] opts the optional parameters
|
1174
|
+
# @option opts [String] :region State or province of this phone number.
|
1175
|
+
# @option opts [String] :country Country of this phone number.
|
1176
|
+
# @option opts [Boolean] :voice_enabled Indicates whether the phone number can handle Calls. Typically set to true for all numbers. (default to true)
|
1177
|
+
# @option opts [Boolean] :sms_enabled Indication of whether the phone number can handle sending and receiving SMS messages. Typically set to true for all numbers. (default to true)
|
1178
|
+
# @option opts [String] :application_id ID of the Application that FreeClimb should contact if a Call or SMS arrives for this phone number or a Call from this number is placed. An incoming phone number is not useful until associated with an applicationId.
|
1179
|
+
# @option opts [Boolean] :has_application Indication of whether the phone number has an application linked to it. (default to false)
|
1174
1180
|
# @return [IncomingNumberResult]
|
1175
1181
|
def get_an_incoming_number(phone_number_id, opts = {})
|
1176
1182
|
data, _status_code, _headers = get_an_incoming_number_with_http_info(phone_number_id, opts)
|
@@ -1180,6 +1186,12 @@ module Freeclimb
|
|
1180
1186
|
# Get an Incoming Number
|
1181
1187
|
# @param phone_number_id [String] String that uniquely identifies this phone number resource.
|
1182
1188
|
# @param [Hash] opts the optional parameters
|
1189
|
+
# @option opts [String] :region State or province of this phone number.
|
1190
|
+
# @option opts [String] :country Country of this phone number.
|
1191
|
+
# @option opts [Boolean] :voice_enabled Indicates whether the phone number can handle Calls. Typically set to true for all numbers.
|
1192
|
+
# @option opts [Boolean] :sms_enabled Indication of whether the phone number can handle sending and receiving SMS messages. Typically set to true for all numbers.
|
1193
|
+
# @option opts [String] :application_id ID of the Application that FreeClimb should contact if a Call or SMS arrives for this phone number or a Call from this number is placed. An incoming phone number is not useful until associated with an applicationId.
|
1194
|
+
# @option opts [Boolean] :has_application Indication of whether the phone number has an application linked to it.
|
1183
1195
|
# @return [Array<(IncomingNumberResult, Integer, Hash)>] IncomingNumberResult data, response status code and response headers
|
1184
1196
|
def get_an_incoming_number_with_http_info(phone_number_id, opts = {})
|
1185
1197
|
if @api_client.config.debugging
|
@@ -1194,6 +1206,12 @@ module Freeclimb
|
|
1194
1206
|
|
1195
1207
|
# query parameters
|
1196
1208
|
query_params = opts[:query_params] || {}
|
1209
|
+
query_params[:'region'] = opts[:'region'] if !opts[:'region'].nil?
|
1210
|
+
query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
|
1211
|
+
query_params[:'voiceEnabled'] = opts[:'voice_enabled'] if !opts[:'voice_enabled'].nil?
|
1212
|
+
query_params[:'smsEnabled'] = opts[:'sms_enabled'] if !opts[:'sms_enabled'].nil?
|
1213
|
+
query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?
|
1214
|
+
query_params[:'hasApplication'] = opts[:'has_application'] if !opts[:'has_application'].nil?
|
1197
1215
|
|
1198
1216
|
# header parameters
|
1199
1217
|
header_params = opts[:header_params] || {}
|
@@ -1518,8 +1536,11 @@ module Freeclimb
|
|
1518
1536
|
|
1519
1537
|
# List available numbers
|
1520
1538
|
# @param [Hash] opts the optional parameters
|
1521
|
-
# @option opts [String] :_alias Filter on numbers based on the formatted string of the phone number.
|
1522
1539
|
# @option opts [String] :phone_number PCRE-compatible regular expression to filter against `phoneNumber` field, which is in E.164 format.
|
1540
|
+
# @option opts [String] :region State or province of this phone number.
|
1541
|
+
# @option opts [String] :country Country of this phone number.
|
1542
|
+
# @option opts [Boolean] :voice_enabled Indicates whether the phone number can handle Calls. Typically set to true for all numbers. (default to true)
|
1543
|
+
# @option opts [Boolean] :sms_enabled Indication of whether the phone number can handle sending and receiving SMS messages. Typically set to true for all numbers. (default to true)
|
1523
1544
|
# @return [AvailableNumberList]
|
1524
1545
|
def list_available_numbers(opts = {})
|
1525
1546
|
data, _status_code, _headers = list_available_numbers_with_http_info(opts)
|
@@ -1528,8 +1549,11 @@ module Freeclimb
|
|
1528
1549
|
|
1529
1550
|
# List available numbers
|
1530
1551
|
# @param [Hash] opts the optional parameters
|
1531
|
-
# @option opts [String] :_alias Filter on numbers based on the formatted string of the phone number.
|
1532
1552
|
# @option opts [String] :phone_number PCRE-compatible regular expression to filter against `phoneNumber` field, which is in E.164 format.
|
1553
|
+
# @option opts [String] :region State or province of this phone number.
|
1554
|
+
# @option opts [String] :country Country of this phone number.
|
1555
|
+
# @option opts [Boolean] :voice_enabled Indicates whether the phone number can handle Calls. Typically set to true for all numbers.
|
1556
|
+
# @option opts [Boolean] :sms_enabled Indication of whether the phone number can handle sending and receiving SMS messages. Typically set to true for all numbers.
|
1533
1557
|
# @return [Array<(AvailableNumberList, Integer, Hash)>] AvailableNumberList data, response status code and response headers
|
1534
1558
|
def list_available_numbers_with_http_info(opts = {})
|
1535
1559
|
if @api_client.config.debugging
|
@@ -1540,8 +1564,11 @@ module Freeclimb
|
|
1540
1564
|
|
1541
1565
|
# query parameters
|
1542
1566
|
query_params = opts[:query_params] || {}
|
1543
|
-
query_params[:'alias'] = opts[:'_alias'] if !opts[:'_alias'].nil?
|
1544
1567
|
query_params[:'phoneNumber'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
|
1568
|
+
query_params[:'region'] = opts[:'region'] if !opts[:'region'].nil?
|
1569
|
+
query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
|
1570
|
+
query_params[:'voiceEnabled'] = opts[:'voice_enabled'] if !opts[:'voice_enabled'].nil?
|
1571
|
+
query_params[:'smsEnabled'] = opts[:'sms_enabled'] if !opts[:'sms_enabled'].nil?
|
1545
1572
|
|
1546
1573
|
# header parameters
|
1547
1574
|
header_params = opts[:header_params] || {}
|
@@ -1701,6 +1728,7 @@ module Freeclimb
|
|
1701
1728
|
|
1702
1729
|
# List Calls
|
1703
1730
|
# @param [Hash] opts the optional parameters
|
1731
|
+
# @option opts [Boolean] :active If active is set to true then all calls of the nature queued, ringing, inProgress are returned in the query. (default to false)
|
1704
1732
|
# @option opts [String] :to Only show Calls to this phone number.
|
1705
1733
|
# @option opts [String] :from Only show Calls from this phone number.
|
1706
1734
|
# @option opts [String] :status Only show Calls currently in this status. May be `queued`, `ringing`, `inProgress`, `canceled`, `completed`, `failed`, `busy`, or `noAnswer`.
|
@@ -1715,6 +1743,7 @@ module Freeclimb
|
|
1715
1743
|
|
1716
1744
|
# List Calls
|
1717
1745
|
# @param [Hash] opts the optional parameters
|
1746
|
+
# @option opts [Boolean] :active If active is set to true then all calls of the nature queued, ringing, inProgress are returned in the query.
|
1718
1747
|
# @option opts [String] :to Only show Calls to this phone number.
|
1719
1748
|
# @option opts [String] :from Only show Calls from this phone number.
|
1720
1749
|
# @option opts [String] :status Only show Calls currently in this status. May be `queued`, `ringing`, `inProgress`, `canceled`, `completed`, `failed`, `busy`, or `noAnswer`.
|
@@ -1731,6 +1760,7 @@ module Freeclimb
|
|
1731
1760
|
|
1732
1761
|
# query parameters
|
1733
1762
|
query_params = opts[:query_params] || {}
|
1763
|
+
query_params[:'active'] = opts[:'active'] if !opts[:'active'].nil?
|
1734
1764
|
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
|
1735
1765
|
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
|
1736
1766
|
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
data/lib/freeclimb/api_client.rb
CHANGED
@@ -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/
|
33
|
+
@user_agent = "FreeClimbSDK/3.0.2/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
|
33
|
-
attr_accessor :
|
32
|
+
# The API key assigned to this account. This key 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
|
-
:'
|
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
|
-
:'
|
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?(:'
|
156
|
-
self.
|
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
|
-
|
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,
|
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
|
21
|
-
attr_accessor :
|
20
|
+
# The API key assigned to this account. This key 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
|
-
:'
|
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
|
-
:'
|
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?(:'
|
112
|
-
self.
|
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
|
-
|
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,
|
184
|
+
[account_id, api_key, _alias, label, type, status, subresource_uris].hash
|
185
185
|
end
|
186
186
|
|
187
187
|
# Builds the object from hash
|
@@ -158,10 +158,6 @@ module Freeclimb
|
|
158
158
|
invalid_properties.push('invalid value for "conference_id", conference_id cannot be nil.')
|
159
159
|
end
|
160
160
|
|
161
|
-
if @call_id.nil?
|
162
|
-
invalid_properties.push('invalid value for "call_id", call_id cannot be nil.')
|
163
|
-
end
|
164
|
-
|
165
161
|
invalid_properties
|
166
162
|
end
|
167
163
|
|
@@ -169,7 +165,6 @@ module Freeclimb
|
|
169
165
|
# @return true if the model is valid
|
170
166
|
def valid?
|
171
167
|
return false if @conference_id.nil?
|
172
|
-
return false if @call_id.nil?
|
173
168
|
true && super
|
174
169
|
end
|
175
170
|
|
@@ -146,10 +146,6 @@ module Freeclimb
|
|
146
146
|
invalid_properties.push('invalid value for "conference_id", conference_id cannot be nil.')
|
147
147
|
end
|
148
148
|
|
149
|
-
if @call_id.nil?
|
150
|
-
invalid_properties.push('invalid value for "call_id", call_id cannot be nil.')
|
151
|
-
end
|
152
|
-
|
153
149
|
invalid_properties
|
154
150
|
end
|
155
151
|
|
@@ -157,7 +153,6 @@ module Freeclimb
|
|
157
153
|
# @return true if the model is valid
|
158
154
|
def valid?
|
159
155
|
return false if @conference_id.nil?
|
160
|
-
return false if @call_id.nil?
|
161
156
|
true
|
162
157
|
end
|
163
158
|
|
@@ -23,9 +23,6 @@ module Freeclimb
|
|
23
23
|
# Indicates whether the phone number can send and receive SMS messages.
|
24
24
|
attr_accessor :sms_enabled
|
25
25
|
|
26
|
-
# A nicely-formatted version of the phone number.
|
27
|
-
attr_accessor :_alias
|
28
|
-
|
29
26
|
# The state or province of this phone number.
|
30
27
|
attr_accessor :region
|
31
28
|
|
@@ -38,7 +35,6 @@ module Freeclimb
|
|
38
35
|
:'phone_number' => :'phoneNumber',
|
39
36
|
:'voice_enabled' => :'voiceEnabled',
|
40
37
|
:'sms_enabled' => :'smsEnabled',
|
41
|
-
:'_alias' => :'alias',
|
42
38
|
:'region' => :'region',
|
43
39
|
:'country' => :'country'
|
44
40
|
}
|
@@ -50,7 +46,6 @@ module Freeclimb
|
|
50
46
|
:'phone_number' => :'String',
|
51
47
|
:'voice_enabled' => :'Boolean',
|
52
48
|
:'sms_enabled' => :'Boolean',
|
53
|
-
:'_alias' => :'String',
|
54
49
|
:'region' => :'String',
|
55
50
|
:'country' => :'String'
|
56
51
|
}
|
@@ -89,10 +84,6 @@ module Freeclimb
|
|
89
84
|
self.sms_enabled = attributes[:'sms_enabled']
|
90
85
|
end
|
91
86
|
|
92
|
-
if attributes.key?(:'_alias')
|
93
|
-
self._alias = attributes[:'_alias']
|
94
|
-
end
|
95
|
-
|
96
87
|
if attributes.key?(:'region')
|
97
88
|
self.region = attributes[:'region']
|
98
89
|
end
|
@@ -123,7 +114,6 @@ module Freeclimb
|
|
123
114
|
phone_number == o.phone_number &&
|
124
115
|
voice_enabled == o.voice_enabled &&
|
125
116
|
sms_enabled == o.sms_enabled &&
|
126
|
-
_alias == o._alias &&
|
127
117
|
region == o.region &&
|
128
118
|
country == o.country
|
129
119
|
end
|
@@ -137,7 +127,7 @@ module Freeclimb
|
|
137
127
|
# Calculates hash code according to all attributes.
|
138
128
|
# @return [Integer] Hash code
|
139
129
|
def hash
|
140
|
-
[phone_number, voice_enabled, sms_enabled,
|
130
|
+
[phone_number, voice_enabled, sms_enabled, region, country].hash
|
141
131
|
end
|
142
132
|
|
143
133
|
# Builds the object from hash
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'cgi'
|
3
|
+
require 'date'
|
4
|
+
require 'openssl'
|
5
|
+
|
6
|
+
module FreeClimb
|
7
|
+
class Utils
|
8
|
+
def self.verify_request(requestBody, signatureHeader, signingSecret, tolerance=5*60*1000)
|
9
|
+
signatureArr = signatureHeader.split(',')
|
10
|
+
signatureHash = {}
|
11
|
+
signatureArr.each { |queryStr|
|
12
|
+
hash = CGI.parse(queryStr)
|
13
|
+
if (signatureHash.key?(hash.keys[0]))
|
14
|
+
signatureHash[hash.keys[0]] = [signatureHash[hash.keys[0]]].append(hash.values[0][0])
|
15
|
+
else
|
16
|
+
signatureHash[hash.keys[0]] = hash.values[0][0]
|
17
|
+
end
|
18
|
+
}
|
19
|
+
|
20
|
+
currentTime = DateTime.now.strftime('%s')
|
21
|
+
signatureAge = currentTime.to_i - signatureHash["t"].to_i
|
22
|
+
if (tolerance < signatureAge)
|
23
|
+
raise StandardError.new "Request rejected - signature's timestamp failed against current tolerance of #{tolerance} milliseconds. Signature age: #{signatureAge} milliseconds";
|
24
|
+
end
|
25
|
+
|
26
|
+
data = signatureHash["t"] + "." + requestBody
|
27
|
+
hmac = OpenSSL::HMAC.hexdigest('sha256', signingSecret, data)
|
28
|
+
|
29
|
+
if (!signatureHash["v1"].include? hmac)
|
30
|
+
raise StandardError.new "Unverified Request Signature - FreeClimb was unable to verify that this request originated from FreeClimb. If this request was unexpected, it may be from a bad actor. Please proceed with caution. If this request was expected, to fix this issue try checking for any typos or misspelling of your signing secret.";
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/freeclimb/version.rb
CHANGED