pingram 1.0.42 → 1.0.44
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/pingram/api/account_api.rb +26 -0
- data/lib/pingram/api/accounts_api.rb +76 -0
- data/lib/pingram/api/broadcasts_api.rb +28 -0
- data/lib/pingram/api/default_api.rb +2 -0
- data/lib/pingram/api/domains_api.rb +12 -4
- data/lib/pingram/api/editor_api.rb +2 -0
- data/lib/pingram/api/email_api.rb +4 -0
- data/lib/pingram/api/environments_api.rb +2 -0
- data/lib/pingram/api/health_api.rb +2 -0
- data/lib/pingram/api/library_api.rb +4 -0
- data/lib/pingram/api/logs_api.rb +12 -0
- data/lib/pingram/api/members_api.rb +2 -0
- data/lib/pingram/api/numbers_api.rb +24 -2
- data/lib/pingram/api/registrations_api.rb +10 -0
- data/lib/pingram/api/sender_api.rb +2 -0
- data/lib/pingram/api/sms_api.rb +2 -0
- data/lib/pingram/api/sub_notifications_api.rb +4 -0
- data/lib/pingram/api/user_api.rb +6 -0
- data/lib/pingram/api/users_api.rb +2 -0
- data/lib/pingram/api/voice_api.rb +80 -0
- data/lib/pingram/api/webhooks_api.rb +8 -0
- data/lib/pingram/api_client.rb +1 -1
- data/lib/pingram/models/account_summary.rb +304 -0
- data/lib/pingram/models/agent.rb +10 -1
- data/lib/pingram/models/agent1.rb +10 -1
- data/lib/pingram/models/agent_agent_model.rb +2 -0
- data/lib/pingram/models/arm_voice_inbound_claim_request_inbound.rb +2 -0
- data/lib/pingram/models/brand_webhook_response.rb +1 -1
- data/lib/pingram/models/campaign_webhook_response.rb +1 -1
- data/lib/pingram/models/check_domain_dns_request.rb +148 -0
- data/lib/pingram/models/domain_dns_check_records_inner.rb +2 -2
- data/lib/pingram/models/elevenlabs.rb +207 -0
- data/lib/pingram/models/elevenlabs1.rb +207 -0
- data/lib/pingram/models/elevenlabs_eleven_realtime_v1_max.rb +251 -0
- data/lib/pingram/models/elevenlabs_eleven_realtime_v1_mini.rb +251 -0
- data/lib/pingram/models/get_senders_response_inner.rb +68 -4
- data/lib/pingram/models/get_senders_response_inner_verification_records.rb +13 -4
- data/lib/pingram/models/get_senders_response_inner_verification_records_dkim.rb +2 -2
- data/lib/pingram/models/get_voice_call_response_call.rb +30 -1
- data/lib/pingram/models/get_voice_call_response_call_setup.rb +252 -0
- data/lib/pingram/models/get_voice_call_response_call_setup_stream.rb +190 -0
- data/lib/pingram/models/google_gemini31_flash_live_preview.rb +22 -1
- data/lib/pingram/models/inbound_config.rb +2 -0
- data/lib/pingram/models/intercom_webhook.rb +1 -1
- data/lib/pingram/models/internal_transfer_body.rb +254 -0
- data/lib/pingram/models/internal_transfer_body_agent_meters_inner.rb +328 -0
- data/lib/pingram/models/list_voice_calls_response_calls_inner.rb +24 -4
- data/lib/pingram/models/member_update_request.rb +1 -1
- data/lib/pingram/models/openai_gpt_live1.rb +22 -1
- data/lib/pingram/models/openai_gpt_realtime21.rb +22 -1
- data/lib/pingram/models/openai_gpt_realtime21_mini.rb +22 -1
- data/lib/pingram/models/script.rb +10 -1
- data/lib/pingram/models/script1.rb +10 -1
- data/lib/pingram/models/script_privacy.rb +43 -8
- data/lib/pingram/models/script_stream.rb +193 -0
- data/lib/pingram/models/sign_in_username_response.rb +1 -1
- data/lib/pingram/models/sign_out_request.rb +1 -1
- data/lib/pingram/models/sms_compliance_countries_response_countries_inner.rb +1 -1
- data/lib/pingram/models/sms_compliance_country.rb +1 -1
- data/lib/pingram/models/stream.rb +207 -0
- data/lib/pingram/models/ten_dlc_brand_admin_update_request.rb +1 -1
- data/lib/pingram/models/transfer1.rb +40 -1
- data/lib/pingram/models/transfer_call_request.rb +196 -0
- data/lib/pingram/models/transfer_destinations_inner.rb +25 -56
- data/lib/pingram/models/update_account_request.rb +184 -0
- data/lib/pingram/models/voice_browser_call_request_config_any_of.rb +3 -1
- data/lib/pingram/models/voice_call_response.rb +32 -5
- data/lib/pingram/version.rb +1 -1
- data/lib/pingram.rb +14 -0
- data/vendor/bundle/ruby/3.2.0/cache/ethon-0.19.2.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/CHANGELOG.md +45 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/README.md +55 -8
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curl.rb +44 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.2/lib/ethon/easy/form.rb +261 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/informations.rb +30 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/mirror.rb +7 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/options.rb +11 -7
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/queryable.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.2/lib/ethon/errors/fork_safety.rb +10 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/libc.rb +5 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.2/lib/ethon/multipart.rb +115 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/version.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon.rb +1 -0
- data/vendor/bundle/ruby/3.2.0/specifications/{ethon-0.19.1.gemspec → ethon-0.19.2.gemspec} +4 -4
- metadata +103 -88
- data/vendor/bundle/ruby/3.2.0/cache/ethon-0.19.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/form.rb +0 -166
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/fork_safety.rb +0 -10
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/ethon.gemspec +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/classes.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/codes.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/constants.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/form_options.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/functions.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/infos.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/introspection.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/introspection_constants.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/messages.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/mime.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/optional.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/options.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/settings.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/share.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/share_constants.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/url.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/curls/url_constants.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/callbacks.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/debug_info.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/features.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/files.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/header.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/headers_api.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/actionable.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/custom.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/delete.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/get.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/head.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/options.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/patch.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/post.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/postable.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/put.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http/putable.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/http.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/mime.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/operations.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/params.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/response_callbacks.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/share.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/url.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy/util.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/easy.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/ethon_error.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/form_add.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/global_init.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/header.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/invalid_option.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/invalid_value.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/mime.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_add.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_assign.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_fdset.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_perform.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_poll.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_remove.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_timeout.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_wait.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/multi_wakeup.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/select.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/set_option.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/share.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/unsupported_option.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors/url.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/errors.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/loggable.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/multi/operations.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/multi/options.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/multi/stack.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.19.1 → ethon-0.19.2}/lib/ethon/multi.rb +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Pingram
|
|
3
|
+
|
|
4
|
+
#Internal API for notification delivery and management
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Pingram
|
|
17
|
+
# PATCH /accounts/{accountId} request: change the account display name.
|
|
18
|
+
class UpdateAccountRequest < ApiModelBase
|
|
19
|
+
# Display name for this account.
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'name' => :'name'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns attribute mapping this model knows about
|
|
30
|
+
def self.acceptable_attribute_map
|
|
31
|
+
attribute_map
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Returns all the JSON keys this model knows about
|
|
35
|
+
def self.acceptable_attributes
|
|
36
|
+
acceptable_attribute_map.values
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Attribute type mapping.
|
|
40
|
+
def self.openapi_types
|
|
41
|
+
{
|
|
42
|
+
:'name' => :'String'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# List of attributes with nullable: true
|
|
47
|
+
def self.openapi_nullable
|
|
48
|
+
Set.new([
|
|
49
|
+
])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Initializes the object
|
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
54
|
+
def initialize(attributes = {})
|
|
55
|
+
if (!attributes.is_a?(Hash))
|
|
56
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::UpdateAccountRequest` initialize method"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
60
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
62
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::UpdateAccountRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
64
|
+
end
|
|
65
|
+
h[k.to_sym] = v
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'name')
|
|
69
|
+
self.name = attributes[:'name']
|
|
70
|
+
else
|
|
71
|
+
self.name = nil
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
76
|
+
# @return Array for valid properties with the reasons
|
|
77
|
+
def list_invalid_properties
|
|
78
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
79
|
+
invalid_properties = Array.new
|
|
80
|
+
if @name.nil?
|
|
81
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if @name.to_s.length > 80
|
|
85
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 80.')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if @name.to_s.length < 1
|
|
89
|
+
invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
invalid_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Check to see if the all the properties in the model are valid
|
|
96
|
+
# @return true if the model is valid
|
|
97
|
+
def valid?
|
|
98
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
99
|
+
return false if @name.nil?
|
|
100
|
+
return false if @name.to_s.length > 80
|
|
101
|
+
return false if @name.to_s.length < 1
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Custom attribute writer method with validation
|
|
106
|
+
# @param [Object] name Value to be assigned
|
|
107
|
+
def name=(name)
|
|
108
|
+
if name.nil?
|
|
109
|
+
fail ArgumentError, 'name cannot be nil'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if name.to_s.length > 80
|
|
113
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 80.'
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if name.to_s.length < 1
|
|
117
|
+
fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
@name = name
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Checks equality by comparing each attribute.
|
|
124
|
+
# @param [Object] Object to be compared
|
|
125
|
+
def ==(o)
|
|
126
|
+
return true if self.equal?(o)
|
|
127
|
+
self.class == o.class &&
|
|
128
|
+
name == o.name
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# @see the `==` method
|
|
132
|
+
# @param [Object] Object to be compared
|
|
133
|
+
def eql?(o)
|
|
134
|
+
self == o
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Calculates hash code according to all attributes.
|
|
138
|
+
# @return [Integer] Hash code
|
|
139
|
+
def hash
|
|
140
|
+
[name].hash
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Builds the object from hash
|
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
145
|
+
# @return [Object] Returns the model itself
|
|
146
|
+
def self.build_from_hash(attributes)
|
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
|
148
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
149
|
+
transformed_hash = {}
|
|
150
|
+
openapi_types.each_pair do |key, type|
|
|
151
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
152
|
+
transformed_hash["#{key}"] = nil
|
|
153
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
154
|
+
# check to ensure the input is an array given that the attribute
|
|
155
|
+
# is documented as an array but the input is not
|
|
156
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
157
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
158
|
+
end
|
|
159
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
160
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
new(transformed_hash)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Returns the object in the form of hash
|
|
167
|
+
# @return [Hash] Returns the object in the form of hash
|
|
168
|
+
def to_hash
|
|
169
|
+
hash = {}
|
|
170
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
171
|
+
value = self.send(attr)
|
|
172
|
+
if value.nil?
|
|
173
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
174
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
hash[param] = _to_hash(value)
|
|
178
|
+
end
|
|
179
|
+
hash
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
end
|
|
@@ -18,14 +18,18 @@ module Pingram
|
|
|
18
18
|
# Stable tracking id — use with GET /voice/calls/{trackingId}.
|
|
19
19
|
attr_accessor :tracking_id
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# Call socket. The path id is the trackingId.
|
|
22
22
|
attr_accessor :websocket
|
|
23
23
|
|
|
24
|
+
# Token required on the call socket as ?token=
|
|
25
|
+
attr_accessor :token
|
|
26
|
+
|
|
24
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
28
|
def self.attribute_map
|
|
26
29
|
{
|
|
27
30
|
:'tracking_id' => :'trackingId',
|
|
28
|
-
:'websocket' => :'websocket'
|
|
31
|
+
:'websocket' => :'websocket',
|
|
32
|
+
:'token' => :'token'
|
|
29
33
|
}
|
|
30
34
|
end
|
|
31
35
|
|
|
@@ -43,7 +47,8 @@ module Pingram
|
|
|
43
47
|
def self.openapi_types
|
|
44
48
|
{
|
|
45
49
|
:'tracking_id' => :'String',
|
|
46
|
-
:'websocket' => :'String'
|
|
50
|
+
:'websocket' => :'String',
|
|
51
|
+
:'token' => :'String'
|
|
47
52
|
}
|
|
48
53
|
end
|
|
49
54
|
|
|
@@ -80,6 +85,12 @@ module Pingram
|
|
|
80
85
|
else
|
|
81
86
|
self.websocket = nil
|
|
82
87
|
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'token')
|
|
90
|
+
self.token = attributes[:'token']
|
|
91
|
+
else
|
|
92
|
+
self.token = nil
|
|
93
|
+
end
|
|
83
94
|
end
|
|
84
95
|
|
|
85
96
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -95,6 +106,10 @@ module Pingram
|
|
|
95
106
|
invalid_properties.push('invalid value for "websocket", websocket cannot be nil.')
|
|
96
107
|
end
|
|
97
108
|
|
|
109
|
+
if @token.nil?
|
|
110
|
+
invalid_properties.push('invalid value for "token", token cannot be nil.')
|
|
111
|
+
end
|
|
112
|
+
|
|
98
113
|
invalid_properties
|
|
99
114
|
end
|
|
100
115
|
|
|
@@ -104,6 +119,7 @@ module Pingram
|
|
|
104
119
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
105
120
|
return false if @tracking_id.nil?
|
|
106
121
|
return false if @websocket.nil?
|
|
122
|
+
return false if @token.nil?
|
|
107
123
|
true
|
|
108
124
|
end
|
|
109
125
|
|
|
@@ -127,13 +143,24 @@ module Pingram
|
|
|
127
143
|
@websocket = websocket
|
|
128
144
|
end
|
|
129
145
|
|
|
146
|
+
# Custom attribute writer method with validation
|
|
147
|
+
# @param [Object] token Value to be assigned
|
|
148
|
+
def token=(token)
|
|
149
|
+
if token.nil?
|
|
150
|
+
fail ArgumentError, 'token cannot be nil'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
@token = token
|
|
154
|
+
end
|
|
155
|
+
|
|
130
156
|
# Checks equality by comparing each attribute.
|
|
131
157
|
# @param [Object] Object to be compared
|
|
132
158
|
def ==(o)
|
|
133
159
|
return true if self.equal?(o)
|
|
134
160
|
self.class == o.class &&
|
|
135
161
|
tracking_id == o.tracking_id &&
|
|
136
|
-
websocket == o.websocket
|
|
162
|
+
websocket == o.websocket &&
|
|
163
|
+
token == o.token
|
|
137
164
|
end
|
|
138
165
|
|
|
139
166
|
# @see the `==` method
|
|
@@ -145,7 +172,7 @@ module Pingram
|
|
|
145
172
|
# Calculates hash code according to all attributes.
|
|
146
173
|
# @return [Integer] Hash code
|
|
147
174
|
def hash
|
|
148
|
-
[tracking_id, websocket].hash
|
|
175
|
+
[tracking_id, websocket, token].hash
|
|
149
176
|
end
|
|
150
177
|
|
|
151
178
|
# Builds the object from hash
|
data/lib/pingram/version.rb
CHANGED
data/lib/pingram.rb
CHANGED
|
@@ -27,6 +27,7 @@ require 'pingram/models/account_get_response_billing_alerts'
|
|
|
27
27
|
require 'pingram/models/account_patch_request'
|
|
28
28
|
require 'pingram/models/account_payment_methods'
|
|
29
29
|
require 'pingram/models/account_payment_methods_payment_methods_inner'
|
|
30
|
+
require 'pingram/models/account_summary'
|
|
30
31
|
require 'pingram/models/agent'
|
|
31
32
|
require 'pingram/models/agent1'
|
|
32
33
|
require 'pingram/models/agent_agent'
|
|
@@ -55,6 +56,7 @@ require 'pingram/models/campaign_webhook_response'
|
|
|
55
56
|
require 'pingram/models/cancel_subscription_request'
|
|
56
57
|
require 'pingram/models/change_phone_request'
|
|
57
58
|
require 'pingram/models/channels_enum'
|
|
59
|
+
require 'pingram/models/check_domain_dns_request'
|
|
58
60
|
require 'pingram/models/confirm_change_email_request'
|
|
59
61
|
require 'pingram/models/confirm_change_email_response'
|
|
60
62
|
require 'pingram/models/confirm_password_change_request'
|
|
@@ -78,6 +80,10 @@ require 'pingram/models/disconnect'
|
|
|
78
80
|
require 'pingram/models/domain_dns_check'
|
|
79
81
|
require 'pingram/models/domain_dns_check_records_inner'
|
|
80
82
|
require 'pingram/models/dtmf'
|
|
83
|
+
require 'pingram/models/elevenlabs'
|
|
84
|
+
require 'pingram/models/elevenlabs1'
|
|
85
|
+
require 'pingram/models/elevenlabs_eleven_realtime_v1_max'
|
|
86
|
+
require 'pingram/models/elevenlabs_eleven_realtime_v1_mini'
|
|
81
87
|
require 'pingram/models/email_auth_token_post_request'
|
|
82
88
|
require 'pingram/models/email_component_patch_request'
|
|
83
89
|
require 'pingram/models/email_component_post_request'
|
|
@@ -158,6 +164,8 @@ require 'pingram/models/get_voice_call_response'
|
|
|
158
164
|
require 'pingram/models/get_voice_call_response_call'
|
|
159
165
|
require 'pingram/models/get_voice_call_response_call_cost'
|
|
160
166
|
require 'pingram/models/get_voice_call_response_call_cost_lines_inner'
|
|
167
|
+
require 'pingram/models/get_voice_call_response_call_setup'
|
|
168
|
+
require 'pingram/models/get_voice_call_response_call_setup_stream'
|
|
161
169
|
require 'pingram/models/get_voice_call_response_call_timeline_inner'
|
|
162
170
|
require 'pingram/models/get_voice_call_response_call_timeline_inner_latency'
|
|
163
171
|
require 'pingram/models/google_gemini31_flash_live_preview'
|
|
@@ -182,6 +190,8 @@ require 'pingram/models/intercom_webhook_data_item_any_of_contacts'
|
|
|
182
190
|
require 'pingram/models/intercom_webhook_data_item_any_of_contacts_contacts_inner'
|
|
183
191
|
require 'pingram/models/intercom_webhook_data_item_any_of_source'
|
|
184
192
|
require 'pingram/models/intercom_webhook_data_item_any_of_source_author'
|
|
193
|
+
require 'pingram/models/internal_transfer_body'
|
|
194
|
+
require 'pingram/models/internal_transfer_body_agent_meters_inner'
|
|
185
195
|
require 'pingram/models/invite_post_response'
|
|
186
196
|
require 'pingram/models/knowledge'
|
|
187
197
|
require 'pingram/models/knowledge_documents_inner'
|
|
@@ -252,6 +262,7 @@ require 'pingram/models/script'
|
|
|
252
262
|
require 'pingram/models/script1'
|
|
253
263
|
require 'pingram/models/script_privacy'
|
|
254
264
|
require 'pingram/models/script_steps_inner'
|
|
265
|
+
require 'pingram/models/script_stream'
|
|
255
266
|
require 'pingram/models/search_available_phone_numbers_response'
|
|
256
267
|
require 'pingram/models/search_available_phone_numbers_response_numbers_inner'
|
|
257
268
|
require 'pingram/models/send_email_api_response'
|
|
@@ -318,6 +329,7 @@ require 'pingram/models/sms_sender_id_admin_update_request'
|
|
|
318
329
|
require 'pingram/models/sms_sender_id_create_request'
|
|
319
330
|
require 'pingram/models/start_change_email_request'
|
|
320
331
|
require 'pingram/models/start_password_change_request'
|
|
332
|
+
require 'pingram/models/stream'
|
|
321
333
|
require 'pingram/models/sub_notification'
|
|
322
334
|
require 'pingram/models/sub_notification_put_request'
|
|
323
335
|
require 'pingram/models/success_response'
|
|
@@ -344,7 +356,9 @@ require 'pingram/models/ten_dlc_campaign_registration_details'
|
|
|
344
356
|
require 'pingram/models/ten_dlc_campaign_update_request'
|
|
345
357
|
require 'pingram/models/transfer'
|
|
346
358
|
require 'pingram/models/transfer1'
|
|
359
|
+
require 'pingram/models/transfer_call_request'
|
|
347
360
|
require 'pingram/models/transfer_destinations_inner'
|
|
361
|
+
require 'pingram/models/update_account_request'
|
|
348
362
|
require 'pingram/models/update_billing_email_request'
|
|
349
363
|
require 'pingram/models/update_broadcast_request'
|
|
350
364
|
require 'pingram/models/user'
|
|
Binary file
|
|
@@ -2,7 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
## Master
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.19.
|
|
5
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.19.2...master)
|
|
6
|
+
|
|
7
|
+
## 0.19.2
|
|
8
|
+
|
|
9
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.19.1...v0.19.2)
|
|
10
|
+
|
|
11
|
+
### Fixes and hardening
|
|
12
|
+
|
|
13
|
+
* Clear `CURLOPT_POSTFIELDSIZE` to 0 instead of -1 when `Easy#postfields=` or
|
|
14
|
+
`Easy#copypostfields=` clears the body. With a size of -1 libcurl treats the
|
|
15
|
+
body as indeterminate, sends the POST chunked, and reads it from the default
|
|
16
|
+
read callback, which is stdin, so the request waited until stdin was closed.
|
|
17
|
+
([#463](https://github.com/typhoeus/ethon/issues/463))
|
|
18
|
+
|
|
19
|
+
### Enhancements
|
|
20
|
+
|
|
21
|
+
* Mirror `certinfo`, so the certificate chain read with `certinfo: true`
|
|
22
|
+
survives the handle reset and reaches Typhoeus responses
|
|
23
|
+
([typhoeus/typhoeus#427](https://github.com/typhoeus/typhoeus/issues/427))
|
|
24
|
+
|
|
25
|
+
* Expose `Easy#primary_port`, `Easy#local_ip`, `Easy#local_port`,
|
|
26
|
+
`Easy#ssl_verifyresult`, `Easy#num_connects`, `Easy#os_errno`,
|
|
27
|
+
`Easy#http_connectcode`, `Easy#proxyauth_avail`, `Easy#condition_unmet`,
|
|
28
|
+
`Easy#header_size` and `Easy#content_type`. They are also included in the
|
|
29
|
+
mirror, so they survive the handle reset and show up in response options.
|
|
30
|
+
Everything in the mirror is read for every response, so the deprecated
|
|
31
|
+
`filetime`, `lastsocket` and `content_length_*` values and the RTSP and FTP
|
|
32
|
+
entry informations are left out in favour of the `_t` and `activesocket`
|
|
33
|
+
variants that are already exposed.
|
|
34
|
+
([#460](https://github.com/typhoeus/ethon/pull/460))
|
|
35
|
+
|
|
36
|
+
* Add `Ethon::Multipart::Part` for setting the content type and, optionally,
|
|
37
|
+
the filename of a single `multipart/form-data` part. Plain body values keep
|
|
38
|
+
their existing behavior.
|
|
39
|
+
([typhoeus/typhoeus#494](https://github.com/typhoeus/typhoeus/issues/494))
|
|
40
|
+
|
|
41
|
+
* Add `Ethon::Curl.allow_handles_after_fork!`, an opt-in for servers that fork
|
|
42
|
+
workers from a process that has already used libcurl and cannot `exec`.
|
|
43
|
+
Called in the child before its first handle, it lets the child create new
|
|
44
|
+
handles on the libcurl state it inherited instead of raising
|
|
45
|
+
`Ethon::Errors::ForkSafety`. Handles created before the fork are still
|
|
46
|
+
rejected, as is `Ethon::Curl.cleanup` in the child, and the default is
|
|
47
|
+
unchanged. The opt-in is not supported on macOS, where it raises
|
|
48
|
+
`Ethon::Errors::ForkSafety` in a child whose parent initialized libcurl.
|
|
49
|
+
([#462](https://github.com/typhoeus/ethon/issues/462))
|
|
6
50
|
|
|
7
51
|
## 0.19.1
|
|
8
52
|
|
|
@@ -75,7 +75,29 @@ easy.perform
|
|
|
75
75
|
|
|
76
76
|
File values in a `:body` hash are sent as `multipart/form-data`. Ethon loads
|
|
77
77
|
the optional `mime-types` gem on the first upload to detect each part's content
|
|
78
|
-
type;
|
|
78
|
+
type; with it absent, files fall back to `application/octet-stream`.
|
|
79
|
+
|
|
80
|
+
Wrap a value in `Ethon::Multipart::Part` to set the content type for that part,
|
|
81
|
+
and optionally the filename. A String with a filename is sent as an in-memory
|
|
82
|
+
upload.
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
easy.http_request(
|
|
86
|
+
"www.example.com",
|
|
87
|
+
:post,
|
|
88
|
+
body: {
|
|
89
|
+
metadata: Ethon::Multipart::Part.new(
|
|
90
|
+
'{"a":1}',
|
|
91
|
+
content_type: "application/json"
|
|
92
|
+
),
|
|
93
|
+
file: Ethon::Multipart::Part.new(
|
|
94
|
+
File.open("photo.jpg"),
|
|
95
|
+
filename: "avatar.png",
|
|
96
|
+
content_type: "image/png"
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
```
|
|
79
101
|
|
|
80
102
|
## Parallel requests
|
|
81
103
|
|
|
@@ -228,13 +250,38 @@ With libcurl older than 7.84.0, create an Ethon handle before starting other
|
|
|
228
250
|
application threads so libcurl's global initialization happens while the
|
|
229
251
|
process is still single-threaded.
|
|
230
252
|
|
|
231
|
-
Ethon handles and initialized libcurl state must not be inherited
|
|
232
|
-
`fork`. If any `Easy` or `Multi` was created before forking, libcurl
|
|
233
|
-
initialized and the child cannot create new handles either; use
|
|
234
|
-
by `exec` in that case
|
|
235
|
-
all `Easy` and `Multi`
|
|
236
|
-
`Ethon::Errors::ForkSafety` when a child
|
|
237
|
-
state
|
|
253
|
+
Ethon handles and, by default, initialized libcurl state must not be inherited
|
|
254
|
+
across a `fork`. If any `Easy` or `Multi` was created before forking, libcurl
|
|
255
|
+
is already initialized and the child cannot create new handles either; use
|
|
256
|
+
`fork` followed by `exec` in that case, or opt in as described below. If
|
|
257
|
+
libcurl was not initialized before forking, create all `Easy` and `Multi`
|
|
258
|
+
instances after the fork. Ethon raises `Ethon::Errors::ForkSafety` when a child
|
|
259
|
+
process tries to use an inherited handle, or to use inherited libcurl state
|
|
260
|
+
without opting in.
|
|
261
|
+
|
|
262
|
+
A server that forks workers from a process that has already used libcurl, such
|
|
263
|
+
as Pitchfork with reforking or Puma with `fork_worker`, cannot `exec` without
|
|
264
|
+
losing the memory its workers share with that process. Instead, each worker can
|
|
265
|
+
opt in to creating new handles on the libcurl state it inherited. Call
|
|
266
|
+
`Ethon::Curl.allow_handles_after_fork!` in the worker before it creates its
|
|
267
|
+
first handle and before any other thread uses Ethon, for example from
|
|
268
|
+
Pitchfork's `after_worker_fork` hook:
|
|
269
|
+
|
|
270
|
+
```ruby
|
|
271
|
+
after_worker_fork do |_server, _worker|
|
|
272
|
+
Ethon::Curl.allow_handles_after_fork!
|
|
273
|
+
end
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Puma's equivalent hook is `before_worker_boot` (`on_worker_boot` before
|
|
277
|
+
Puma 7). Repeat calls in the same worker do nothing. The worker does not
|
|
278
|
+
initialize libcurl again, and it cannot clean up the libcurl state it
|
|
279
|
+
inherited: `Ethon::Curl.cleanup` raises `Ethon::Errors::ForkSafety` there, as
|
|
280
|
+
handles created before the fork still do. On macOS, system frameworks are not
|
|
281
|
+
safe to use after `fork` without `exec`, and libcurl can use them, for example
|
|
282
|
+
for TLS. The opt-in is not supported there and raises
|
|
283
|
+
`Ethon::Errors::ForkSafety` in a worker whose parent initialized libcurl, so
|
|
284
|
+
use `fork` followed by `exec` on macOS.
|
|
238
285
|
|
|
239
286
|
## License
|
|
240
287
|
|
|
@@ -26,6 +26,11 @@ module Ethon
|
|
|
26
26
|
Libc.windows?
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# :nodoc:
|
|
30
|
+
def self.macos?
|
|
31
|
+
Libc.macos?
|
|
32
|
+
end
|
|
33
|
+
|
|
29
34
|
require 'ethon/curls/constants'
|
|
30
35
|
require 'ethon/curls/introspection_constants'
|
|
31
36
|
require 'ethon/curls/settings'
|
|
@@ -36,6 +41,7 @@ module Ethon
|
|
|
36
41
|
@blocking = true
|
|
37
42
|
|
|
38
43
|
@@initialized = false
|
|
44
|
+
@@initialized_pid = nil
|
|
39
45
|
@@loaded_pid = Process.pid
|
|
40
46
|
@@curl_mutex = Mutex.new
|
|
41
47
|
|
|
@@ -70,6 +76,7 @@ module Ethon
|
|
|
70
76
|
if not @@initialized
|
|
71
77
|
raise Errors::GlobalInit.new if Curl.global_init(GLOBAL_ALL) != 0
|
|
72
78
|
@@initialized = true
|
|
79
|
+
@@initialized_pid = Process.pid
|
|
73
80
|
Ethon.logger.debug("ETHON: Libcurl initialized") if Ethon.logger
|
|
74
81
|
end
|
|
75
82
|
}
|
|
@@ -85,10 +92,19 @@ module Ethon
|
|
|
85
92
|
# any other thread that uses these other libraries.
|
|
86
93
|
# See the description in libcurl of global environment requirements
|
|
87
94
|
# for details of how to use this function.
|
|
95
|
+
#
|
|
96
|
+
# @raise [ Ethon::Errors::ForkSafety ] In a child that opted in with
|
|
97
|
+
# allow_handles_after_fork! and inherited libcurl initialized by its
|
|
98
|
+
# parent.
|
|
88
99
|
def cleanup
|
|
89
100
|
check_pid!
|
|
90
101
|
@@curl_mutex.synchronize {
|
|
91
102
|
if @@initialized
|
|
103
|
+
if @@initialized_pid != Process.pid
|
|
104
|
+
raise Errors::ForkSafety.new(
|
|
105
|
+
"Ethon cannot clean up libcurl initialized before a fork; clean it up in the process that initialized it"
|
|
106
|
+
)
|
|
107
|
+
end
|
|
92
108
|
Curl.global_cleanup()
|
|
93
109
|
@@initialized = false
|
|
94
110
|
Ethon.logger.debug("ETHON: Libcurl cleanup") if Ethon.logger
|
|
@@ -105,6 +121,34 @@ module Ethon
|
|
|
105
121
|
@@curl_mutex = Mutex.new
|
|
106
122
|
end
|
|
107
123
|
|
|
124
|
+
# Let a forked child create new handles on the libcurl state it
|
|
125
|
+
# inherited. Call it in the child before its first handle; repeat calls
|
|
126
|
+
# do nothing. Handles created before the fork still raise ForkSafety,
|
|
127
|
+
# and so does cleanup, because the child did not initialize libcurl.
|
|
128
|
+
#
|
|
129
|
+
# @example Opt in from a Pitchfork worker's after_worker_fork hook.
|
|
130
|
+
# Ethon::Curl.allow_handles_after_fork!
|
|
131
|
+
#
|
|
132
|
+
# @raise [ Ethon::Errors::ForkSafety ] On macOS, in a child whose parent
|
|
133
|
+
# initialized libcurl.
|
|
134
|
+
#
|
|
135
|
+
# @api public
|
|
136
|
+
def allow_handles_after_fork!
|
|
137
|
+
return if @@loaded_pid == Process.pid
|
|
138
|
+
|
|
139
|
+
if @@initialized && macos?
|
|
140
|
+
raise Errors::ForkSafety.new(
|
|
141
|
+
"Ethon cannot use libcurl inherited across a fork on macOS; use fork+exec"
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Leave @@initialized set: the child inherited the parent's libcurl
|
|
146
|
+
# global state, so it must not run curl_global_init again.
|
|
147
|
+
@@loaded_pid = Process.pid
|
|
148
|
+
@@curl_mutex = Mutex.new
|
|
149
|
+
nil
|
|
150
|
+
end
|
|
151
|
+
|
|
108
152
|
end
|
|
109
153
|
end
|
|
110
154
|
end
|