From f957239e9687ee4b8fcf229cba988c1c528eafc9 Mon Sep 17 00:00:00 2001 From: ignacio-chiazzo Date: Sat, 31 Aug 2024 20:25:42 -0300 Subject: [PATCH 1/5] remove sorbet sigs from tests/ --- test/whatsapp/api/medias_test.rb | 2 +- test/whatsapp/contact_helper.rb | 10 ---------- test/whatsapp/resource/parameter_object_test.rb | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/test/whatsapp/api/medias_test.rb b/test/whatsapp/api/medias_test.rb index 00887e7..1ee91bf 100644 --- a/test/whatsapp/api/medias_test.rb +++ b/test/whatsapp/api/medias_test.rb @@ -95,7 +95,7 @@ def test_upload_media_sends_valid_params type = "image/png" file_part = mock - T.unsafe(Faraday::FilePart).stubs(:new).returns(file_part) + Faraday::FilePart.stubs(:new).returns(file_part) custom_headers = { "Cache-Control" => "no-cache", diff --git a/test/whatsapp/contact_helper.rb b/test/whatsapp/contact_helper.rb index 98f10a8..025f820 100644 --- a/test/whatsapp/contact_helper.rb +++ b/test/whatsapp/contact_helper.rb @@ -1,11 +1,7 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module ContactHelper - extend T::Sig - - sig { returns(T::Array[Resource::Address]) } def create_addresses address1 = Resource::Address.new( street: "STREET", @@ -30,7 +26,6 @@ def create_addresses [address1, address2] end - sig { returns(T::Array[Resource::Email]) } def create_emails email1 = Resource::Email.new(email: "ignacio@gmail.com", type: Resource::AddressType::Work) email2 = Resource::Email.new(email: "ignacio2@gmail.com", type: Resource::AddressType::Home) @@ -38,7 +33,6 @@ def create_emails [email1, email2] end - sig { returns(Resource::Name) } def create_name Resource::Name.new( formatted_name: "ignacio chiazzo", @@ -50,12 +44,10 @@ def create_name ) end - sig { returns(Resource::Org) } def create_org Resource::Org.new(company: "ignacioCo", department: "Engineering", title: "ignacioOrg") end - sig { returns(T::Array[Resource::PhoneNumber]) } def create_phone_numbers phone1 = Resource::PhoneNumber.new(phone: "1234567", type: Resource::AddressType::Home, wa_id: "1234") phone2 = Resource::PhoneNumber.new(phone: "9876543", type: Resource::AddressType::Work, wa_id: "1234") @@ -63,7 +55,6 @@ def create_phone_numbers [phone1, phone2] end - sig { returns(T::Array[Resource::Url]) } def create_urls url1 = Resource::Url.new(url: "1234567", type: Resource::AddressType::Home) url2 = Resource::Url.new(url: "1234567", type: Resource::AddressType::Work) @@ -71,7 +62,6 @@ def create_urls [url1, url2] end - sig { returns(Resource::Contact) } def create_contact Resource::Contact.new( addresses: create_addresses, diff --git a/test/whatsapp/resource/parameter_object_test.rb b/test/whatsapp/resource/parameter_object_test.rb index d949122..9a64dbd 100644 --- a/test/whatsapp/resource/parameter_object_test.rb +++ b/test/whatsapp/resource/parameter_object_test.rb @@ -43,7 +43,7 @@ def setup end error = assert_raises(Errors::MissingValue) do - T.unsafe(ParameterObject).new(type: type, attr_name => object) + ParameterObject.new(type: type, attr_name => object) end assert_equal(type.serialize, error.field) From 84939487388436115c90ca71a8aa60fe8fd9352a Mon Sep 17 00:00:00 2001 From: ignacio-chiazzo Date: Sat, 31 Aug 2024 20:26:03 -0300 Subject: [PATCH 2/5] remove sorbet sigs from lib --- lib/whatsapp_sdk.rb | 3 - lib/whatsapp_sdk/api/api_configuration.rb | 7 +- lib/whatsapp_sdk/api/business_profile.rb | 12 --- lib/whatsapp_sdk/api/client.rb | 42 +--------- lib/whatsapp_sdk/api/medias.rb | 20 ----- lib/whatsapp_sdk/api/messages.rb | 80 +------------------ lib/whatsapp_sdk/api/phone_numbers.rb | 15 +--- lib/whatsapp_sdk/api/request.rb | 2 +- lib/whatsapp_sdk/api/response.rb | 21 +---- .../business_profile_data_response.rb | 45 +++-------- .../api/responses/data_response.rb | 9 --- .../api/responses/error_response.rb | 9 +-- .../api/responses/generic_error_response.rb | 34 ++------ .../api/responses/media_data_response.rb | 34 ++------ .../api/responses/message_data_response.rb | 24 +----- .../api/responses/message_error_response.rb | 1 - ...essage_template_namespace_data_response.rb | 16 +--- .../responses/phone_number_data_response.rb | 56 +++++-------- .../responses/phone_numbers_data_response.rb | 11 +-- .../responses/read_message_data_response.rb | 7 +- .../api/responses/success_response.rb | 6 +- .../api/responses/template_data_response.rb | 5 -- .../api/responses/templates_data_response.rb | 11 +-- lib/whatsapp_sdk/api/templates.rb | 26 +----- lib/whatsapp_sdk/configuration.rb | 26 +----- lib/whatsapp_sdk/error.rb | 2 +- lib/whatsapp_sdk/resource/address.rb | 31 +------ lib/whatsapp_sdk/resource/address_type.rb | 3 - lib/whatsapp_sdk/resource/business_profile.rb | 3 - lib/whatsapp_sdk/resource/button_parameter.rb | 13 --- lib/whatsapp_sdk/resource/component.rb | 30 +------ lib/whatsapp_sdk/resource/contact.rb | 31 +------ lib/whatsapp_sdk/resource/contact_response.rb | 10 +-- lib/whatsapp_sdk/resource/currency.rb | 8 -- lib/whatsapp_sdk/resource/date_time.rb | 6 -- lib/whatsapp_sdk/resource/email.rb | 12 +-- lib/whatsapp_sdk/resource/errors.rb | 18 +---- lib/whatsapp_sdk/resource/interactive.rb | 19 ----- .../resource/interactive_action.rb | 18 ----- .../interactive_action_reply_button.rb | 12 --- .../resource/interactive_action_section.rb | 10 --- .../interactive_action_section_row.rb | 11 --- lib/whatsapp_sdk/resource/interactive_body.rb | 10 --- .../resource/interactive_footer.rb | 10 --- .../resource/interactive_header.rb | 28 +------ lib/whatsapp_sdk/resource/location.rb | 8 -- lib/whatsapp_sdk/resource/media.rb | 28 +------ lib/whatsapp_sdk/resource/media_types.rb | 3 - lib/whatsapp_sdk/resource/message.rb | 5 -- lib/whatsapp_sdk/resource/name.rb | 29 +------ lib/whatsapp_sdk/resource/org.rb | 14 +--- lib/whatsapp_sdk/resource/parameter_object.rb | 49 +++--------- lib/whatsapp_sdk/resource/phone_number.rb | 14 +--- lib/whatsapp_sdk/resource/template.rb | 31 +------ lib/whatsapp_sdk/resource/url.rb | 11 +-- lib/whatsapp_sdk/version.rb | 2 +- 56 files changed, 101 insertions(+), 900 deletions(-) diff --git a/lib/whatsapp_sdk.rb b/lib/whatsapp_sdk.rb index 7c42396..47bd34f 100644 --- a/lib/whatsapp_sdk.rb +++ b/lib/whatsapp_sdk.rb @@ -11,9 +11,6 @@ module WhatsappSdk class << self - extend T::Sig - - sig { returns(Configuration) } def configuration @configuration ||= Configuration.new end diff --git a/lib/whatsapp_sdk/api/api_configuration.rb b/lib/whatsapp_sdk/api/api_configuration.rb index fcecbf3..2d688b2 100644 --- a/lib/whatsapp_sdk/api/api_configuration.rb +++ b/lib/whatsapp_sdk/api/api_configuration.rb @@ -1,13 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Api module ApiConfiguration - extend T::Sig - - DEFAULT_API_VERSION = T.let("v19.0", String) - API_URL = T.let("https://graph.facebook.com", String) + DEFAULT_API_VERSION = "v19.0" + API_URL = "https://graph.facebook.com" end end end diff --git a/lib/whatsapp_sdk/api/business_profile.rb b/lib/whatsapp_sdk/api/business_profile.rb index b87c16c..34dfb38 100644 --- a/lib/whatsapp_sdk/api/business_profile.rb +++ b/lib/whatsapp_sdk/api/business_profile.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "request" @@ -11,12 +10,8 @@ class BusinessProfile < Request DEFAULT_FIELDS = 'about,address,description,email,profile_picture_url,websites,vertical' class InvalidVertical < StandardError - extend T::Sig - - sig { returns(String) } attr_accessor :message - sig { params(vertical: String).void } def initialize(vertical:) @message = "invalid vertical #{vertical}. See the supported types in the official documentation " \ "https://developers.facebook.com/docs/whatsapp/cloud-api/reference/business-profiles" @@ -28,7 +23,6 @@ def initialize(vertical:) # # @param phone_number_id [Integer] Phone Number Id. # @return [Api::Response] Response object. - sig { params(phone_number_id: Integer, fields: T.nilable(T::Array[String])).returns(Api::Response) } def details(phone_number_id, fields: nil) fields = if fields fields.join(',') @@ -52,11 +46,6 @@ def details(phone_number_id, fields: nil) # @param phone_number_id [Integer] Phone Number Id. # @param params [Hash] Params to update. # @return [Api::Response] Response object. - sig do - params( - phone_number_id: Integer, params: T::Hash[T.untyped, T.untyped] - ).returns(Api::Response) - end def update(phone_number_id:, params:) # this is a required field params[:messaging_product] = 'whatsapp' @@ -76,7 +65,6 @@ def update(phone_number_id:, params:) private - sig { params(params: T::Hash[T.untyped, T.untyped]).returns(T::Boolean) } def valid_vertical?(params) return true unless params[:vertical] diff --git a/lib/whatsapp_sdk/api/client.rb b/lib/whatsapp_sdk/api/client.rb index 536d5e1..d45f339 100644 --- a/lib/whatsapp_sdk/api/client.rb +++ b/lib/whatsapp_sdk/api/client.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require "faraday" @@ -7,26 +6,13 @@ module WhatsappSdk module Api class Client - extend T::Sig - - API_VERSIONS = T.let( - [ + API_VERSIONS = [ 'v19.0', 'v18.0', 'v17.0', 'v16.0', 'v15.0', 'v14.0', 'v13.0', 'v12.0', 'v11.0', 'v10.0', 'v9.0', 'v8.0', 'v7.0', 'v6.0', 'v5.0', 'v4.0', 'v3.3', 'v3.2', 'v3.1', 'v3.0', 'v2.12', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7', 'v2.6', 'v2.5', 'v2.4', 'v2.3', 'v2.2', 'v2.1' - ].freeze, - T::Array[String] - ) + ].freeze - sig do - params( - access_token: String, - api_version: String, - logger: T.nilable(T.any(Logger, T.class_of(Logger))), - logger_options: Hash - ).void - end def initialize( access_token, api_version = ApiConfiguration::DEFAULT_API_VERSION, @@ -41,20 +27,10 @@ def initialize( @api_version = api_version end - sig do - params( - endpoint: String, - full_url: T.nilable(String), - http_method: String, - params: T::Hash[T.untyped, T.untyped], - headers: T::Hash[T.untyped, T.untyped], - multipart: T::Boolean - ).returns(T.nilable(T::Hash[T.untyped, T.untyped])) - end def send_request(endpoint: "", full_url: nil, http_method: "post", params: {}, headers: {}, multipart: false) url = full_url || "#{ApiConfiguration::API_URL}/#{@api_version}/" - faraday_request = T.unsafe(faraday(url: url, multipart: multipart)) + faraday_request = faraday(url: url, multipart: multipart) response = faraday_request.public_send(http_method, endpoint, request_params(params, headers), headers) @@ -63,10 +39,6 @@ def send_request(endpoint: "", full_url: nil, http_method: "post", params: {}, h JSON.parse(response.body) end - sig do - params(url: String, content_type_header: String, file_path: T.nilable(String)) - .returns(Net::HTTPResponse) - end def download_file(url:, content_type_header:, file_path: nil) uri = URI.parse(url) request = Net::HTTP::Get.new(uri) @@ -85,19 +57,12 @@ def download_file(url:, content_type_header:, file_path: nil) private - sig do - params( - params: T::Hash[T.untyped, T.untyped], - headers: T::Hash[T.untyped, T.untyped] - ).returns(T.any(T::Hash[T.untyped, T.untyped], String)) - end def request_params(params, headers) return params.to_json if params.is_a?(Hash) && headers['Content-Type'] == 'application/json' params end - sig { params(url: String, multipart: T::Boolean).returns(Faraday::Connection) } def faraday(url:, multipart: false) ::Faraday.new(url) do |client| client.request(:multipart) if multipart @@ -108,7 +73,6 @@ def faraday(url:, multipart: false) end end - sig { params(api_version: String).void } def validate_api_version(api_version) raise ArgumentError, "Invalid API version: #{api_version}" unless API_VERSIONS.include?(api_version) end diff --git a/lib/whatsapp_sdk/api/medias.rb b/lib/whatsapp_sdk/api/medias.rb index 28d2cc4..a9350e0 100644 --- a/lib/whatsapp_sdk/api/medias.rb +++ b/lib/whatsapp_sdk/api/medias.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require "faraday" @@ -14,12 +13,8 @@ module WhatsappSdk module Api class Medias < Request class FileNotFoundError < StandardError - extend T::Sig - - sig { returns(String) } attr_reader :file_path - sig { params(file_path: String).void } def initialize(file_path:) @file_path = file_path @@ -29,12 +24,8 @@ def initialize(file_path:) end class InvalidMediaTypeError < StandardError - extend T::Sig - - sig { returns(String) } attr_reader :media_type - sig { params(media_type: String).void } def initialize(media_type:) @media_type = media_type message = "Invalid Media Type #{media_type}. See the supported types in the official documentation " \ @@ -47,7 +38,6 @@ def initialize(media_type:) # # @param media_id [String] Media Id. # @return [Api::Response] Response object. - sig { params(media_id: String).returns(Api::Response) } def media(media_id:) response = send_request( http_method: "get", @@ -68,7 +58,6 @@ def media(media_id:) # documentation https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types, # but note that the API may allow more depending on the client. # @return [Api::Response] Response object. - sig { params(url: String, file_path: String, media_type: String).returns(Api::Response) } def download(url:, file_path:, media_type:) # Allow download of unsupported media types, since Cloud API may decide to let it through. # https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/discussions/127 @@ -97,14 +86,6 @@ def download(url:, file_path:, media_type:) # see the official documentation https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types. # # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, - file_path: String, - type: String, - headers: T::Hash[String, String] - ).returns(Api::Response) - end def upload(sender_id:, file_path:, type:, headers: {}) raise FileNotFoundError.new(file_path: file_path) unless File.file?(file_path) @@ -132,7 +113,6 @@ def upload(sender_id:, file_path:, type:, headers: {}) # # @param media_id [String] Media Id. # @return [Api::Response] Response object. - sig { params(media_id: String).returns(Api::Response) } def delete(media_id:) response = send_request( http_method: "delete", diff --git a/lib/whatsapp_sdk/api/messages.rb b/lib/whatsapp_sdk/api/messages.rb index bb7c5c7..a3e0d34 100644 --- a/lib/whatsapp_sdk/api/messages.rb +++ b/lib/whatsapp_sdk/api/messages.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "request" @@ -7,9 +6,7 @@ module WhatsappSdk module Api class Messages < Request - extend T::Sig - - DEFAULT_HEADERS = T.let({ 'Content-Type' => 'application/json' }.freeze, Hash) + DEFAULT_HEADERS = { 'Content-Type' => 'application/json' }.freeze # Send a text message. # @@ -18,12 +15,6 @@ class Messages < Request # @param message [String] Text to send. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, message: String, - message_id: T.nilable(String) - ).returns(Api::Response) - end def send_text(sender_id:, recipient_number:, message:, message_id: nil) params = { messaging_product: "whatsapp", @@ -56,13 +47,6 @@ def send_text(sender_id:, recipient_number:, message:, message_id: nil) # @param address [String] Location address. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, - longitude: Float, latitude: Float, name: String, address: String, - message_id: T.nilable(String) - ).returns(Api::Response) - end def send_location( sender_id:, recipient_number:, longitude:, latitude:, name:, address:, message_id: nil ) @@ -101,13 +85,6 @@ def send_location( # @param caption [String] Image caption. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, image_id: T.nilable(String), - link: T.nilable(String), caption: T.nilable(String), - message_id: T.nilable(String) - ).returns(Api::Response) - end def send_image( sender_id:, recipient_number:, image_id: nil, link: nil, caption: "", message_id: nil ) @@ -146,12 +123,6 @@ def send_image( # @param link [String] Audio link. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, audio_id: T.nilable(String), - link: T.nilable(String), message_id: T.nilable(String) - ).returns(Api::Response) - end def send_audio(sender_id:, recipient_number:, audio_id: nil, link: nil, message_id: nil) raise Resource::Errors::MissingArgumentError, "audio_id or link is required" if !audio_id && !link @@ -186,13 +157,6 @@ def send_audio(sender_id:, recipient_number:, audio_id: nil, link: nil, message_ # @param caption [String] Image caption. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, - video_id: T.nilable(String), link: T.nilable(String), caption: String, - message_id: T.nilable(String) - ).returns(Api::Response) - end def send_video( sender_id:, recipient_number:, video_id: nil, link: nil, caption: "", message_id: nil ) @@ -232,13 +196,6 @@ def send_video( # @param caption [String] Image caption. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, - document_id: T.nilable(String), link: T.nilable(String), caption: String, - message_id: T.nilable(String), filename: T.nilable(String) - ).returns(Api::Response) - end def send_document( sender_id:, recipient_number:, document_id: nil, link: nil, caption: "", message_id: nil, filename: nil ) @@ -281,12 +238,6 @@ def send_document( # @param link [String] Image link. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, sticker_id: T.nilable(String), - link: T.nilable(String), message_id: T.nilable(String) - ).returns(Api::Response) - end def send_sticker(sender_id:, recipient_number:, sticker_id: nil, link: nil, message_id: nil) raise Resource::Errors::MissingArgumentError, "sticker or link is required" if !sticker_id && !link @@ -320,13 +271,6 @@ def send_sticker(sender_id:, recipient_number:, sticker_id: nil, link: nil, mess # @param contacts_json [Json] Contacts. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, - contacts: T.nilable(T::Array[Resource::Contact]), - contacts_json: T::Hash[T.untyped, T.untyped], message_id: T.nilable(String) - ).returns(Api::Response) - end def send_contacts( sender_id:, recipient_number:, contacts: nil, contacts_json: {}, message_id: nil ) @@ -366,13 +310,6 @@ def send_contacts( # If you pass interactive_json, you can't pass interactive. # @param message_id [String] The id of the message to reply to. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, - interactive: T.nilable(Resource::Interactive), - interactive_json: T.nilable(T::Hash[T.untyped, T.untyped]), message_id: T.nilable(String) - ).returns(Api::Response) - end def send_interactive_message( sender_id:, recipient_number:, interactive: nil, interactive_json: nil, message_id: nil ) @@ -415,7 +352,6 @@ def send_interactive_message( # @param sender_id [Integer] Sender' phone number. # @param message_id [Integer] Message ID. # @return [Api::Response] Response object. - sig { params(sender_id: Integer, message_id: String).returns(Api::Response) } def read_message(sender_id:, message_id:) params = { messaging_product: "whatsapp", @@ -444,13 +380,6 @@ def read_message(sender_id:, message_id:) # @param components [Component] Component. # @param components_json [Json] The component as a Json. If you pass components_json, you can't pass components. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, name: String, language: String, - components: T.nilable(T::Array[Resource::Component]), - components_json: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]) - ).returns(Api::Response) - end def send_template( sender_id:, recipient_number:, name:, language:, components: nil, components_json: nil ) @@ -495,12 +424,6 @@ def send_template( # @param message_id [String] the id of the message to reaction. # @param emoji [String] unicode of the emoji to send. # @return [Api::Response] Response object. - sig do - params( - sender_id: Integer, recipient_number: Integer, message_id: String, - emoji: T.any(String, Integer) - ).returns(Api::Response) - end def send_reaction(sender_id:, recipient_number:, message_id:, emoji:) params = { messaging_product: "whatsapp", @@ -527,7 +450,6 @@ def send_reaction(sender_id:, recipient_number:, message_id:, emoji:) private - sig { params(sender_id: Integer).returns(String) } def endpoint(sender_id) "#{sender_id}/messages" end diff --git a/lib/whatsapp_sdk/api/phone_numbers.rb b/lib/whatsapp_sdk/api/phone_numbers.rb index 322b484..a201372 100644 --- a/lib/whatsapp_sdk/api/phone_numbers.rb +++ b/lib/whatsapp_sdk/api/phone_numbers.rb @@ -1,4 +1,4 @@ -# typed: strict + # frozen_string_literal: true require_relative "request" @@ -17,7 +17,6 @@ class PhoneNumbers < Request # # @param business_id [Integer] Business Id. # @return [Api::Response] Response object. - sig { params(business_id: Integer).returns(Api::Response) } def registered_numbers(business_id) response = send_request( http_method: "get", @@ -34,7 +33,6 @@ def registered_numbers(business_id) # # @param phone_number_id [Integer] The registered number we want to retrieve. # @return [Api::Response] Response object. - sig { params(phone_number_id: Integer).returns(Api::Response) } def registered_number(phone_number_id) response = send_request( http_method: "get", @@ -52,12 +50,6 @@ def registered_number(phone_number_id) # @param phone_number_id [Integer] The registered number we want to retrieve. # @param pin [Integer] Pin of 6 digits. # @return [Api::Response] Response object. - sig do - params( - phone_number_id: Integer, - pin: Integer - ).returns(Api::Response) - end def register_number(phone_number_id, pin) response = send_request( http_method: "post", @@ -75,11 +67,6 @@ def register_number(phone_number_id, pin) # # @param phone_number_id [Integer] The registered number we want to retrieve. # @return [Api::Response] Response object. - sig do - params( - phone_number_id: Integer - ).returns(Api::Response) - end def deregister_number(phone_number_id) response = send_request( http_method: "post", diff --git a/lib/whatsapp_sdk/api/request.rb b/lib/whatsapp_sdk/api/request.rb index 35d35f1..7b5ec99 100644 --- a/lib/whatsapp_sdk/api/request.rb +++ b/lib/whatsapp_sdk/api/request.rb @@ -4,7 +4,7 @@ module WhatsappSdk module Api class Request - extend T::Sig + def initialize(client = WhatsappSdk.configuration.client) @client = client diff --git a/lib/whatsapp_sdk/api/response.rb b/lib/whatsapp_sdk/api/response.rb index 247be38..d9563f8 100644 --- a/lib/whatsapp_sdk/api/response.rb +++ b/lib/whatsapp_sdk/api/response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "responses/message_data_response" @@ -11,24 +10,8 @@ module WhatsappSdk module Api class Response - extend T::Sig + attr_accessor :error, :data, :raw_response - sig { returns(T.nilable(Api::Responses::ErrorResponse)) } - attr_accessor :error - - sig { returns(T.nilable(Api::Responses::DataResponse)) } - attr_accessor :data - - sig { returns(T::Hash[T.untyped, T.untyped]) } - attr_accessor :raw_response - - sig do - params( - response: T::Hash[T.untyped, T.untyped], - data_class_type: T.class_of(Api::Responses::DataResponse), - error_class_type: T.class_of(Api::Responses::ErrorResponse) - ).void - end def initialize(response:, data_class_type:, error_class_type: Responses::MessageErrorResponse) @raw_response = response @data = data_class_type.build_from_response(response: response) @@ -36,13 +19,11 @@ def initialize(response:, data_class_type:, error_class_type: Responses::Message end # @return [Boolean] Whether or not the response is successful. - sig { returns(T::Boolean) } def ok? @error.nil? end # @return [Boolean] Whether or not the response has an error. - sig { returns(T::Boolean) } def error? !!@error end diff --git a/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb b/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb index 80a199f..47c8b2a 100644 --- a/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -7,44 +6,22 @@ module WhatsappSdk module Api module Responses class BusinessProfileDataResponse < DataResponse - sig { returns(T.nilable(String)) } - attr_accessor :about + attr_accessor :about, :address, :description, :email, :messaging_product, + :profile_picture_url, :vertical, :websites - sig { returns(T.nilable(String)) } - attr_accessor :address - - sig { returns(T.nilable(String)) } - attr_accessor :description - - sig { returns(T.nilable(String)) } - attr_accessor :email - - sig { returns(T.nilable(String)) } - attr_accessor :messaging_product - - sig { returns(T.nilable(String)) } - attr_accessor :profile_picture_url - - sig { returns(T.nilable(String)) } - attr_accessor :vertical - - sig { returns(T::Array[String]) } - attr_accessor :websites - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @about = T.let(response["data"][0]["about"], T.nilable(String)) - @address = T.let(response["data"][0]["address"], T.nilable(String)) - @description = T.let(response["data"][0]["description"], T.nilable(String)) - @email = T.let(response["data"][0]["email"], T.nilable(String)) - @messaging_product = T.let(response["data"][0]["messaging_product"], T.nilable(String)) - @profile_picture_url = T.let(response["data"][0]["profile_picture_url"], T.nilable(String)) - @vertical = T.let(response["data"][0]["vertical"], T.nilable(String)) - @websites = T.let(response["data"][0]["websites"], T.nilable(T::Array[String])) + @about = response["data"][0]["about"] + @address = response["data"][0]["address"] + @description = response["data"][0]["description"] + @email = response["data"][0]["email"] + @messaging_product = response["data"][0]["messaging_product"] + @profile_picture_url = response["data"][0]["profile_picture_url"] + @vertical = response["data"][0]["vertical"] + @websites = response["data"][0]["websites"] + super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(BusinessProfileDataResponse)) } def self.build_from_response(response:) return nil if response['error'] diff --git a/lib/whatsapp_sdk/api/responses/data_response.rb b/lib/whatsapp_sdk/api/responses/data_response.rb index 394143d..e115d76 100644 --- a/lib/whatsapp_sdk/api/responses/data_response.rb +++ b/lib/whatsapp_sdk/api/responses/data_response.rb @@ -1,24 +1,15 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Api module Responses class DataResponse - extend ::T::Sig - extend ::T::Helpers - - abstract! - - sig { returns(T::Hash[T.untyped, T.untyped]) } attr_reader :raw_data_response - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) @raw_data_response = response end - sig { abstract.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(DataResponse)) } def self.build_from_response(response:); end end end diff --git a/lib/whatsapp_sdk/api/responses/error_response.rb b/lib/whatsapp_sdk/api/responses/error_response.rb index a2bfab8..f628c05 100644 --- a/lib/whatsapp_sdk/api/responses/error_response.rb +++ b/lib/whatsapp_sdk/api/responses/error_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -7,20 +6,14 @@ module WhatsappSdk module Api module Responses class ErrorResponse < DataResponse - sig { returns(T.nilable(T::Boolean)) } - attr_accessor :error + attr_accessor :error, :status - sig { returns(T.nilable(Integer)) } - attr_accessor :status - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) @error = response["error"] @status = response["status"] super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(ErrorResponse)) } def self.build_from_response(response:) return unless response["error"] diff --git a/lib/whatsapp_sdk/api/responses/generic_error_response.rb b/lib/whatsapp_sdk/api/responses/generic_error_response.rb index 47b05fd..2c1ef1f 100644 --- a/lib/whatsapp_sdk/api/responses/generic_error_response.rb +++ b/lib/whatsapp_sdk/api/responses/generic_error_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "error_response" @@ -7,36 +6,19 @@ module WhatsappSdk module Api module Responses class GenericErrorResponse < ErrorResponse - sig { returns(Integer) } - attr_reader :code + attr_reader :code, :subcode, :message, :type, :data, :fbtrace_id - sig { returns(T.nilable(Integer)) } - attr_reader :subcode - - sig { returns(T.nilable(String)) } - attr_reader :message - - sig { returns(T.nilable(String)) } - attr_reader :type - - sig { returns(T.nilable(String)) } - attr_reader :data - - sig { returns(T.nilable(String)) } - attr_reader :fbtrace_id - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) - @code = T.let(response["code"], Integer) - @subcode = T.let(response["error_subcode"], T.nilable(Integer)) - @message = T.let(response["message"], T.nilable(String)) - @type = T.let(response["type"], T.nilable(String)) - @data = T.let(response["data"], T.nilable(String)) - @fbtrace_id = T.let(response["fbtrace_id"], T.nilable(String)) + @code = response["code"] + @subcode = response["error_subcode"] + @message = response["message"] + @type = response["type"] + @data = response["data"] + @fbtrace_id = response["fbtrace_id"] + super(response: response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(GenericErrorResponse)) } def self.build_from_response(response:) error_response = response["error"] return unless error_response diff --git a/lib/whatsapp_sdk/api/responses/media_data_response.rb b/lib/whatsapp_sdk/api/responses/media_data_response.rb index 35339f4..6f10d47 100644 --- a/lib/whatsapp_sdk/api/responses/media_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/media_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -7,36 +6,19 @@ module WhatsappSdk module Api module Responses class MediaDataResponse < DataResponse - sig { returns(String) } - attr_accessor :id + attr_accessor :id, :url, :mime_type, :sha256, :file_size, :messaging_product - sig { returns(T.nilable(String)) } - attr_accessor :url - - sig { returns(T.nilable(String)) } - attr_accessor :mime_type - - sig { returns(T.nilable(String)) } - attr_accessor :sha256 - - sig { returns(T.nilable(Integer)) } - attr_accessor :file_size - - sig { returns(T.nilable(String)) } - attr_accessor :messaging_product - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @id = T.let(response["id"], String) - @messaging_product = T.let(response["messaging_product"], T.nilable(String)) - @url = T.let(response["url"], T.nilable(String)) - @mime_type = T.let(response["mime_type"], T.nilable(String)) - @sha256 = T.let(response["sha256"], T.nilable(String)) - @file_size = T.let(response["file_size"], T.nilable(Integer)) + @id = response["id"] + @messaging_product = response["messaging_product"] + @url = response["url"] + @mime_type = response["mime_type"] + @sha256 = response["sha256"] + @file_size = response["file_size"] + super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(MediaDataResponse)) } def self.build_from_response(response:) return unless response["id"] diff --git a/lib/whatsapp_sdk/api/responses/message_data_response.rb b/lib/whatsapp_sdk/api/responses/message_data_response.rb index 3ab2cd7..1552c7a 100644 --- a/lib/whatsapp_sdk/api/responses/message_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/message_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "../request" @@ -10,28 +9,15 @@ module WhatsappSdk module Api module Responses class MessageDataResponse < DataResponse - extend T::Sig + attr_reader :contacts, :messages - sig { returns(T::Array[Resource::ContactResponse]) } - attr_reader :contacts - - sig { returns(T::Array[Resource::Message]) } - attr_reader :messages - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) - @contacts = T.let( - response["contacts"]&.map { |contact_json| parse_contact(contact_json) }, - T::Array[Resource::ContactResponse] - ) - @messages = T.let( - response["messages"]&.map { |contact_json| parse_message(contact_json) }, - T::Array[Resource::Message] - ) + @contacts = response["contacts"]&.map { |contact_json| parse_contact(contact_json) } + @messages = response["messages"]&.map { |contact_json| parse_message(contact_json) } + super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(MessageDataResponse)) } def self.build_from_response(response:) return unless response["messages"] @@ -40,12 +26,10 @@ def self.build_from_response(response:) private - sig { params(message_json: T::Hash[T.untyped, T.untyped]).returns(Resource::Message) } def parse_message(message_json) Resource::Message.new(id: message_json["id"]) end - sig { params(contact_json: T::Hash[T.untyped, T.untyped]).returns(Resource::ContactResponse) } def parse_contact(contact_json) Resource::ContactResponse.new(input: contact_json["input"], wa_id: contact_json["wa_id"]) end diff --git a/lib/whatsapp_sdk/api/responses/message_error_response.rb b/lib/whatsapp_sdk/api/responses/message_error_response.rb index 365e085..b804595 100644 --- a/lib/whatsapp_sdk/api/responses/message_error_response.rb +++ b/lib/whatsapp_sdk/api/responses/message_error_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "generic_error_response" diff --git a/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb b/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb index a989099..faef275 100644 --- a/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -8,24 +7,15 @@ module WhatsappSdk module Api module Responses class MessageTemplateNamespaceDataResponse < DataResponse - sig { returns(String) } - attr_accessor :message_template_namespace + attr_accessor :message_template_namespace, :id - sig { returns(String) } - attr_accessor :id - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @id = T.let(response["id"], String) - @message_template_namespace = T.let(response["message_template_namespace"], String) + @id = response["id"] + @message_template_namespace = response["message_template_namespace"] super(response) end - sig do - override.params(response: T::Hash[T.untyped, T.untyped]) - .returns(T.nilable(MessageTemplateNamespaceDataResponse)) - end def self.build_from_response(response:) return unless response["id"] diff --git a/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb b/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb index 8d774d3..a27e6f3 100644 --- a/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -7,48 +6,31 @@ module WhatsappSdk module Api module Responses class PhoneNumberDataResponse < DataResponse - sig { returns(String) } - attr_accessor :id + attr_accessor :id, :verified_name, :display_phone_number, :quality_rating, :is_pin_enabled, + :is_official_business_account, :account_mode, :certificate, :code_verification_status, + :eligibility_for_api_business_global_search, :name_status, :new_name_status, :status, + :search_visibility, :messaging_limit_tier - sig { returns(String) } - attr_accessor :verified_name - - sig { returns(String) } - attr_accessor :display_phone_number - - sig { returns(String) } - attr_accessor :quality_rating - - sig { returns(T::Boolean) } - attr_accessor :is_pin_enabled, :is_official_business_account - - sig { returns(T.nilable(String)) } - attr_accessor :account_mode, :code_verification_status, :eligibility_for_api_business_global_search, - :certificate, :name_status, :new_name_status, :status, :search_visibility - - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @id = T.let(response["id"], String) - @verified_name = T.let(response["verified_name"], String) - @display_phone_number = T.let(response["display_phone_number"], String) - @quality_rating = T.let(response["quality_rating"], String) - @is_pin_enabled = T.let(response["is_pin_enabled"], T::Boolean) - @is_official_business_account = T.let(response["is_official_business_account"], T.nilable(T::Boolean)) - @account_mode = T.let(response["account_mode"], T.nilable(String)) - @certificate = T.let(response["certificate"], T.nilable(String)) - @code_verification_status = T.let(response["code_verification_status"], T.nilable(String)) - @eligibility_for_api_business_global_search = T.let(response["eligibility_for_api_business_global_search"], - T.nilable(String)) - @name_status = T.let(response["name_status"], T.nilable(String)) - @new_name_status = T.let(response["new_name_status"], T.nilable(String)) - @status = T.let(response["status"], T.nilable(String)) - @search_visibility = T.let(response["search_visibility"], T.nilable(String)) - @messaging_limit_tier = T.let(response["messaging_limit_tier"], T.nilable(String)) + @id = response["id"] + @verified_name = response["verified_name"] + @display_phone_number = response["display_phone_number"] + @quality_rating = response["quality_rating"] + @is_pin_enabled = response["is_pin_enabled"] + @is_official_business_account = response["is_official_business_account"] + @account_mode = response["account_mode"] + @certificate = response["certificate"] + @code_verification_status = response["code_verification_status"] + @eligibility_for_api_business_global_search = response["eligibility_for_api_business_global_search"] + @name_status = response["name_status"] + @new_name_status = response["new_name_status"] + @status = response["status"] + @search_visibility = response["search_visibility"] + @messaging_limit_tier = response["messaging_limit_tier"] super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(PhoneNumberDataResponse)) } def self.build_from_response(response:) return unless response["id"] diff --git a/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb b/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb index 4613580..3f490df 100644 --- a/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -8,19 +7,14 @@ module WhatsappSdk module Api module Responses class PhoneNumbersDataResponse < DataResponse - sig { returns(T::Array[PhoneNumberDataResponse]) } attr_reader :phone_numbers - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @phone_numbers = T.let( - response['data']&.map { |phone_number| parse_phone_number(phone_number) }, - T::Array[PhoneNumberDataResponse] - ) + @phone_numbers = response['data']&.map { |phone_number| parse_phone_number(phone_number) } + super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(PhoneNumbersDataResponse)) } def self.build_from_response(response:) return unless response["data"] @@ -29,7 +23,6 @@ def self.build_from_response(response:) private - sig { params(phone_number: T::Hash[T.untyped, T.untyped]).returns(PhoneNumberDataResponse) } def parse_phone_number(phone_number) PhoneNumberDataResponse.new(phone_number) end diff --git a/lib/whatsapp_sdk/api/responses/read_message_data_response.rb b/lib/whatsapp_sdk/api/responses/read_message_data_response.rb index db13d06..fc4c3de 100644 --- a/lib/whatsapp_sdk/api/responses/read_message_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/read_message_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "../request" @@ -10,21 +9,17 @@ module WhatsappSdk module Api module Responses class ReadMessageDataResponse < DataResponse - extend T::Sig - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) - @success = T.let(response["success"], T::Boolean) + @success = response["success"] super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(ReadMessageDataResponse)) } def self.build_from_response(response:) return if response["error"] new(response: response) end - sig { returns(T::Boolean) } def success? @success end diff --git a/lib/whatsapp_sdk/api/responses/success_response.rb b/lib/whatsapp_sdk/api/responses/success_response.rb index 427d21b..26289fd 100644 --- a/lib/whatsapp_sdk/api/responses/success_response.rb +++ b/lib/whatsapp_sdk/api/responses/success_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -7,20 +6,17 @@ module WhatsappSdk module Api module Responses class SuccessResponse < DataResponse - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) - @success = T.let(response["success"], T::Boolean) + @success = response["success"] super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(SuccessResponse)) } def self.build_from_response(response:) return unless response["success"] new(response: response) end - sig { returns(T::Boolean) } def success? @success end diff --git a/lib/whatsapp_sdk/api/responses/template_data_response.rb b/lib/whatsapp_sdk/api/responses/template_data_response.rb index 2ed0edc..c7ab47c 100644 --- a/lib/whatsapp_sdk/api/responses/template_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/template_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -8,17 +7,14 @@ module WhatsappSdk module Api module Responses class TemplateDataResponse < DataResponse - sig { returns(::WhatsappSdk::Resource::Template) } attr_reader :template - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response:) @template = parse_template(response) super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(TemplateDataResponse)) } def self.build_from_response(response:) return unless response["id"] @@ -27,7 +23,6 @@ def self.build_from_response(response:) private - sig { params(template_json: T::Hash[T.untyped, T.untyped]).returns(::WhatsappSdk::Resource::Template) } def parse_template(template_json) status = ::WhatsappSdk::Resource::Template::Status.try_deserialize(template_json["status"]) category = ::WhatsappSdk::Resource::Template::Category.try_deserialize(template_json["category"]) diff --git a/lib/whatsapp_sdk/api/responses/templates_data_response.rb b/lib/whatsapp_sdk/api/responses/templates_data_response.rb index 99ebf3e..49435ea 100644 --- a/lib/whatsapp_sdk/api/responses/templates_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/templates_data_response.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "data_response" @@ -8,19 +7,14 @@ module WhatsappSdk module Api module Responses class TemplatesDataResponse < DataResponse - sig { returns(T::Array[TemplateDataResponse]) } attr_reader :templates - sig { params(response: T::Hash[T.untyped, T.untyped]).void } def initialize(response) - @templates = T.let( - response['data']&.map { |template| parse_templates(template) }, - T::Array[TemplateDataResponse] - ) + @templates = response['data']&.map { |template| parse_templates(template) } + super(response) end - sig { override.params(response: T::Hash[T.untyped, T.untyped]).returns(T.nilable(TemplatesDataResponse)) } def self.build_from_response(response:) return unless response["data"] @@ -29,7 +23,6 @@ def self.build_from_response(response:) private - sig { params(template: T::Hash[T.untyped, T.untyped]).returns(TemplateDataResponse) } def parse_templates(template) TemplateDataResponse.new(response: template) end diff --git a/lib/whatsapp_sdk/api/templates.rb b/lib/whatsapp_sdk/api/templates.rb index 072a13a..ea1fc22 100644 --- a/lib/whatsapp_sdk/api/templates.rb +++ b/lib/whatsapp_sdk/api/templates.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true require_relative "request" @@ -13,15 +12,11 @@ module WhatsappSdk module Api class Templates < Request - DEFAULT_HEADERS = T.let({ 'Content-Type' => 'application/json' }.freeze, Hash) + DEFAULT_HEADERS = { 'Content-Type' => 'application/json' }.freeze class InvalidCategoryError < StandardError - extend T::Sig - - sig { returns(String) } attr_reader :category - sig { params(category: String).void } def initialize(category:) @category = category @@ -42,16 +37,6 @@ def initialize(category:) # Set to true to allow us to assign a category based on the template guidelines and the template's contents. # This can prevent your template from being rejected for miscategorization. # @return [Response] Response object. - sig do - params( - business_id: Integer, - name: String, - category: String, - language: String, - components_json: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]), - allow_category_change: T.nilable(T::Boolean) - ).returns(Response) - end def create( business_id:, name:, category:, language:, components_json: nil, allow_category_change: nil ) @@ -90,7 +75,6 @@ def create( # @param business_id [Integer] The business ID. # @param limit [Integer] Optional. Number of templates to return in a single page. # @return [Response] Response object. - sig { params(business_id: Integer, limit: T.nilable(Integer)).returns(Response) } def templates(business_id:, limit: 100) params = {} params["limit"] = limit if limit @@ -113,7 +97,6 @@ def templates(business_id:, limit: 100) # # @param business_id [Integer] The business ID. # @return [Response] Response object. - sig { params(business_id: Integer).returns(Response) } def get_message_template_namespace(business_id:) response = send_request( endpoint: business_id.to_s, @@ -173,13 +156,6 @@ def update(template_id:, category: nil, components_json: nil) # @param hsm_id [String] Optional. The template's id. # # @return [Response] Response object. - sig do - params( - business_id: Integer, - name: String, - hsm_id: T.nilable(String) - ).returns(Response) - end def delete(business_id:, name:, hsm_id: nil) params = { name: name } params[:hsm_id] = hsm_id if hsm_id diff --git a/lib/whatsapp_sdk/configuration.rb b/lib/whatsapp_sdk/configuration.rb index a51c1c0..77abed3 100644 --- a/lib/whatsapp_sdk/configuration.rb +++ b/lib/whatsapp_sdk/configuration.rb @@ -1,4 +1,3 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk @@ -10,31 +9,11 @@ module WhatsappSdk # # The gem have access to the client through WhatsappSdk.configuration.client class Configuration - extend T::Sig - - logger_or_subclass_or_nil = T.nilable(T.any(Logger, T.class_of(Logger))) - - sig { returns(String) } - attr_accessor :access_token - - sig { returns(String) } - attr_accessor :api_version + attr_accessor :access_token, :api_version # loggers like ActiveSupport::Logger (Rails.logger) is a subclass of Logger - sig { returns(logger_or_subclass_or_nil) } - attr_accessor :logger + attr_accessor :logger, :logger_options - sig { returns(Hash) } - attr_accessor :logger_options - - sig do - params( - access_token: String, - api_version: String, - logger: logger_or_subclass_or_nil, - logger_options: Hash - ).void - end def initialize( access_token = "", api_version = Api::ApiConfiguration::DEFAULT_API_VERSION, @@ -47,7 +26,6 @@ def initialize( @logger_options = logger_options end - sig { returns(Api::Client) } def client Api::Client.new(access_token, api_version, logger, logger_options) end diff --git a/lib/whatsapp_sdk/error.rb b/lib/whatsapp_sdk/error.rb index 96e2621..4312576 100644 --- a/lib/whatsapp_sdk/error.rb +++ b/lib/whatsapp_sdk/error.rb @@ -1,4 +1,4 @@ -# typed: strict + # frozen_string_literal: true module WhatsappSdk diff --git a/lib/whatsapp_sdk/resource/address.rb b/lib/whatsapp_sdk/resource/address.rb index 62e6680..6191feb 100644 --- a/lib/whatsapp_sdk/resource/address.rb +++ b/lib/whatsapp_sdk/resource/address.rb @@ -1,38 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Address - extend T::Sig + attr_accessor :street, :city, :state, :zip, :country, :country_code, :type - sig { returns(String) } - attr_accessor :street - - sig { returns(String) } - attr_accessor :city - - sig { returns(String) } - attr_accessor :state - - sig { returns(String) } - attr_accessor :zip - - sig { returns(String) } - attr_accessor :country - - sig { returns(String) } - attr_accessor :country_code - - sig { returns(AddressType) } - attr_accessor :type - - sig do - params( - street: String, city: String, state: String, zip: String, - country: String, country_code: String, type: AddressType - ).void - end def initialize(street:, city:, state:, zip:, country:, country_code:, type: AddressType::Home) @street = street @city = city @@ -43,7 +15,6 @@ def initialize(street:, city:, state:, zip:, country:, country_code:, type: Addr @type = type end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { street: @street, diff --git a/lib/whatsapp_sdk/resource/address_type.rb b/lib/whatsapp_sdk/resource/address_type.rb index e950235..9ce1bc8 100644 --- a/lib/whatsapp_sdk/resource/address_type.rb +++ b/lib/whatsapp_sdk/resource/address_type.rb @@ -1,11 +1,8 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class AddressType < T::Enum - extend T::Sig - enums do Home = new("Home") Work = new("Work") diff --git a/lib/whatsapp_sdk/resource/business_profile.rb b/lib/whatsapp_sdk/resource/business_profile.rb index ff807ca..d8c72b3 100644 --- a/lib/whatsapp_sdk/resource/business_profile.rb +++ b/lib/whatsapp_sdk/resource/business_profile.rb @@ -1,11 +1,8 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class BusinessProfile - extend T::Sig - VERTICAL_VALUES = %w[ UNDEFINED OTHER AUTO BEAUTY APPAREL EDU ENTERTAIN EVENT_PLAN FINANCE GROCERY GOVT HOTEL HEALTH NONPROFIT PROF_SERVICES RETAIL TRAVEL RESTAURANT NOT_A_BIZ diff --git a/lib/whatsapp_sdk/resource/button_parameter.rb b/lib/whatsapp_sdk/resource/button_parameter.rb index 6dd784c..f33cfd4 100644 --- a/lib/whatsapp_sdk/resource/button_parameter.rb +++ b/lib/whatsapp_sdk/resource/button_parameter.rb @@ -1,20 +1,15 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class ButtonParameter - extend T::Sig # Returns the button parameter type. # # @returns type [String] Valid options are payload and text. - sig { returns(Type) } attr_accessor :type class Type < T::Enum - extend T::Sig - enums do Text = new("text") Payload = new("payload") @@ -26,28 +21,20 @@ class Type < T::Enum # in addition to the display text on the button. # # @returns payload [String] - sig { returns(T.nilable(String)) } attr_accessor :payload # Required for URL buttons. # Developer-provided suffix that is appended to the predefined prefix URL in the template. # # @returns text [String] - sig { returns(T.nilable(String)) } attr_accessor :text - sig do - params( - type: Type, payload: T.nilable(String), text: T.nilable(String) - ).void - end def initialize(type:, payload: nil, text: nil) @type = type @payload = payload @text = text end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = { type: type.serialize diff --git a/lib/whatsapp_sdk/resource/component.rb b/lib/whatsapp_sdk/resource/component.rb index 13a8b2f..bd59d12 100644 --- a/lib/whatsapp_sdk/resource/component.rb +++ b/lib/whatsapp_sdk/resource/component.rb @@ -1,21 +1,12 @@ -# typed: strict + # frozen_string_literal: true module WhatsappSdk module Resource class Component - extend T::Sig - class InvalidField < StandardError - extend T::Sig - - sig { returns(Symbol) } - attr_reader :field - - sig { returns(String) } - attr_reader :message + attr_reader :field, :message - sig { params(field: Symbol, message: String).void } def initialize(field, message) @field = field @message = message @@ -24,8 +15,6 @@ def initialize(field, message) end class Type < T::Enum - extend T::Sig - enums do Header = new("header") Body = new("body") @@ -34,8 +23,6 @@ class Type < T::Enum end class Subtype < T::Enum - extend T::Sig - enums do QuickReply = new("quick_reply") Url = new("url") @@ -45,13 +32,11 @@ class Subtype < T::Enum # Returns the Component type. # # @returns type [String]. Supported Options are header, body and button. - sig { returns(Type) } attr_accessor :type # Returns the parameters of the component. For button type, it's required. # # @returns parameter [Array] . - sig { returns(T::Array[T.any(ButtonParameter, ParameterObject)]) } attr_accessor :parameters # Returns the Type of button to create. Required when type=button. Not used for the other types. @@ -62,27 +47,18 @@ class Subtype < T::Enum # appending the text parameter to the predefined prefix URL in the template. # # @returns subtype [String]. Valid options are quick_reply and url. - sig { returns(T.nilable(Component::Subtype)) } attr_accessor :sub_type # Required when type=button. Not used for the other types. # Position index of the button. You can have up to 3 buttons using index values of 0 to 2. # # @returns index [Integer]. - sig { returns(T.nilable(Integer)) } attr_accessor :index - sig { params(parameter: T.any(ButtonParameter, ParameterObject)).void } def add_parameter(parameter) @parameters << parameter end - sig do - params( - type: Type, parameters: T::Array[T.any(ButtonParameter, ParameterObject)], - sub_type: T.nilable(Component::Subtype), index: T.nilable(Integer) - ).void - end def initialize(type:, parameters: [], sub_type: nil, index: nil) @parameters = parameters @type = type @@ -91,7 +67,6 @@ def initialize(type:, parameters: [], sub_type: nil, index: nil) validate_fields end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = { type: type.serialize, @@ -104,7 +79,6 @@ def to_json private - sig { void } def validate_fields return if type == Type::Button diff --git a/lib/whatsapp_sdk/resource/contact.rb b/lib/whatsapp_sdk/resource/contact.rb index 339a53e..ac88c6b 100644 --- a/lib/whatsapp_sdk/resource/contact.rb +++ b/lib/whatsapp_sdk/resource/contact.rb @@ -1,38 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Contact - extend T::Sig + attr_accessor :addresses, :birthday, :emails, :name, :org, :phones, :urls - sig { returns(T::Array[Address]) } - attr_accessor :addresses - - sig { returns(String) } - attr_accessor :birthday - - sig { returns(T::Array[Email]) } - attr_accessor :emails - - sig { returns(Name) } - attr_accessor :name - - sig { returns(Org) } - attr_accessor :org - - sig { returns(T::Array[PhoneNumber]) } - attr_accessor :phones - - sig { returns(T::Array[Url]) } - attr_accessor :urls - - sig do - params( - addresses: T::Array[Address], birthday: String, emails: T::Array[Email], - name: Name, org: Org, phones: T::Array[PhoneNumber], urls: T::Array[Url] - ).void - end def initialize(addresses:, birthday:, emails:, name:, org:, phones:, urls:) @addresses = addresses @birthday = birthday @@ -43,7 +15,6 @@ def initialize(addresses:, birthday:, emails:, name:, org:, phones:, urls:) @urls = urls end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { addresses: addresses.map(&:to_h), diff --git a/lib/whatsapp_sdk/resource/contact_response.rb b/lib/whatsapp_sdk/resource/contact_response.rb index e0e2c0e..065d922 100644 --- a/lib/whatsapp_sdk/resource/contact_response.rb +++ b/lib/whatsapp_sdk/resource/contact_response.rb @@ -1,18 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class ContactResponse - extend T::Sig + attr_accessor :wa_id, :input - sig { returns(String) } - attr_accessor :wa_id - - sig { returns(String) } - attr_accessor :input - - sig { params(input: String, wa_id: String).void } def initialize(input:, wa_id:) @input = input @wa_id = wa_id diff --git a/lib/whatsapp_sdk/resource/currency.rb b/lib/whatsapp_sdk/resource/currency.rb index f931df5..ddd48d8 100644 --- a/lib/whatsapp_sdk/resource/currency.rb +++ b/lib/whatsapp_sdk/resource/currency.rb @@ -1,37 +1,29 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Currency - extend T::Sig - # Returns default text if localization fails. # # @returns fallback_value [String]. - sig { returns(String) } attr_accessor :fallback_value # Currency code as defined in ISO 4217. # # @returns code [String]. - sig { returns(String) } attr_accessor :code # Amount multiplied by 1000. # # @returns code [Float]. - sig { returns(T.any(Float, Integer)) } attr_accessor :amount - sig { params(fallback_value: String, code: String, amount: T.any(Float, Integer)).void } def initialize(fallback_value:, code:, amount:) @fallback_value = fallback_value @code = code @amount = amount end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { fallback_value: fallback_value, diff --git a/lib/whatsapp_sdk/resource/date_time.rb b/lib/whatsapp_sdk/resource/date_time.rb index d69ee69..62d1465 100644 --- a/lib/whatsapp_sdk/resource/date_time.rb +++ b/lib/whatsapp_sdk/resource/date_time.rb @@ -1,23 +1,17 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class DateTime - extend T::Sig - # Returns default text if localization fails. # # @returns fallback_value [String]. - sig { returns(String) } attr_accessor :fallback_value - sig { params(fallback_value: String).void } def initialize(fallback_value:) @fallback_value = fallback_value end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { fallback_value: fallback_value diff --git a/lib/whatsapp_sdk/resource/email.rb b/lib/whatsapp_sdk/resource/email.rb index a07cff0..144513f 100644 --- a/lib/whatsapp_sdk/resource/email.rb +++ b/lib/whatsapp_sdk/resource/email.rb @@ -1,24 +1,16 @@ -# typed: strict + # frozen_string_literal: true module WhatsappSdk module Resource class Email - extend T::Sig - - sig { returns(String) } - attr_accessor :email - - sig { returns(AddressType) } - attr_accessor :type + attr_accessor :email, :type - sig { params(email: String, type: AddressType).void } def initialize(email:, type:) @email = email @type = type end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { email: @email, diff --git a/lib/whatsapp_sdk/resource/errors.rb b/lib/whatsapp_sdk/resource/errors.rb index c6e1679..4cbfe35 100644 --- a/lib/whatsapp_sdk/resource/errors.rb +++ b/lib/whatsapp_sdk/resource/errors.rb @@ -1,16 +1,11 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource module Errors class MissingArgumentError < StandardError - extend T::Sig - - sig { returns(String) } attr_reader :message - sig { params(message: String).void } def initialize(message) @message = message super(message) @@ -18,15 +13,8 @@ def initialize(message) end class MissingValue < Error - extend T::Sig - - sig { returns(String) } - attr_reader :field + attr_reader :field, :message - sig { returns(String) } - attr_reader :message - - sig { params(field: String, message: String).void } def initialize(field, message) @field = field @message = message @@ -35,14 +23,10 @@ def initialize(field, message) end class InvalidLanguageError < StandardError - extend T::Sig - URL_AVAILABLE_LANGUAGES = "https://developers.facebook.com/docs/whatsapp/api/messages/message-templates" - sig { returns(String) } attr_reader :language - sig { params(language: String).void } def initialize(language:) @language = language diff --git a/lib/whatsapp_sdk/resource/interactive.rb b/lib/whatsapp_sdk/resource/interactive.rb index 9bef126..26769eb 100644 --- a/lib/whatsapp_sdk/resource/interactive.rb +++ b/lib/whatsapp_sdk/resource/interactive.rb @@ -1,14 +1,9 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Interactive - extend T::Sig - class Type < T::Enum - extend T::Sig - enums do ListMessage = new("list") ReplyButton = new("button") @@ -20,39 +15,28 @@ class Type < T::Enum # Returns the Interactive type of message you want to send. # # @returns type [Type]. Supported Options are list, button, product and product_list. - sig { returns(Type) } attr_accessor :type # Returns the interactive header if present. Required for type product_list. # # @returns type [InteractiveHeader] It can be nil. - sig { returns(T.nilable(InteractiveHeader)) } attr_accessor :header # Returns the interactive body. # # @returns type [InteractiveBody] Valid option is of type text only. - sig { returns(InteractiveBody) } attr_accessor :body # Returns the interactive footer if present. # # @returns type [InteractiveFooter] Valid option is of type text only. It can be nil. - sig { returns(T.nilable(InteractiveFooter)) } attr_accessor :footer # Returns the interactive action. # # @returns type [InteractiveBody] Valid condition is buttons of length of 1, 2 or 3 if type is button. - sig { returns(InteractiveAction) } attr_accessor :action - sig do - params( - type: Type, body: InteractiveBody, action: InteractiveAction, - header: T.nilable(InteractiveHeader), footer: T.nilable(InteractiveFooter) - ).void - end def initialize(type:, body:, action:, header: nil, footer: nil) @type = type @body = body @@ -62,7 +46,6 @@ def initialize(type:, body:, action:, header: nil, footer: nil) validate end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = { type: type.serialize } json[:header] = header.to_json if header @@ -75,12 +58,10 @@ def to_json private - sig { void } def validate validate_action end - sig { void } def validate_action action.validate end diff --git a/lib/whatsapp_sdk/resource/interactive_action.rb b/lib/whatsapp_sdk/resource/interactive_action.rb index 768a43d..6bd21ef 100644 --- a/lib/whatsapp_sdk/resource/interactive_action.rb +++ b/lib/whatsapp_sdk/resource/interactive_action.rb @@ -1,14 +1,9 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveAction - extend T::Sig - class Type < T::Enum - extend T::Sig - enums do ListMessage = new("list_message") ReplyButton = new("reply_button") @@ -18,36 +13,30 @@ class Type < T::Enum # Returns the type of interactive action you want to send. # # @returns type [Type]. Supported Options are list_message and reply_button. - sig { returns(Type) } attr_accessor :type # Returns the buttons of the Action. For reply_button type, it's required. # # @returns buttons [Array] . - sig { returns(T::Array[InteractiveActionReplyButton]) } attr_accessor :buttons # Returns the button of the Action. For list_message type, it's required. # # @returns button [String] . - sig { returns(String) } attr_accessor :button # Returns the sections of the Action. For list_message type, it's required. # # @returns sections [Array] . - sig { returns(T::Array[InteractiveActionSection]) } attr_accessor :sections # TODO: attr_accessor :catalog_id # TODO: attr_accessor :product_retailer_id - sig { params(reply_button: InteractiveActionReplyButton).void } def add_reply_button(reply_button) @buttons << reply_button end - sig { params(section: InteractiveActionSection).void } def add_section(section) @sections << section end @@ -58,12 +47,6 @@ def add_section(section) LIST_SECTIONS_MINIMUM = 1 LIST_SECTIONS_MAXIMUM = 10 - sig do - params( - type: Type, buttons: T::Array[InteractiveActionReplyButton], - button: String, sections: T::Array[InteractiveActionSection] - ).void - end def initialize(type:, buttons: [], button: "", sections: []) @type = type @buttons = buttons @@ -71,7 +54,6 @@ def initialize(type:, buttons: [], button: "", sections: []) @sections = sections end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = {} case type.serialize diff --git a/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb b/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb index 8f8bad0..61ab753 100644 --- a/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb +++ b/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb @@ -1,14 +1,9 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveActionReplyButton - extend T::Sig - class Type < T::Enum - extend T::Sig - enums do Reply = new("reply") end @@ -17,26 +12,22 @@ class Type < T::Enum # Returns the ActionButton type of message you want to send. # # @returns type [String]. Supported Options are reply only. - sig { returns(Type) } attr_accessor :type # Returns the ActionButton title you want to send. # # @returns title [String]. The character limit is 20 characters. - sig { returns(String) } attr_accessor :title # Returns the ActionButton unique identifier you want to send. # This ID is returned in the webhook when the button is clicked by the user. # # @returns id [String]. The character limit is 256 characters. - sig { returns(String) } attr_accessor :id ACTION_BUTTON_TITLE_MAXIMUM = 20 ACTION_BUTTON_ID_MAXIMUM = 256 - sig { params(title: String, id: String).void } def initialize(title:, id:) @type = Type::Reply @title = title @@ -56,13 +47,11 @@ def to_json private - sig { void } def validate validate_title validate_id end - sig { void } def validate_title title_length = title.length return if title_length <= ACTION_BUTTON_TITLE_MAXIMUM @@ -72,7 +61,6 @@ def validate_title "Maximum length: #{ACTION_BUTTON_TITLE_MAXIMUM} characters." end - sig { void } def validate_id id_unfrozen = id.dup id_unfrozen.strip! # You cannot have leading or trailing spaces when setting the ID. diff --git a/lib/whatsapp_sdk/resource/interactive_action_section.rb b/lib/whatsapp_sdk/resource/interactive_action_section.rb index 65775cc..da7fde1 100644 --- a/lib/whatsapp_sdk/resource/interactive_action_section.rb +++ b/lib/whatsapp_sdk/resource/interactive_action_section.rb @@ -1,24 +1,18 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveActionSection - extend T::Sig - # Returns the ActionSection title you want to send. # # @returns title [String]. The character limit is 24 characters. - sig { returns(String) } attr_accessor :title # Returns the ActionSection rows you want to send. # # @returns id [T::Array[InteractiveActionSectionRow]]. There must be at least one rows object. - sig { returns(T::Array[InteractiveActionSectionRow]) } attr_accessor :rows - sig { params(row: InteractiveActionSectionRow).void } def add_row(row) @rows << row end @@ -26,7 +20,6 @@ def add_row(row) ACTION_SECTION_TITLE_MAXIMUM = 24 ACTION_SECTION_ROWS_MAXIMUM = 10 - sig { params(title: String, rows: T::Array[InteractiveActionSectionRow]).void } def initialize(title:, rows: []) @title = title @rows = rows @@ -40,7 +33,6 @@ def to_json } end - sig { params(skip_rows: T.nilable(T::Boolean)).void } def validate(skip_rows: false) validate_title validate_rows unless skip_rows @@ -48,7 +40,6 @@ def validate(skip_rows: false) private - sig { void } def validate_title title_length = title.length return if title_length <= ACTION_SECTION_TITLE_MAXIMUM @@ -58,7 +49,6 @@ def validate_title "#{ACTION_SECTION_TITLE_MAXIMUM} characters." end - sig { void } def validate_rows rows_length = rows.length return if rows_length <= ACTION_SECTION_ROWS_MAXIMUM diff --git a/lib/whatsapp_sdk/resource/interactive_action_section_row.rb b/lib/whatsapp_sdk/resource/interactive_action_section_row.rb index efd7de2..93e630b 100644 --- a/lib/whatsapp_sdk/resource/interactive_action_section_row.rb +++ b/lib/whatsapp_sdk/resource/interactive_action_section_row.rb @@ -1,35 +1,28 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveActionSectionRow - extend T::Sig - # Returns the ActionSection title you want to send. # # @returns title [String]. The character limit is 24 characters. - sig { returns(String) } attr_accessor :title # Returns the ActionSection description you want to send. # # @returns description [String]. The character limit is 72 characters if present. - sig { returns(String) } attr_accessor :description # Returns the ActionSection unique identifier you want to send. # This ID is returned in the webhook when the section is selected by the user. # # @returns id [String]. The character limit is 256 characters. - sig { returns(String) } attr_accessor :id ACTION_SECTION_TITLE_MAXIMUM = 24 ACTION_SECTION_DESCRIPTION_MAXIMUM = 72 ACTION_SECTION_ID_MAXIMUM = 256 - sig { params(title: String, id: String, description: T.nilable(String)).void } def initialize(title:, id:, description: "") @title = title @id = id @@ -49,14 +42,12 @@ def to_json private - sig { void } def validate validate_title validate_id validate_description end - sig { void } def validate_title title_length = title.length return if title_length <= ACTION_SECTION_TITLE_MAXIMUM @@ -66,7 +57,6 @@ def validate_title "Maximum length: #{ACTION_SECTION_TITLE_MAXIMUM} characters." end - sig { void } def validate_id id_unfrozen = id.dup id_unfrozen.strip! # You cannot have leading or trailing spaces when setting the ID. @@ -79,7 +69,6 @@ def validate_id "#{ACTION_SECTION_ID_MAXIMUM} characters." end - sig { void } def validate_description description_length = description.length return if description_length <= ACTION_SECTION_DESCRIPTION_MAXIMUM diff --git a/lib/whatsapp_sdk/resource/interactive_body.rb b/lib/whatsapp_sdk/resource/interactive_body.rb index fd8bc6d..1dc10cf 100644 --- a/lib/whatsapp_sdk/resource/interactive_body.rb +++ b/lib/whatsapp_sdk/resource/interactive_body.rb @@ -1,27 +1,19 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveBody - extend T::Sig - # Returns Text string if the parameter object type is text. # For the body interactive, the character limit is 1024 characters. # # @returns text [String] - sig { returns(String) } attr_accessor :text - sig do - params(text: String).void - end def initialize(text:) @text = text validate end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { text: text } end @@ -30,12 +22,10 @@ def to_json private - sig { void } def validate validate_text end - sig { void } def validate_text text_length = text.length return if text_length <= MAXIMUM_LENGTH diff --git a/lib/whatsapp_sdk/resource/interactive_footer.rb b/lib/whatsapp_sdk/resource/interactive_footer.rb index 91cf4f1..40d0fc2 100644 --- a/lib/whatsapp_sdk/resource/interactive_footer.rb +++ b/lib/whatsapp_sdk/resource/interactive_footer.rb @@ -1,27 +1,19 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveFooter - extend T::Sig - # Returns Text string if the parameter object type is text. # For the body interactive, the character limit is 60 characters. # # @returns text [String] - sig { returns(String) } attr_accessor :text - sig do - params(text: String).void - end def initialize(text:) @text = text validate end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { text: text } end @@ -30,12 +22,10 @@ def to_json private - sig { void } def validate validate_text end - sig { void } def validate_text text_length = text.length return if text_length <= MAXIMUM_LENGTH diff --git a/lib/whatsapp_sdk/resource/interactive_header.rb b/lib/whatsapp_sdk/resource/interactive_header.rb index 24da6a3..3a7e805 100644 --- a/lib/whatsapp_sdk/resource/interactive_header.rb +++ b/lib/whatsapp_sdk/resource/interactive_header.rb @@ -1,20 +1,14 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveHeader - extend T::Sig - # Returns the interactive header type. # # @returns type [String] Valid options are text, image, document, video. - sig { returns(Type) } attr_accessor :type class Type < T::Enum - extend T::Sig - enums do Text = new("text") Image = new("image") @@ -28,35 +22,25 @@ class Type < T::Enum # For the body interactive, the character limit is 1024 characters. # # @returns text [String] - sig { returns(T.nilable(String)) } attr_accessor :text # Returns image if the interactive header type is image. # # @returns image [Media] - sig { returns(T.nilable(Media)) } attr_accessor :image # Returns document if the interactive header type is document. # # @returns document [Media] - sig { returns(T.nilable(Media)) } attr_accessor :document # Returns video if the interactive header type is video. # # @returns video [Media] - sig { returns(T.nilable(Media)) } attr_accessor :video - sig do - params( - type: T.any(Type, String), text: T.nilable(String), image: T.nilable(Media), - document: T.nilable(Media), video: T.nilable(Media) - ).void - end def initialize(type:, text: nil, image: nil, document: nil, video: nil) - @type = T.let(deserialize_type(type), Type) + @type = deserialize_type(type) @text = text @image = image @document = document @@ -64,18 +48,17 @@ def initialize(type:, text: nil, image: nil, document: nil, video: nil) validate end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = { type: type.serialize } json[type.serialize.to_sym] = case type.serialize when "text" text when "image" - T.must(image).to_json + image.to_json when "document" - T.must(document).to_json + document.to_json when "video" - T.must(video).to_json + video.to_json else raise "Invalid type: #{type}" end @@ -85,19 +68,16 @@ def to_json private - sig { params(type: T.any(String, Type)).returns(Type) } def deserialize_type(type) return type if type.is_a?(Type) Type.deserialize(type) end - sig { void } def validate validate_attributes end - sig { void } def validate_attributes [ [Type::Text, text], diff --git a/lib/whatsapp_sdk/resource/location.rb b/lib/whatsapp_sdk/resource/location.rb index a163bf0..ee5f074 100644 --- a/lib/whatsapp_sdk/resource/location.rb +++ b/lib/whatsapp_sdk/resource/location.rb @@ -4,33 +4,26 @@ module WhatsappSdk module Resource class Location - extend T::Sig - # Returns the latitude of the location. # # @returns latitude [Float]. - sig { returns(T.nilable(Float)) } attr_accessor :latitude # Returns the longitude of the location. # # @returns longitude [Float]. - sig { returns(T.nilable(Float)) } attr_accessor :longitude # Returns the name of the location. # # @returns name [String]. - sig { returns(T.nilable(String)) } attr_accessor :name # Returns the address of the location. # # @returns address [String]. - sig { returns(T.nilable(String)) } attr_accessor :address - sig { params(latitude: Float, longitude: Float, name: String, address: String).void } def initialize(latitude:, longitude:, name:, address:) @latitude = latitude @longitude = longitude @@ -38,7 +31,6 @@ def initialize(latitude:, longitude:, name:, address:) @address = address end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { latitude: latitude, diff --git a/lib/whatsapp_sdk/resource/media.rb b/lib/whatsapp_sdk/resource/media.rb index fea53e6..8da22ef 100644 --- a/lib/whatsapp_sdk/resource/media.rb +++ b/lib/whatsapp_sdk/resource/media.rb @@ -1,21 +1,13 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Media - extend T::Sig - class InvalidMedia < StandardError - extend T::Sig - - sig { returns(Symbol) } attr_reader :field - sig { returns(String) } attr_reader :message - sig { params(field: Symbol, message: String).void } def initialize(field, message) @field = field @message = message @@ -26,12 +18,9 @@ def initialize(field, message) # Returns media id. # # @returns id [String]. - sig { returns(T.nilable(String)) } attr_accessor :id class Type < T::Enum - extend T::Sig - enums do Audio = new('audio') Document = new('document') @@ -42,36 +31,26 @@ class Type < T::Enum end # @returns type [String]. Valid options ar audio, document, image, video and sticker. - sig { returns(Type) } attr_accessor :type # The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. # Do not use this field when the message type is set to text. # # @returns link [String]. - sig { returns(T.nilable(String)) } attr_accessor :link # Describes the specified document or image media. # # @returns caption [String]. - sig { returns(T.nilable(String)) } attr_accessor :caption # Describes the filename for the specific document. Use only with document media. # # @returns filename [String]. - sig { returns(T.nilable(String)) } attr_accessor :filename - sig do - params( - type: T.any(Type, String), id: T.nilable(String), link: T.nilable(String), - caption: T.nilable(String), filename: T.nilable(String) - ).void - end def initialize(type:, id: nil, link: nil, caption: nil, filename: nil) - @type = T.let(deserialize_type(type), Type) + @type = deserialize_type(type) @id = id @link = link @caption = caption @@ -79,7 +58,6 @@ def initialize(type:, id: nil, link: nil, caption: nil, filename: nil) validate_media end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = {} json[:id] = id unless id.nil? @@ -91,14 +69,12 @@ def to_json private - sig { params(type: T.any(String, Type)).returns(Type) } def deserialize_type(type) return type if type.is_a?(Type) Type.deserialize(type) end - sig { returns(T::Boolean) } def validate_media raise InvalidMedia.new(:filename, "filename can only be used with document") if filename && !supports_filename? @@ -109,12 +85,10 @@ def validate_media true end - sig { returns(T::Boolean) } def supports_filename? type == Type::Document end - sig { returns(T::Boolean) } def supports_caption? type == Type::Document || type == Type::Image end diff --git a/lib/whatsapp_sdk/resource/media_types.rb b/lib/whatsapp_sdk/resource/media_types.rb index aca91f8..e5df10a 100644 --- a/lib/whatsapp_sdk/resource/media_types.rb +++ b/lib/whatsapp_sdk/resource/media_types.rb @@ -1,11 +1,8 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class MediaTypes - extend T::Sig - # The media types supported by Whatsapp. The list contains all the types defined in the Whatsapp API # documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types # diff --git a/lib/whatsapp_sdk/resource/message.rb b/lib/whatsapp_sdk/resource/message.rb index 0b46b2f..7b0bcc3 100644 --- a/lib/whatsapp_sdk/resource/message.rb +++ b/lib/whatsapp_sdk/resource/message.rb @@ -1,15 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Message - extend T::Sig - - sig { returns(String) } attr_reader :id - sig { params(id: String).void } def initialize(id:) @id = id end diff --git a/lib/whatsapp_sdk/resource/name.rb b/lib/whatsapp_sdk/resource/name.rb index bb42aff..965f020 100644 --- a/lib/whatsapp_sdk/resource/name.rb +++ b/lib/whatsapp_sdk/resource/name.rb @@ -1,36 +1,10 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Name - extend T::Sig + attr_accessor :formatted_name, :first_name, :last_name, :middle_name, :suffix, :prefix - sig { returns(T.nilable(String)) } - attr_accessor :formatted_name - - sig { returns(T.nilable(String)) } - attr_accessor :first_name - - sig { returns(T.nilable(String)) } - attr_accessor :last_name - - sig { returns(T.nilable(String)) } - attr_accessor :middle_name - - sig { returns(T.nilable(String)) } - attr_accessor :suffix - - sig { returns(T.nilable(String)) } - attr_accessor :prefix - - sig do - params( - formatted_name: T.nilable(String), first_name: T.nilable(String), - last_name: T.nilable(String), middle_name: T.nilable(String), - suffix: T.nilable(String), prefix: T.nilable(String) - ).void - end def initialize( formatted_name: nil, first_name: nil, last_name: nil, middle_name: nil, suffix: nil, prefix: nil @@ -43,7 +17,6 @@ def initialize( @prefix = prefix end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { formatted_name: @formatted_name, diff --git a/lib/whatsapp_sdk/resource/org.rb b/lib/whatsapp_sdk/resource/org.rb index 222224b..ed9c984 100644 --- a/lib/whatsapp_sdk/resource/org.rb +++ b/lib/whatsapp_sdk/resource/org.rb @@ -1,28 +1,16 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Org - extend T::Sig + attr_accessor :company, :department, :title - sig { returns(String) } - attr_accessor :company - - sig { returns(String) } - attr_accessor :department - - sig { returns(String) } - attr_accessor :title - - sig { params(company: String, department: String, title: String).void } def initialize(company:, department:, title:) @company = company @department = department @title = title end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { company: @company, diff --git a/lib/whatsapp_sdk/resource/parameter_object.rb b/lib/whatsapp_sdk/resource/parameter_object.rb index 439892e..186f652 100644 --- a/lib/whatsapp_sdk/resource/parameter_object.rb +++ b/lib/whatsapp_sdk/resource/parameter_object.rb @@ -1,23 +1,14 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class ParameterObject - extend T::Sig - class InvalidType < StandardError - extend T::Sig - - sig { returns(String) } attr_accessor :message - sig { params(type: String).void } def initialize(type) - @message = T.let( - "invalid type #{type}. type should be text, currency, date_time, image, document or video", - String - ) + @message = "invalid type #{type}. type should be text, currency, date_time, image, document or video" + super end end @@ -25,12 +16,9 @@ def initialize(type) # Returns the parameter type. # # @returns type [String] Valid options are text, currency, date_time, image, document, video. - sig { returns(Type) } attr_accessor :type class Type < T::Enum - extend T::Sig - enums do Text = new("text") Currency = new("currency") @@ -47,52 +35,38 @@ class Type < T::Enum # For the body component, the character limit is 1024 characters. # # @returns text [String] - sig { returns(T.nilable(String)) } attr_accessor :text # Returns Currency if the parameter object type is currency. # # @returns currency [Currency] - sig { returns(T.nilable(Currency)) } attr_accessor :currency # Returns date_time if the parameter object type is date_time. # # @returns date_time [DateTime] - sig { returns(T.nilable(DateTime)) } attr_accessor :date_time # Returns image if the parameter object type is image. # # @returns image [Media] - sig { returns(T.nilable(Media)) } attr_accessor :image # Returns document if the parameter object type is document. # # @returns document [Media] - sig { returns(T.nilable(Media)) } attr_accessor :document # Returns video if the parameter object type is video. # # @returns video [Media] - sig { returns(T.nilable(Media)) } attr_accessor :video # Returns location if the parameter object type is location # # @returns location [Location] - sig { returns(T.nilable(Location)) } attr_accessor :location - sig do - params( - type: T.any(Type, String), text: T.nilable(String), currency: T.nilable(Currency), - date_time: T.nilable(DateTime), image: T.nilable(Media), document: T.nilable(Media), video: T.nilable(Media), - location: T.nilable(Location) - ).void - end def initialize( type:, text: nil, @@ -103,7 +77,7 @@ def initialize( video: nil, location: nil ) - @type = T.let(deserialize_type(type), Type) + @type = deserialize_type(type) @text = text @currency = currency @date_time = date_time @@ -114,24 +88,23 @@ def initialize( validate end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json json = { type: type.serialize } json[type.serialize.to_sym] = case type.serialize when "text" text when "currency" - T.must(currency).to_json + currency.to_json when "date_time" - T.must(date_time).to_json + date_time.to_json when "image" - T.must(image).to_json + image.to_json when "document" - T.must(document).to_json + document.to_json when "video" - T.must(video).to_json + video.to_json when "location" - T.must(location).to_json + location.to_json else raise "Invalid type: #{type}" end @@ -141,27 +114,23 @@ def to_json private - sig { params(type: T.any(String, Type)).returns(Type) } def deserialize_type(type) return type if type.is_a?(Type) Type.deserialize(type) end - sig { void } def validate validate_attributes validate_type end - sig { void } def validate_type return if Type.valid?(type) raise InvalidType, type end - sig { void } def validate_attributes [ [Type::Text, text], diff --git a/lib/whatsapp_sdk/resource/phone_number.rb b/lib/whatsapp_sdk/resource/phone_number.rb index 021a2cb..93243cb 100644 --- a/lib/whatsapp_sdk/resource/phone_number.rb +++ b/lib/whatsapp_sdk/resource/phone_number.rb @@ -1,28 +1,16 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class PhoneNumber - extend T::Sig + attr_accessor :phone, :wa_id, :type - sig { returns(String) } - attr_accessor :phone - - sig { returns(String) } - attr_accessor :wa_id - - sig { returns(AddressType) } - attr_accessor :type - - sig { params(phone: String, type: AddressType, wa_id: String).void } def initialize(phone:, type:, wa_id:) @phone = phone @type = type @wa_id = wa_id end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { phone: @phone, diff --git a/lib/whatsapp_sdk/resource/template.rb b/lib/whatsapp_sdk/resource/template.rb index 3bb3fb6..32fc1bd 100644 --- a/lib/whatsapp_sdk/resource/template.rb +++ b/lib/whatsapp_sdk/resource/template.rb @@ -1,17 +1,9 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Template - extend T::Sig - - sig { returns(String) } - attr_accessor :id - class Status < T::Enum - extend T::Sig - enums do PENDING_DELETION = new("PENDING_DELETION") APPROVED = new("APPROVED") @@ -20,12 +12,7 @@ class Status < T::Enum end end - sig { returns(Status) } - attr_accessor :status - class Category < T::Enum - extend T::Sig - enums do AUTHENTICATION = new("AUTHENTICATION") MARKETING = new("MARKETING") @@ -33,24 +20,8 @@ class Category < T::Enum end end - sig { returns(Category) } - attr_accessor :category + attr_accessor :id,:status, :category, :language, :name, :components_json - sig { returns(T.nilable(String)) } - attr_accessor :language - - sig { returns(T.nilable(String)) } - attr_accessor :name - - sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) } - attr_accessor :components_json - - sig do - params( - id: String, status: Status, category: Category, language: T.nilable(String), name: T.nilable(String), - components_json: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]) - ).void - end def initialize(id:, status:, category:, language: nil, name: nil, components_json: nil) @id = id @status = status diff --git a/lib/whatsapp_sdk/resource/url.rb b/lib/whatsapp_sdk/resource/url.rb index f72c14a..d3a17c4 100644 --- a/lib/whatsapp_sdk/resource/url.rb +++ b/lib/whatsapp_sdk/resource/url.rb @@ -1,24 +1,15 @@ -# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class Url - extend T::Sig + attr_accessor :url, :type - sig { returns(String) } - attr_accessor :url - - sig { returns(AddressType) } - attr_accessor :type - - sig { params(url: String, type: AddressType).void } def initialize(url:, type:) @url = url @type = type end - sig { returns(T::Hash[T.untyped, T.untyped]) } def to_h { url: @url, diff --git a/lib/whatsapp_sdk/version.rb b/lib/whatsapp_sdk/version.rb index 004ad67..850687c 100644 --- a/lib/whatsapp_sdk/version.rb +++ b/lib/whatsapp_sdk/version.rb @@ -1,4 +1,4 @@ -# typed: strict + # frozen_string_literal: true module WhatsappSdk From c2f7b132f5c27f3a205c1eaec5edd79c109830de Mon Sep 17 00:00:00 2001 From: ignacio-chiazzo Date: Sat, 31 Aug 2024 20:26:28 -0300 Subject: [PATCH 3/5] remove /sorbet folder --- sorbet/config | 6 - sorbet/rbi/annotations/faraday.rbi | 17 - sorbet/rbi/annotations/mocha.rbi | 34 - sorbet/rbi/annotations/rainbow.rbi | 269 -- sorbet/rbi/gems/faraday-multipart@1.0.4.rbi | 270 -- sorbet/rbi/gems/faraday-net_http@2.0.3.rbi | 182 -- sorbet/rbi/gems/faraday@2.3.0.rbi | 2494 ------------------- sorbet/rbi/gems/method_source@1.0.0.rbi | 272 -- sorbet/rbi/gems/minitest@5.16.1.rbi | 1459 ----------- sorbet/rbi/gems/mocha@1.14.0.rbi | 60 - sorbet/rbi/gems/multipart-post@2.2.3.rbi | 239 -- sorbet/rbi/gems/netrc@0.11.0.rbi | 150 -- sorbet/rbi/gems/oj@3.13.14.rbi | 589 ----- sorbet/rbi/gems/zeitwerk@2.6.0.rbi | 867 ------- sorbet/rbi/todo.rbi | 8 - sorbet/shims/request.rbi | 10 - sorbet/tapioca/config.yml | 13 - sorbet/tapioca/require.rb | 4 - 18 files changed, 6943 deletions(-) delete mode 100644 sorbet/config delete mode 100644 sorbet/rbi/annotations/faraday.rbi delete mode 100644 sorbet/rbi/annotations/mocha.rbi delete mode 100644 sorbet/rbi/annotations/rainbow.rbi delete mode 100644 sorbet/rbi/gems/faraday-multipart@1.0.4.rbi delete mode 100644 sorbet/rbi/gems/faraday-net_http@2.0.3.rbi delete mode 100644 sorbet/rbi/gems/faraday@2.3.0.rbi delete mode 100644 sorbet/rbi/gems/method_source@1.0.0.rbi delete mode 100644 sorbet/rbi/gems/minitest@5.16.1.rbi delete mode 100644 sorbet/rbi/gems/mocha@1.14.0.rbi delete mode 100644 sorbet/rbi/gems/multipart-post@2.2.3.rbi delete mode 100644 sorbet/rbi/gems/netrc@0.11.0.rbi delete mode 100644 sorbet/rbi/gems/oj@3.13.14.rbi delete mode 100644 sorbet/rbi/gems/zeitwerk@2.6.0.rbi delete mode 100644 sorbet/rbi/todo.rbi delete mode 100644 sorbet/shims/request.rbi delete mode 100644 sorbet/tapioca/config.yml delete mode 100644 sorbet/tapioca/require.rb diff --git a/sorbet/config b/sorbet/config deleted file mode 100644 index 34409a0..0000000 --- a/sorbet/config +++ /dev/null @@ -1,6 +0,0 @@ ---dir -. ---ignore=vendor/ ---ignore=testing.rb ---ignore=example.rb ---enable-experimental-requires-ancestor \ No newline at end of file diff --git a/sorbet/rbi/annotations/faraday.rbi b/sorbet/rbi/annotations/faraday.rbi deleted file mode 100644 index 5924071..0000000 --- a/sorbet/rbi/annotations/faraday.rbi +++ /dev/null @@ -1,17 +0,0 @@ -# typed: strict - -# DO NOT EDIT MANUALLY -# This file was pulled from a central RBI files repository. -# Please run `bin/tapioca annotations` to update it. - -module Faraday - class << self - sig { params(url: T.untyped, options: T::Hash[Symbol, T.untyped], block: T.nilable(T.proc.params(connection: Faraday::Connection).void)).returns(Faraday::Connection) } - def new(url = nil, options = {}, &block); end - end -end - -class Faraday::Response - sig { returns(T::Boolean) } - def success?; end -end diff --git a/sorbet/rbi/annotations/mocha.rbi b/sorbet/rbi/annotations/mocha.rbi deleted file mode 100644 index 223adf1..0000000 --- a/sorbet/rbi/annotations/mocha.rbi +++ /dev/null @@ -1,34 +0,0 @@ -# typed: strict - -# DO NOT EDIT MANUALLY -# This file was pulled from a central RBI files repository. -# Please run `bin/tapioca annotations` to update it. - -module Mocha::API - sig { params(arguments: T.untyped).returns(Mocha::Mock) } - def mock(*arguments); end - - sig { params(arguments: T.untyped).returns(T.untyped) } - def stub(*arguments); end -end - -module Mocha::ClassMethods - sig { returns(Mocha::Mock) } - def any_instance; end -end - -class Mocha::Expectation - sig { params(expected_parameters: T.untyped, matching_block: T.nilable(T.proc.params(actual_parameters: T.untyped).void)).returns(Mocha::Expectation) } - def with(*expected_parameters, &matching_block); end - - sig { params(values: T.untyped).returns(Mocha::Expectation) } - def returns(*values); end -end - -module Mocha::ObjectMethods - sig { params(expected_methods_vs_return_values: T.untyped).returns(Mocha::Expectation) } - def expects(expected_methods_vs_return_values); end - - sig { params(stubbed_methods_vs_return_values: T.untyped).returns(Mocha::Expectation) } - def stubs(stubbed_methods_vs_return_values); end -end diff --git a/sorbet/rbi/annotations/rainbow.rbi b/sorbet/rbi/annotations/rainbow.rbi deleted file mode 100644 index 60ba90a..0000000 --- a/sorbet/rbi/annotations/rainbow.rbi +++ /dev/null @@ -1,269 +0,0 @@ -# typed: strict - -# DO NOT EDIT MANUALLY -# This file was pulled from a central RBI files repository. -# Please run `bin/tapioca annotations` to update it. - -module Rainbow - # @shim: https://github.com/sickill/rainbow/blob/master/lib/rainbow.rb#L10-L12 - sig { returns(T::Boolean) } - attr_accessor :enabled - - class Color - sig { returns(Symbol) } - attr_reader :ground - - sig { params(ground: Symbol, values: T.any([Integer], [Integer, Integer, Integer])).returns(Color) } - def self.build(ground, values); end - - sig { params(hex: String).returns([Integer, Integer, Integer]) } - def self.parse_hex_color(hex); end - - class Indexed < Rainbow::Color - sig { returns(Integer) } - attr_reader :num - - sig { params(ground: Symbol, num: Integer).void } - def initialize(ground, num); end - - sig { returns(T::Array[Integer]) } - def codes; end - end - - class Named < Rainbow::Color::Indexed - NAMES = T.let(nil, T::Hash[Symbol, Integer]) - - sig { params(ground: Symbol, name: Symbol).void } - def initialize(ground, name); end - - sig { returns(T::Array[Symbol]) } - def self.color_names; end - - sig { returns(String) } - def self.valid_names; end - end - - class RGB < Rainbow::Color::Indexed - sig { returns(Integer) } - attr_reader :r, :g, :b - - sig { params(ground: Symbol, values: Integer).void } - def initialize(ground, *values); end - - sig { returns(T::Array[Integer]) } - def codes; end - - sig { params(value: Numeric).returns(Integer) } - def self.to_ansi_domain(value); end - end - - class X11Named < Rainbow::Color::RGB - include Rainbow::X11ColorNames - - sig { returns(T::Array[Symbol]) } - def self.color_names; end - - sig { returns(String) } - def self.valid_names; end - - sig { params(ground: Symbol, name: Symbol).void } - def initialize(ground, name); end - end - end - - sig { returns(Wrapper) } - def self.global; end - - sig { returns(T::Boolean) } - def self.enabled; end - - sig { params(value: T::Boolean).returns(T::Boolean) } - def self.enabled=(value); end - - sig { params(string: String).returns(String) } - def self.uncolor(string); end - - class NullPresenter < String - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } - def color(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } - def foreground(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } - def fg(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } - def background(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } - def bg(*values); end - - sig { returns(NullPresenter) } - def reset; end - - sig { returns(NullPresenter) } - def bright; end - - sig { returns(NullPresenter) } - def faint; end - - sig { returns(NullPresenter) } - def italic; end - - sig { returns(NullPresenter) } - def underline; end - - sig { returns(NullPresenter) } - def blink; end - - sig { returns(NullPresenter) } - def inverse; end - - sig { returns(NullPresenter) } - def hide; end - - sig { returns(NullPresenter) } - def cross_out; end - - sig { returns(NullPresenter) } - def black; end - - sig { returns(NullPresenter) } - def red; end - - sig { returns(NullPresenter) } - def green; end - - sig { returns(NullPresenter) } - def yellow; end - - sig { returns(NullPresenter) } - def blue; end - - sig { returns(NullPresenter) } - def magenta; end - - sig { returns(NullPresenter) } - def cyan; end - - sig { returns(NullPresenter) } - def white; end - - sig { returns(NullPresenter) } - def bold; end - - sig { returns(NullPresenter) } - def dark; end - - sig { returns(NullPresenter) } - def strike; end - end - - class Presenter < String - TERM_EFFECTS = T.let(nil, T::Hash[Symbol, Integer]) - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } - def color(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } - def foreground(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } - def fg(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } - def background(*values); end - - sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } - def bg(*values); end - - sig { returns(Presenter) } - def reset; end - - sig { returns(Presenter) } - def bright; end - - sig { returns(Presenter) } - def faint; end - - sig { returns(Presenter) } - def italic; end - - sig { returns(Presenter) } - def underline; end - - sig { returns(Presenter) } - def blink; end - - sig { returns(Presenter) } - def inverse; end - - sig { returns(Presenter) } - def hide; end - - sig { returns(Presenter) } - def cross_out; end - - sig { returns(Presenter) } - def black; end - - sig { returns(Presenter) } - def red; end - - sig { returns(Presenter) } - def green; end - - sig { returns(Presenter) } - def yellow; end - - sig { returns(Presenter) } - def blue; end - - sig { returns(Presenter) } - def magenta; end - - sig { returns(Presenter) } - def cyan; end - - sig { returns(Presenter) } - def white; end - - sig { returns(Presenter) } - def bold; end - - sig { returns(Presenter) } - def dark; end - - sig { returns(Presenter) } - def strike; end - end - - class StringUtils - sig { params(string: String, codes: T::Array[Integer]).returns(String) } - def self.wrap_with_sgr(string, codes); end - - sig { params(string: String).returns(String) } - def self.uncolor(string); end - end - - VERSION = T.let(nil, String) - - class Wrapper - sig { returns(T::Boolean) } - attr_accessor :enabled - - sig { params(enabled: T::Boolean).void } - def initialize(enabled = true); end - - sig { params(string: String).returns(T.any(Rainbow::Presenter, Rainbow::NullPresenter)) } - def wrap(string); end - end - - module X11ColorNames - NAMES = T.let(nil, T::Hash[Symbol, [Integer, Integer, Integer]]) - end -end - -sig { params(string: String).returns(Rainbow::Presenter) } -def Rainbow(string); end diff --git a/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi b/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi deleted file mode 100644 index d4aa1a6..0000000 --- a/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +++ /dev/null @@ -1,270 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `faraday-multipart` gem. -# Please instead update this file by running `bin/tapioca gem faraday-multipart`. - -# source://faraday-multipart-1.0.4/lib/faraday/multipart/version.rb:3 -module Faraday - class << self - # source://faraday-2.3.0/lib/faraday.rb:55 - def default_adapter; end - - # source://faraday-2.3.0/lib/faraday.rb:102 - def default_adapter=(adapter); end - - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options; end - - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:120 - def default_connection; end - - # source://faraday-2.3.0/lib/faraday.rb:62 - def default_connection=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:127 - def default_connection_options; end - - # source://faraday-2.3.0/lib/faraday.rb:134 - def default_connection_options=(options); end - - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy; end - - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path; end - - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:96 - def new(url = T.unsafe(nil), options = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday.rb:107 - def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path; end - - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path=(_arg0); end - - private - - # source://faraday-2.3.0/lib/faraday.rb:143 - def method_missing(name, *args, &block); end - end -end - -# source://faraday-2.3.0/lib/faraday.rb:34 -Faraday::CONTENT_TYPE = T.let(T.unsafe(nil), String) - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:18 -Faraday::CompositeReadIO = Faraday::Multipart::CompositeReadIO - -# Aliases for Faraday v1, these are all deprecated and will be removed in v2 of this middleware -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:15 -Faraday::FilePart = Multipart::Post::UploadIO - -# source://faraday-2.3.0/lib/faraday/methods.rb:5 -Faraday::METHODS_WITH_BODY = T.let(T.unsafe(nil), Array) - -# source://faraday-2.3.0/lib/faraday/methods.rb:4 -Faraday::METHODS_WITH_QUERY = T.let(T.unsafe(nil), Array) - -# Main Faraday::Multipart module. -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart/version.rb:5 -module Faraday::Multipart - class << self - # source://faraday-multipart-1.0.4/lib/faraday/multipart/version.rb:8 - def multipart_post_version; end - end -end - -# Similar to, but not compatible with CompositeReadIO provided by the -# multipart-post gem. -# https://github.com/nicksieger/multipart-post/blob/master/lib/composite_io.rb -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:67 -class Faraday::Multipart::CompositeReadIO - # @return [CompositeReadIO] a new instance of CompositeReadIO - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:68 - def initialize(*parts); end - - # Close each of the IOs. - # - # @return [void] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:111 - def close; end - - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:115 - def ensure_open_and_readable; end - - # @return [Integer] sum of the lengths of all the parts - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:75 - def length; end - - # Read from IOs in order until `length` bytes have been received. - # - # @param length [Integer, nil] - # @param outbuf [String, nil] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:91 - def read(length = T.unsafe(nil), outbuf = T.unsafe(nil)); end - - # Rewind each of the IOs and reset the index to 0. - # - # @return [void] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:82 - def rewind; end - - private - - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:125 - def advance_io; end - - # source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:121 - def current_io; end -end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:55 -Faraday::Multipart::FilePart = Multipart::Post::UploadIO - -# Middleware for supporting multi-part requests. -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:8 -class Faraday::Multipart::Middleware < ::Faraday::Request::UrlEncoded - # @return [Middleware] a new instance of Middleware - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:13 - def initialize(app = T.unsafe(nil), options = T.unsafe(nil)); end - - # Checks for files in the payload, otherwise leaves everything untouched. - # - # @param env [Faraday::Env] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:21 - def call(env); end - - # @param env [Faraday::Env] - # @param params [Hash] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:55 - def create_multipart(env, params); end - - # Returns true if obj is an enumerable with values that are multipart. - # - # @param obj [Object] - # @return [Boolean] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:44 - def has_multipart?(obj); end - - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:67 - def part(boundary, key, value); end - - # @param params [Hash] - # @param prefix [String] - # @param pieces [Array] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:83 - def process_params(params, prefix = T.unsafe(nil), pieces = T.unsafe(nil), &block); end - - # @param env [Faraday::Env] - # @return [Boolean] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:32 - def process_request?(env); end - - # @return [String] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:76 - def unique_boundary; end -end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:9 -Faraday::Multipart::Middleware::DEFAULT_BOUNDARY_PREFIX = T.let(T.unsafe(nil), String) - -# Multipart value used to POST data with a content type. -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:6 -class Faraday::Multipart::ParamPart - # @param value [String] Uploaded content as a String. - # @param content_type [String] String content type of the value. - # @param content_id [String] Optional String of this value's Content-ID. - # @return [Faraday::ParamPart] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:12 - def initialize(value, content_type, content_id = T.unsafe(nil)); end - - # The value's content ID, if given. - # - # @return [String, nil] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:52 - def content_id; end - - # The value's content type. - # - # @return [String] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:47 - def content_type; end - - # Returns a Hash of String key/value pairs. - # - # @return [Hash] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:32 - def headers; end - - # Converts this value to a form part. - # - # @param boundary [String] String multipart boundary that must not exist in - # the content exactly. - # @param key [String] String key name for this value. - # @return [Faraday::Parts::Part] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:25 - def to_part(boundary, key); end - - # The content to upload. - # - # @return [String] - # - # source://faraday-multipart-1.0.4/lib/faraday/multipart/param_part.rb:42 - def value; end -end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart/file_part.rb:56 -Faraday::Multipart::Parts = Multipart::Post::Parts - -# source://faraday-multipart-1.0.4/lib/faraday/multipart/version.rb:6 -Faraday::Multipart::VERSION = T.let(T.unsafe(nil), String) - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:16 -Faraday::ParamPart = Faraday::Multipart::ParamPart - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:17 -Faraday::Parts = Multipart::Post::Parts - -# multipart-post v2.2.0 introduces a new class hierarchy for classes like Parts and UploadIO -# For backwards compatibility, detect the gem version and use the right class -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:21 -Faraday::UploadIO = Multipart::Post::UploadIO - -# source://faraday-2.3.0/lib/faraday/version.rb:4 -Faraday::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi b/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi deleted file mode 100644 index 0e81c5a..0000000 --- a/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi +++ /dev/null @@ -1,182 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `faraday-net_http` gem. -# Please instead update this file by running `bin/tapioca gem faraday-net_http`. - -# source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:12 -module Faraday - class << self - # source://faraday-2.3.0/lib/faraday.rb:55 - def default_adapter; end - - # source://faraday-2.3.0/lib/faraday.rb:102 - def default_adapter=(adapter); end - - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options; end - - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:120 - def default_connection; end - - # source://faraday-2.3.0/lib/faraday.rb:62 - def default_connection=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:127 - def default_connection_options; end - - # source://faraday-2.3.0/lib/faraday.rb:134 - def default_connection_options=(options); end - - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy; end - - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path; end - - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path=(_arg0); end - - # source://faraday-2.3.0/lib/faraday.rb:96 - def new(url = T.unsafe(nil), options = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday.rb:107 - def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path; end - - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path=(_arg0); end - - private - - # source://faraday-2.3.0/lib/faraday.rb:143 - def method_missing(name, *args, &block); end - end -end - -# source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:13 -class Faraday::Adapter - # source://faraday-2.3.0/lib/faraday/adapter.rb:28 - def initialize(_app = T.unsafe(nil), opts = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:55 - def call(env); end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:50 - def close; end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:41 - def connection(env); end - - private - - # source://faraday-2.3.0/lib/faraday/adapter.rb:86 - def request_timeout(type, options); end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:62 - def save_response(env, status, body, headers = T.unsafe(nil), reason_phrase = T.unsafe(nil)); end -end - -# source://faraday-2.3.0/lib/faraday/adapter.rb:9 -Faraday::Adapter::CONTENT_LENGTH = T.let(T.unsafe(nil), String) - -# source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:14 -class Faraday::Adapter::NetHttp < ::Faraday::Adapter - # @return [NetHttp] a new instance of NetHttp - # - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:38 - def initialize(app = T.unsafe(nil), opts = T.unsafe(nil), &block); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:43 - def build_connection(env); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:63 - def call(env); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:51 - def net_http_connection(env); end - - private - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:172 - def configure_request(http, req); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:156 - def configure_ssl(http, ssl); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:88 - def create_request(env); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:211 - def encoded_body(http_response); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:104 - def perform_request(http, env); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:134 - def request_via_get_method(http, env, &block); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:142 - def request_via_request_method(http, env, &block); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:125 - def request_with_wrapped_block(http, env, &block); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:192 - def ssl_cert_store(ssl); end - - # source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:201 - def ssl_verify_mode(ssl); end -end - -# source://faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:36 -Faraday::Adapter::NetHttp::NET_HTTP_EXCEPTIONS = T.let(T.unsafe(nil), Array) - -# source://faraday-2.3.0/lib/faraday/adapter.rb:94 -Faraday::Adapter::TIMEOUT_KEYS = T.let(T.unsafe(nil), Hash) - -# source://faraday-2.3.0/lib/faraday.rb:34 -Faraday::CONTENT_TYPE = T.let(T.unsafe(nil), String) - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:18 -Faraday::CompositeReadIO = Faraday::Multipart::CompositeReadIO - -# Aliases for Faraday v1, these are all deprecated and will be removed in v2 of this middleware -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:15 -Faraday::FilePart = Multipart::Post::UploadIO - -# source://faraday-2.3.0/lib/faraday/methods.rb:5 -Faraday::METHODS_WITH_BODY = T.let(T.unsafe(nil), Array) - -# source://faraday-2.3.0/lib/faraday/methods.rb:4 -Faraday::METHODS_WITH_QUERY = T.let(T.unsafe(nil), Array) - -# source://faraday-net_http-2.0.3/lib/faraday/net_http/version.rb:4 -module Faraday::NetHttp; end - -# source://faraday-net_http-2.0.3/lib/faraday/net_http/version.rb:5 -Faraday::NetHttp::VERSION = T.let(T.unsafe(nil), String) - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:16 -Faraday::ParamPart = Faraday::Multipart::ParamPart - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:17 -Faraday::Parts = Multipart::Post::Parts - -# multipart-post v2.2.0 introduces a new class hierarchy for classes like Parts and UploadIO -# For backwards compatibility, detect the gem version and use the right class -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:21 -Faraday::UploadIO = Multipart::Post::UploadIO - -# source://faraday-2.3.0/lib/faraday/version.rb:4 -Faraday::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/faraday@2.3.0.rbi b/sorbet/rbi/gems/faraday@2.3.0.rbi deleted file mode 100644 index d55cc3a..0000000 --- a/sorbet/rbi/gems/faraday@2.3.0.rbi +++ /dev/null @@ -1,2494 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `faraday` gem. -# Please instead update this file by running `bin/tapioca gem faraday`. - -# conn.get '/' -# -# source://faraday-2.3.0/lib/faraday/version.rb:3 -module Faraday - class << self - # @overload default_adapter - # @overload default_adapter= - # - # source://faraday-2.3.0/lib/faraday.rb:55 - def default_adapter; end - - # Documented elsewhere, see default_adapter reader - # - # source://faraday-2.3.0/lib/faraday.rb:102 - def default_adapter=(adapter); end - - # Option for the default_adapter - # @return [Hash] default_adapter options - # - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options; end - - # Option for the default_adapter - # @return [Hash] default_adapter options - # - # source://faraday-2.3.0/lib/faraday.rb:59 - def default_adapter_options=(_arg0); end - - # @overload default_connection - # @overload default_connection= - # - # source://faraday-2.3.0/lib/faraday.rb:120 - def default_connection; end - - # Documented below, see default_connection - # - # source://faraday-2.3.0/lib/faraday.rb:62 - def default_connection=(_arg0); end - - # Gets the default connection options used when calling {Faraday#new}. - # - # @return [Faraday::ConnectionOptions] - # - # source://faraday-2.3.0/lib/faraday.rb:127 - def default_connection_options; end - - # Sets the default options used when calling {Faraday#new}. - # - # @param options [Hash, Faraday::ConnectionOptions] - # - # source://faraday-2.3.0/lib/faraday.rb:134 - def default_connection_options=(options); end - - # Tells Faraday to ignore the environment proxy (http_proxy). - # Defaults to `false`. - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy; end - - # Tells Faraday to ignore the environment proxy (http_proxy). - # Defaults to `false`. - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday.rb:67 - def ignore_env_proxy=(_arg0); end - - # Gets or sets the path that the Faraday libs are loaded from. - # - # @return [String] - # - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path; end - - # Gets or sets the path that the Faraday libs are loaded from. - # - # @return [String] - # - # source://faraday-2.3.0/lib/faraday.rb:46 - def lib_path=(_arg0); end - - # Initializes a new {Connection}. - # - # @example With an URL argument - # Faraday.new 'http://faraday.com' - # # => Faraday::Connection to http://faraday.com - # @example With everything in an options hash - # Faraday.new url: 'http://faraday.com', - # params: { page: 1 } - # # => Faraday::Connection to http://faraday.com?page=1 - # @example With an URL argument and an options hash - # Faraday.new 'http://faraday.com', params: { page: 1 } - # # => Faraday::Connection to http://faraday.com?page=1 - # @option options - # @option options - # @option options - # @option options - # @option options - # @option options - # @param url [String, Hash] The optional String base URL to use as a prefix - # for all requests. Can also be the options Hash. Any of these - # values will be set on every request made, unless overridden - # for a specific request. - # @param options [Hash] - # @return [Faraday::Connection] - # - # source://faraday-2.3.0/lib/faraday.rb:96 - def new(url = T.unsafe(nil), options = T.unsafe(nil), &block); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday.rb:107 - def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end - - # The root path that Faraday is being loaded from. - # - # This is the root from where the libraries are auto-loaded. - # - # @return [String] - # - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path; end - - # The root path that Faraday is being loaded from. - # - # This is the root from where the libraries are auto-loaded. - # - # @return [String] - # - # source://faraday-2.3.0/lib/faraday.rb:42 - def root_path=(_arg0); end - - private - - # Internal: Proxies method calls on the Faraday constant to - # .default_connection. - # - # source://faraday-2.3.0/lib/faraday.rb:143 - def method_missing(name, *args, &block); end - end -end - -# Base class for all Faraday adapters. Adapters are -# responsible for fulfilling a Faraday request. -# -# source://faraday-2.3.0/lib/faraday/adapter.rb:6 -class Faraday::Adapter - extend ::Faraday::MiddlewareRegistry - extend ::Faraday::Adapter::Parallelism - - # @return [Adapter] a new instance of Adapter - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:28 - def initialize(_app = T.unsafe(nil), opts = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:55 - def call(env); end - - # Close any persistent connections. The adapter should still be usable - # after calling close. - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:50 - def close; end - - # Yields or returns an adapter's configured connection. Depends on - # #build_connection being defined on this adapter. - # - # @param env [Faraday::Env, Hash] The env object for a faraday request. - # @return The return value of the given block, or the HTTP connection object - # if no block is given. - # @yield [conn] - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:41 - def connection(env); end - - private - - # Fetches either a read, write, or open timeout setting. Defaults to the - # :timeout value if a more specific one is not given. - # - # @param type [Symbol] Describes which timeout setting to get: :read, - # :write, or :open. - # @param options [Hash] Hash containing Symbol keys like :timeout, - # :read_timeout, :write_timeout, :open_timeout, or - # :timeout - # @return [Integer, nil] Timeout duration in seconds, or nil if no timeout - # has been set. - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:86 - def request_timeout(type, options); end - - # source://faraday-2.3.0/lib/faraday/adapter.rb:62 - def save_response(env, status, body, headers = T.unsafe(nil), reason_phrase = T.unsafe(nil)); end -end - -# source://faraday-2.3.0/lib/faraday/adapter.rb:9 -Faraday::Adapter::CONTENT_LENGTH = T.let(T.unsafe(nil), String) - -# This module marks an Adapter as supporting parallel requests. -# -# source://faraday-2.3.0/lib/faraday/adapter.rb:12 -module Faraday::Adapter::Parallelism - # source://faraday-2.3.0/lib/faraday/adapter.rb:19 - def inherited(subclass); end - - # Sets the attribute supports_parallel - # - # @param value the value to set the attribute supports_parallel to. - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:13 - def supports_parallel=(_arg0); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter.rb:15 - def supports_parallel?; end -end - -# source://faraday-2.3.0/lib/faraday/adapter.rb:94 -Faraday::Adapter::TIMEOUT_KEYS = T.let(T.unsafe(nil), Hash) - -# @example -# test = Faraday::Connection.new do -# use Faraday::Adapter::Test do |stub| -# # Define matcher to match the request -# stub.get '/resource.json' do -# # return static content -# [200, {'Content-Type' => 'application/json'}, 'hi world'] -# end -# -# # response with content generated based on request -# stub.get '/showget' do |env| -# [200, {'Content-Type' => 'text/plain'}, env[:method].to_s] -# end -# -# # A regular expression can be used as matching filter -# stub.get /\A\/items\/(\d+)\z/ do |env, meta| -# # in case regular expression is used, an instance of MatchData -# # can be received -# [200, -# {'Content-Type' => 'text/plain'}, -# "showing item: #{meta[:match_data][1]}" -# ] -# end -# -# # You can set strict_mode to exactly match the stubbed requests. -# stub.strict_mode = true -# end -# end -# -# resp = test.get '/resource.json' -# resp.body # => 'hi world' -# -# resp = test.get '/showget' -# resp.body # => 'get' -# -# resp = test.get '/items/1' -# resp.body # => 'showing item: 1' -# -# resp = test.get '/items/2' -# resp.body # => 'showing item: 2' -# -# source://faraday-2.3.0/lib/faraday/adapter/test.rb:45 -class Faraday::Adapter::Test < ::Faraday::Adapter - # @return [Test] a new instance of Test - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:230 - def initialize(app, stubs = T.unsafe(nil), &block); end - - # @param env [Faraday::Env] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:241 - def call(env); end - - # @yield [stubs] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:236 - def configure; end - - # Returns the value of attribute stubs. - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:46 - def stubs; end - - # Sets the attribute stubs - # - # @param value the value to set the attribute stubs to. - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:46 - def stubs=(_arg0); end -end - -# Stub request -# -# source://faraday-2.3.0/lib/faraday/adapter/test.rb:171 -class Faraday::Adapter::Test::Stub < ::Struct - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:210 - def headers_match?(request_headers); end - - # @param env [Faraday::Env] - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:172 - def matches?(env); end - - # @param env [Faraday::Env] - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:197 - def params_match?(env); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:188 - def path_match?(request_path, meta); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:225 - def to_s; end -end - -# A stack of Stubs -# -# source://faraday-2.3.0/lib/faraday/adapter/test.rb:49 -class Faraday::Adapter::Test::Stubs - # @return [Stubs] a new instance of Stubs - # @yield [_self] - # @yieldparam _self [Faraday::Adapter::Test::Stubs] the object that the method was called on - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:53 - def initialize(strict_mode: T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:105 - def delete(path, headers = T.unsafe(nil), &block); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:62 - def empty?; end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:85 - def get(path, headers = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:89 - def head(path, headers = T.unsafe(nil), &block); end - - # @param env [Faraday::Env] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:67 - def match(env); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:109 - def options(path, headers = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:101 - def patch(path, body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:93 - def post(path, body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:97 - def put(path, body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # Set strict_mode. If the value is true, this adapter tries to find matched requests strictly, - # which means that all of a path, parameters, and headers must be the same as an actual request. - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:130 - def strict_mode=(value); end - - # Raises an error if any of the stubbed calls have not been made. - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:114 - def verify_stubbed_calls; end - - protected - - # @param stack [Hash] - # @param env [Faraday::Env] - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:160 - def matches?(stack, env); end - - # source://faraday-2.3.0/lib/faraday/adapter/test.rb:141 - def new_stub(request_method, path, headers = T.unsafe(nil), body = T.unsafe(nil), &block); end -end - -# source://faraday-2.3.0/lib/faraday/adapter/test.rb:50 -class Faraday::Adapter::Test::Stubs::NotFound < ::StandardError; end - -# AdapterRegistry registers adapter class names so they can be looked up by a -# String or Symbol name. -# -# source://faraday-2.3.0/lib/faraday/adapter_registry.rb:8 -class Faraday::AdapterRegistry - # @return [AdapterRegistry] a new instance of AdapterRegistry - # - # source://faraday-2.3.0/lib/faraday/adapter_registry.rb:9 - def initialize; end - - # source://faraday-2.3.0/lib/faraday/adapter_registry.rb:14 - def get(name); end - - # source://faraday-2.3.0/lib/faraday/adapter_registry.rb:23 - def set(klass, name = T.unsafe(nil)); end -end - -# Raised by Faraday::Response::RaiseError in case of a 400 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:90 -class Faraday::BadRequestError < ::Faraday::ClientError; end - -# source://faraday-2.3.0/lib/faraday.rb:34 -Faraday::CONTENT_TYPE = T.let(T.unsafe(nil), String) - -# Faraday client error class. Represents 4xx status responses. -# -# source://faraday-2.3.0/lib/faraday/error.rb:86 -class Faraday::ClientError < ::Faraday::Error; end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:18 -Faraday::CompositeReadIO = Faraday::Multipart::CompositeReadIO - -# Raised by Faraday::Response::RaiseError in case of a 409 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:110 -class Faraday::ConflictError < ::Faraday::ClientError; end - -# Connection objects manage the default properties and the middleware -# stack for fulfilling an HTTP request. -# -# @example -# -# conn = Faraday::Connection.new 'http://httpbingo.org' -# -# # GET http://httpbingo.org/nigiri -# conn.get 'nigiri' -# # => # -# -# source://faraday-2.3.0/lib/faraday/connection.rb:15 -class Faraday::Connection - extend ::Forwardable - - # Initializes a new Faraday::Connection. - # - # @option options - # @option options - # @option options - # @option options - # @option options - # @option options - # @option options - # @option options - # @option options - # @param url [URI, String] URI or String base URL to use as a prefix for all - # requests (optional). - # @param options [Hash, Faraday::ConnectionOptions] - # @return [Connection] a new instance of Connection - # @yield [self] after all setup has been done - # - # source://faraday-2.3.0/lib/faraday/connection.rb:63 - def initialize(url = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://RUBY_ROOT/forwardable.rb:229 - def adapter(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def app(*args, **_arg1, &block); end - - # Build an absolute URL based on url_prefix. - # - # of the resulting url (default: nil). - # - # @param url [String, URI] - # @param params [Faraday::Utils::ParamsHash] A Faraday::Utils::ParamsHash to - # replace the query values - # @return [URI] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:471 - def build_exclusive_url(url = T.unsafe(nil), params = T.unsafe(nil), params_encoder = T.unsafe(nil)); end - - # Creates and configures the request object. - # - # @param method [Symbol] - # @return [Faraday::Request] - # @yield [Faraday::Request] if block given - # - # source://faraday-2.3.0/lib/faraday/connection.rb:454 - def build_request(method); end - - # Takes a relative url for a request and combines it with the defaults - # set on the connection instance. - # - # @example - # conn = Faraday::Connection.new { ... } - # conn.url_prefix = "https://httpbingo.org/api?token=abc" - # conn.scheme # => https - # conn.path_prefix # => "/api" - # - # conn.build_url("nigiri?page=2") - # # => https://httpbingo.org/api/nigiri?token=abc&page=2 - # - # conn.build_url("nigiri", page: 2) - # # => https://httpbingo.org/api/nigiri?token=abc&page=2 - # @param url [String] - # @param extra_params [Hash] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:408 - def build_url(url = T.unsafe(nil), extra_params = T.unsafe(nil)); end - - # @return [Faraday::RackBuilder] Builder for this Connection. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:31 - def builder; end - - # Closes the underlying resources and/or connections. In the case of - # persistent connections, this closes all currently open connections - # but does not prevent new connections from being made. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:125 - def close; end - - # Check if the adapter is parallel-capable. - # - # @api private - # @return [Object, nil] a parallel manager or nil if yielded - # @yield if the adapter isn't parallel-capable, or if no adapter is set yet. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:292 - def default_parallel_manager; end - - # Sets the default parallel manager for this connection. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:40 - def default_parallel_manager=(_arg0); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:199 - def delete(url = T.unsafe(nil), params = T.unsafe(nil), headers = T.unsafe(nil)); end - - # Creates a duplicate of this Faraday::Connection. - # - # @api private - # @return [Faraday::Connection] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:491 - def dup; end - - # source://faraday-2.3.0/lib/faraday/connection.rb:539 - def find_default_proxy; end - - # source://faraday-2.3.0/lib/faraday/connection.rb:199 - def get(url = T.unsafe(nil), params = T.unsafe(nil), headers = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:199 - def head(url = T.unsafe(nil), params = T.unsafe(nil), headers = T.unsafe(nil)); end - - # @return [Hash] unencoded HTTP header key/value pairs. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:24 - def headers; end - - # Sets the Hash of unencoded HTTP header key/value pairs. - # - # @param hash [Hash] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:114 - def headers=(hash); end - - # source://RUBY_ROOT/forwardable.rb:229 - def host(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def host=(*args, **_arg1, &block); end - - # Sets up the parallel manager to make a set of requests. - # - # @param manager [Object] The parallel manager that this Connection's - # Adapter uses. - # @return [void] - # @yield a block to execute multiple requests. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:318 - def in_parallel(manager = T.unsafe(nil)); end - - # Determine if this Faraday::Connection can make parallel requests. - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:307 - def in_parallel?; end - - # source://faraday-2.3.0/lib/faraday/connection.rb:96 - def initialize_proxy(url, options); end - - # @example - # conn.options '/items/1' - # @overload options - # @overload options - # @return [Faraday::Response] - # @yield [Faraday::Request] for further request customizations - # - # source://faraday-2.3.0/lib/faraday/connection.rb:222 - def options(*args); end - - # @return [Object] the parallel manager for this Connection. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:37 - def parallel_manager; end - - # @return [Hash] URI query unencoded key/value pairs. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:21 - def params; end - - # Sets the Hash of URI query unencoded key/value pairs. - # - # @param hash [Hash] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:108 - def params=(hash); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:280 - def patch(url = T.unsafe(nil), body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def path_prefix(*args, **_arg1, &block); end - - # Sets the path prefix and ensures that it always has a leading - # slash. - # - # @param value [String] - # @return [String] the new path prefix - # - # source://faraday-2.3.0/lib/faraday/connection.rb:383 - def path_prefix=(value); end - - # source://RUBY_ROOT/forwardable.rb:229 - def port(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def port=(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:280 - def post(url = T.unsafe(nil), body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # @return [Hash] proxy options. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:43 - def proxy; end - - # Sets the Hash proxy options. - # - # @param new_value [Object] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:334 - def proxy=(new_value); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:547 - def proxy_for_request(url); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:514 - def proxy_from_env(url); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:280 - def put(url = T.unsafe(nil), body = T.unsafe(nil), headers = T.unsafe(nil), &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def request(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def response(*args, **_arg1, &block); end - - # Builds and runs the Faraday::Request. - # - # @param method [Symbol] HTTP method. - # @param url [String, URI] String or URI to access. - # @param body [Object] The request body that will eventually be converted to - # a string. - # @param headers [Hash] unencoded HTTP header key/value pairs. - # @return [Faraday::Response] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:432 - def run_request(method, url, body, headers); end - - # source://RUBY_ROOT/forwardable.rb:229 - def scheme(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def scheme=(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:372 - def set_basic_auth(user, password); end - - # @return [Hash] SSL options. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:34 - def ssl; end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:557 - def support_parallel?(adapter); end - - # source://faraday-2.3.0/lib/faraday/connection.rb:199 - def trace(url = T.unsafe(nil), params = T.unsafe(nil), headers = T.unsafe(nil)); end - - # @return [String] a URI with the prefix used for all requests from this - # Connection. This includes a default host name, scheme, port, and path. - # - # source://faraday-2.3.0/lib/faraday/connection.rb:28 - def url_prefix; end - - # Parses the given URL with URI and stores the individual - # components in this connection. These components serve as defaults for - # requests made by this connection. - # - # @example - # - # conn = Faraday::Connection.new { ... } - # conn.url_prefix = "https://httpbingo.org/api" - # conn.scheme # => https - # conn.path_prefix # => "/api" - # - # conn.get("nigiri?page=2") # accesses https://httpbingo.org/api/nigiri - # @param url [String, URI] - # @param encoder [Object] - # - # source://faraday-2.3.0/lib/faraday/connection.rb:357 - def url_prefix=(url, encoder = T.unsafe(nil)); end - - # source://RUBY_ROOT/forwardable.rb:229 - def use(*args, **_arg1, &block); end - - # Yields username and password extracted from a URI if they both exist. - # - # @api private - # @param uri [URI] - # @return [void] - # @yield [username, password] any username and password - # @yieldparam username [String] any username from URI - # @yieldparam password [String] any password from URI - # - # source://faraday-2.3.0/lib/faraday/connection.rb:508 - def with_uri_credentials(uri); end -end - -# A Set of allowed HTTP verbs. -# -# source://faraday-2.3.0/lib/faraday/connection.rb:17 -Faraday::Connection::METHODS = T.let(T.unsafe(nil), Set) - -# source://faraday-2.3.0/lib/faraday/connection.rb:18 -Faraday::Connection::USER_AGENT = T.let(T.unsafe(nil), String) - -# A unified error for failed connections. -# -# source://faraday-2.3.0/lib/faraday/error.rb:137 -class Faraday::ConnectionFailed < ::Faraday::Error; end - -# ConnectionOptions contains the configurable properties for a Faraday -# connection object. -# -# source://faraday-2.3.0/lib/faraday/options/connection_options.rb:8 -class Faraday::ConnectionOptions < ::Faraday::Options - # source://faraday-2.3.0/lib/faraday/options.rb:177 - def builder_class; end - - # source://faraday-2.3.0/lib/faraday/options/connection_options.rb:18 - def new_builder(block); end - - # source://faraday-2.3.0/lib/faraday/options.rb:177 - def request; end - - # source://faraday-2.3.0/lib/faraday/options.rb:177 - def ssl; end -end - -# Sub-module for decoding query-string into parameters. -# -# source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:81 -module Faraday::DecodeMethods - # @param query [nil, String] - # @raise [TypeError] if the nesting is incorrect - # @return [Array] the decoded params - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:87 - def decode(query); end - - protected - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:144 - def add_to_context(is_array, context, value, subkey); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:107 - def decode_pair(key, value, context); end - - # Internal: convert a nested hash with purely numeric keys into an array. - # FIXME: this is not compatible with Rack::Utils.parse_nested_query - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:151 - def dehash(hash, depth); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:139 - def match_context(context, subkey); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:129 - def new_context(subkey, is_array, context); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:119 - def prepare_context(context, subkey, is_array, last_subkey); end -end - -# source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:105 -Faraday::DecodeMethods::SUBKEYS_REGEX = T.let(T.unsafe(nil), Regexp) - -# Sub-module for encoding parameters into query-string. -# -# source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:5 -module Faraday::EncodeMethods - # @param params [nil, Array, #to_hash] parameters to be encoded - # @raise [TypeError] if params can not be converted to a Hash - # @return [String] the encoded params - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:11 - def encode(params); end - - protected - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:64 - def encode_array(parent, value); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:53 - def encode_hash(parent, value); end - - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:40 - def encode_pair(parent, value); end -end - -# source://faraday-2.3.0/lib/faraday/options/env.rb:52 -class Faraday::Env < ::Faraday::Options - extend ::Forwardable - - # @param key [Object] - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:84 - def [](key); end - - # @param key [Object] - # @param value [Object] - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:96 - def []=(key, value); end - - # string. - # - # @return [String] The request body that will eventually be converted to a - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:113 - def body; end - - # string. - # - # @return [String] The request body that will eventually be converted to a - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:117 - def body=(value); end - - # Sets content length to zero and the body to the empty string. - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:133 - def clear_body; end - - # source://faraday-2.3.0/lib/faraday/options/env.rb:109 - def current_body; end - - # @private - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:161 - def custom_members; end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:167 - def in_member_set?(key); end - - # source://faraday-2.3.0/lib/faraday/options/env.rb:149 - def inspect; end - - # set of {MethodsWithBodies}. - # - # @return [Boolean] true if there's no body yet, and the method is in the - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:128 - def needs_body?; end - - # @return [Boolean] true if there is a parallel_manager - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:145 - def parallel?; end - - # source://RUBY_ROOT/forwardable.rb:229 - def params_encoder(*args, **_arg1, &block); end - - # {StatusesWithoutBody}. - # - # @return [Boolean] true if the status isn't in the set of - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:140 - def parse_body?; end - - # @return [Boolean] true if status is in the set of {SuccessfulStatuses}. - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:122 - def success?; end - - class << self - # Build a new Env from given value. Respects and updates `custom_members`. - # - # @param value [Object] a value fitting Option.from(v). - # @return [Env] from given value - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:75 - def from(value); end - - # @private - # - # source://faraday-2.3.0/lib/faraday/options/env.rb:177 - def member_set; end - end -end - -# source://faraday-2.3.0/lib/faraday/options/env.rb:55 -Faraday::Env::ContentLength = T.let(T.unsafe(nil), String) - -# A Set of HTTP verbs that typically send a body. If no body is set for -# these requests, the Content-Length header is set to 0. -# -# source://faraday-2.3.0/lib/faraday/options/env.rb:62 -Faraday::Env::MethodsWithBodies = T.let(T.unsafe(nil), Set) - -# source://faraday-2.3.0/lib/faraday/options/env.rb:56 -Faraday::Env::StatusesWithoutBody = T.let(T.unsafe(nil), Set) - -# source://faraday-2.3.0/lib/faraday/options/env.rb:57 -Faraday::Env::SuccessfulStatuses = T.let(T.unsafe(nil), Range) - -# Faraday error base class. -# -# source://faraday-2.3.0/lib/faraday/error.rb:6 -class Faraday::Error < ::StandardError - # @return [Error] a new instance of Error - # - # source://faraday-2.3.0/lib/faraday/error.rb:9 - def initialize(exc = T.unsafe(nil), response = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/error.rb:15 - def backtrace; end - - # source://faraday-2.3.0/lib/faraday/error.rb:23 - def inspect; end - - # Returns the value of attribute response. - # - # source://faraday-2.3.0/lib/faraday/error.rb:7 - def response; end - - # source://faraday-2.3.0/lib/faraday/error.rb:39 - def response_body; end - - # source://faraday-2.3.0/lib/faraday/error.rb:35 - def response_headers; end - - # source://faraday-2.3.0/lib/faraday/error.rb:31 - def response_status; end - - # Returns the value of attribute wrapped_exception. - # - # source://faraday-2.3.0/lib/faraday/error.rb:7 - def wrapped_exception; end - - protected - - # Pulls out potential parent exception and response hash. - # - # source://faraday-2.3.0/lib/faraday/error.rb:75 - def exc_msg_and_response(exc, response = T.unsafe(nil)); end - - # Pulls out potential parent exception and response hash, storing them in - # instance variables. - # exc - Either an Exception, a string message, or a response hash. - # response - Hash - # :status - Optional integer HTTP response status - # :headers - String key/value hash of HTTP response header - # values. - # :body - Optional string HTTP response body. - # :request - Hash - # :method - Symbol with the request HTTP method. - # :url - URI object with the url requested. - # :url_path - String with the url path requested. - # :params - String key/value hash of query params - # present in the request. - # :headers - String key/value hash of HTTP request - # header values. - # :body - String HTTP request body. - # - # If a subclass has to call this, then it should pass a string message - # to `super`. See NilStatusError. - # - # source://faraday-2.3.0/lib/faraday/error.rb:65 - def exc_msg_and_response!(exc, response = T.unsafe(nil)); end -end - -# Aliases for Faraday v1, these are all deprecated and will be removed in v2 of this middleware -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:15 -Faraday::FilePart = Multipart::Post::UploadIO - -# FlatParamsEncoder manages URI params as a flat hash. Any Array values repeat -# the parameter multiple times. -# -# source://faraday-2.3.0/lib/faraday/encoders/flat_params_encoder.rb:6 -module Faraday::FlatParamsEncoder - class << self - # Decode converts the given URI querystring into a hash. - # - # @example - # - # decode('a=one&a=two&a=three&b=true&c=C') - # # => {"a"=>["one", "two", "three"], "b"=>"true", "c"=>"C"} - # @param query [String] query arguments to parse. - # @return [Hash] parsed keys and value strings from the querystring. - # - # source://faraday-2.3.0/lib/faraday/encoders/flat_params_encoder.rb:74 - def decode(query); end - - # Encode converts the given param into a URI querystring. Keys and values - # will converted to strings and appropriately escaped for the URI. - # - # @example - # - # encode({a: %w[one two three], b: true, c: "C"}) - # # => 'a=one&a=two&a=three&b=true&c=C' - # @param params [Hash] query arguments to convert. - # @return [String] the URI querystring (without the leading '?') - # - # source://faraday-2.3.0/lib/faraday/encoders/flat_params_encoder.rb:23 - def encode(params); end - - # source://RUBY_ROOT/forwardable.rb:229 - def escape(*args, **_arg1, &block); end - - # Returns the value of attribute sort_params. - # - # source://faraday-2.3.0/lib/faraday/encoders/flat_params_encoder.rb:99 - def sort_params; end - - # Sets the attribute sort_params - # - # @param value the value to set the attribute sort_params to. - # - # source://faraday-2.3.0/lib/faraday/encoders/flat_params_encoder.rb:99 - def sort_params=(_arg0); end - - # source://RUBY_ROOT/forwardable.rb:229 - def unescape(*args, **_arg1, &block); end - end -end - -# Raised by Faraday::Response::RaiseError in case of a 403 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:98 -class Faraday::ForbiddenError < ::Faraday::ClientError; end - -# source://faraday-2.3.0/lib/faraday/logging/formatter.rb:6 -module Faraday::Logging; end - -# Serves as an integration point to customize logging -# -# source://faraday-2.3.0/lib/faraday/logging/formatter.rb:8 -class Faraday::Logging::Formatter - extend ::Forwardable - - # @return [Formatter] a new instance of Formatter - # - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:14 - def initialize(logger:, options:); end - - # source://RUBY_ROOT/forwardable.rb:229 - def debug(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def error(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def fatal(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:40 - def filter(filter_word, filter_replacement); end - - # source://RUBY_ROOT/forwardable.rb:229 - def info(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:22 - def request(env); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:32 - def response(env); end - - # source://RUBY_ROOT/forwardable.rb:229 - def warn(*args, **_arg1, &block); end - - private - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:80 - def apply_filters(output); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:50 - def dump_body(body); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:46 - def dump_headers(headers); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:100 - def log_body(type, body); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:71 - def log_body?(type); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:95 - def log_headers(type, headers); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:62 - def log_headers?(type); end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:87 - def log_level; end - - # source://faraday-2.3.0/lib/faraday/logging/formatter.rb:58 - def pretty_inspect(body); end -end - -# source://faraday-2.3.0/lib/faraday/logging/formatter.rb:11 -Faraday::Logging::Formatter::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash) - -# source://faraday-2.3.0/lib/faraday/methods.rb:5 -Faraday::METHODS_WITH_BODY = T.let(T.unsafe(nil), Array) - -# source://faraday-2.3.0/lib/faraday/methods.rb:4 -Faraday::METHODS_WITH_QUERY = T.let(T.unsafe(nil), Array) - -# Middleware is the basic base class of any Faraday middleware. -# -# source://faraday-2.3.0/lib/faraday/middleware.rb:5 -class Faraday::Middleware - extend ::Faraday::MiddlewareRegistry - - # @return [Middleware] a new instance of Middleware - # - # source://faraday-2.3.0/lib/faraday/middleware.rb:10 - def initialize(app = T.unsafe(nil), options = T.unsafe(nil)); end - - # Returns the value of attribute app. - # - # source://faraday-2.3.0/lib/faraday/middleware.rb:8 - def app; end - - # source://faraday-2.3.0/lib/faraday/middleware.rb:15 - def call(env); end - - # source://faraday-2.3.0/lib/faraday/middleware.rb:22 - def close; end - - # Returns the value of attribute options. - # - # source://faraday-2.3.0/lib/faraday/middleware.rb:8 - def options; end -end - -# Adds the ability for other modules to register and lookup -# middleware classes. -# -# source://faraday-2.3.0/lib/faraday/middleware_registry.rb:8 -module Faraday::MiddlewareRegistry - # Lookup middleware class with a registered Symbol shortcut. - # - # @example - # - # module Faraday - # class Whatever < Middleware - # register_middleware(foo: Whatever) - # end - # end - # - # Faraday::Middleware.lookup_middleware(:foo) - # # => Faraday::Whatever - # @param key [Symbol] key for the registered middleware. - # @raise [Faraday::Error] if given key is not registered - # @return [Class] a middleware Class. - # - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:55 - def lookup_middleware(key); end - - # Register middleware class(es) on the current module. - # - # @example Lookup by a constant - # - # module Faraday - # class Whatever < Middleware - # # Middleware looked up by :foo returns Faraday::Whatever::Foo. - # register_middleware(foo: Whatever) - # end - # end - # @param mappings [Hash] Middleware mappings from a lookup symbol to a middleware class. - # @return [void] - # - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:26 - def register_middleware(**mappings); end - - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:9 - def registered_middleware; end - - # Unregister a previously registered middleware class. - # - # @param key [Symbol] key for the registered middleware. - # - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:35 - def unregister_middleware(key); end - - private - - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:67 - def load_middleware(key); end - - # source://faraday-2.3.0/lib/faraday/middleware_registry.rb:62 - def middleware_mutex(&block); end -end - -# This is the default encoder for Faraday requests. -# Using this encoder, parameters will be encoded respecting their structure, -# so you can send objects such as Arrays or Hashes as parameters -# for your requests. -# -# source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:168 -module Faraday::NestedParamsEncoder - extend ::Faraday::EncodeMethods - extend ::Faraday::DecodeMethods - - class << self - # Returns the value of attribute array_indices. - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:170 - def array_indices; end - - # Sets the attribute array_indices - # - # @param value the value to set the attribute array_indices to. - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:170 - def array_indices=(_arg0); end - - # source://RUBY_ROOT/forwardable.rb:229 - def escape(*args, **_arg1, &block); end - - # Returns the value of attribute sort_params. - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:170 - def sort_params; end - - # Sets the attribute sort_params - # - # @param value the value to set the attribute sort_params to. - # - # source://faraday-2.3.0/lib/faraday/encoders/nested_params_encoder.rb:170 - def sort_params=(_arg0); end - - # source://RUBY_ROOT/forwardable.rb:229 - def unescape(*args, **_arg1, &block); end - end -end - -# Raised by Faraday::Response::RaiseError in case of a nil status in response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:129 -class Faraday::NilStatusError < ::Faraday::ServerError - # @return [NilStatusError] a new instance of NilStatusError - # - # source://faraday-2.3.0/lib/faraday/error.rb:130 - def initialize(exc, response = T.unsafe(nil)); end -end - -# Subclasses Struct with some special helpers for converting from a Hash to -# a Struct. -# -# source://faraday-2.3.0/lib/faraday/options.rb:7 -class Faraday::Options < ::Struct - # source://faraday-2.3.0/lib/faraday/options.rb:185 - def [](key); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:46 - def clear; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:71 - def deep_dup; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:39 - def delete(key); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:13 - def each; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:106 - def each_key(&block); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:120 - def each_value(&block); end - - # Public - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options.rb:101 - def empty?; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:76 - def fetch(key, *args); end - - # Public - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options.rb:113 - def has_key?(key); end - - # Public - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options.rb:127 - def has_value?(value); end - - # Internal - # - # source://faraday-2.3.0/lib/faraday/options.rb:144 - def inspect; end - - # Public - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options.rb:113 - def key?(key); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:96 - def keys; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:66 - def merge(other); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:51 - def merge!(other); end - - # source://faraday-2.3.0/lib/faraday/options.rb:194 - def symbolized_key_set; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:134 - def to_hash; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:22 - def update(obj); end - - # Public - # - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options.rb:127 - def value?(value); end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:91 - def values_at(*keys); end - - class << self - # Internal - # - # source://faraday-2.3.0/lib/faraday/options.rb:166 - def attribute_options; end - - # source://faraday-2.3.0/lib/faraday/options.rb:204 - def fetch_error_class; end - - # Public - # - # source://faraday-2.3.0/lib/faraday/options.rb:8 - def from(value); end - - # @private - # - # source://faraday-2.3.0/lib/faraday/options.rb:198 - def inherited(subclass); end - - # source://faraday-2.3.0/lib/faraday/options.rb:170 - def memoized(key, &block); end - - # source://faraday-2.3.0/lib/faraday/options.rb:181 - def memoized_attributes; end - - # Internal - # - # source://faraday-2.3.0/lib/faraday/options.rb:156 - def options(mapping); end - - # Internal - # - # source://faraday-2.3.0/lib/faraday/options.rb:161 - def options_for(key); end - end -end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:16 -Faraday::ParamPart = Faraday::Multipart::ParamPart - -# Raised by middlewares that parse the response, like the JSON response middleware. -# -# source://faraday-2.3.0/lib/faraday/error.rb:145 -class Faraday::ParsingError < ::Faraday::Error; end - -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:17 -Faraday::Parts = Multipart::Post::Parts - -# Raised by Faraday::Response::RaiseError in case of a 407 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:106 -class Faraday::ProxyAuthError < ::Faraday::ClientError; end - -# ProxyOptions contains the configurable properties for the proxy -# configuration used when making an HTTP request. -# -# source://faraday-2.3.0/lib/faraday/options/proxy_options.rb:6 -class Faraday::ProxyOptions < ::Faraday::Options - extend ::Forwardable - - # source://RUBY_ROOT/forwardable.rb:229 - def host(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def host=(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/options.rb:177 - def password; end - - # source://RUBY_ROOT/forwardable.rb:229 - def path(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def path=(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def port(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def port=(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def scheme(*args, **_arg1, &block); end - - # source://RUBY_ROOT/forwardable.rb:229 - def scheme=(*args, **_arg1, &block); end - - # source://faraday-2.3.0/lib/faraday/options.rb:177 - def user; end - - class << self - # source://faraday-2.3.0/lib/faraday/options/proxy_options.rb:11 - def from(value); end - end -end - -# A Builder that processes requests into responses by passing through an inner -# middleware stack (heavily inspired by Rack). -# -# @example -# Faraday::Connection.new(url: 'http://httpbingo.org') do |builder| -# builder.request :url_encoded # Faraday::Request::UrlEncoded -# builder.adapter :net_http # Faraday::Adapter::NetHttp -# end -# -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:15 -class Faraday::RackBuilder - # @return [RackBuilder] a new instance of RackBuilder - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:61 - def initialize(&block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:179 - def ==(other); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:79 - def [](idx); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:110 - def adapter(klass = T.unsafe(nil), *args, **_arg2, &block); end - - # The "rack app" wrapped in middleware. All requests are sent here. - # - # The builder is responsible for creating the app object. After this, - # the builder gets locked to ensure no further modifications are made - # to the middleware stack. - # - # Returns an object that responds to `call` and returns a Response. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:163 - def app; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:73 - def build; end - - # ENV Keys - # :http_method - a symbolized request HTTP method (:get, :post) - # :body - the request body that will eventually be converted to a string. - # :url - URI instance for the current request. - # :status - HTTP response status code - # :request_headers - hash of HTTP Headers to be sent to the server - # :response_headers - Hash of HTTP headers from the server - # :parallel_manager - sent if the connection is in parallel mode - # :request - Hash of options for configuring the request. - # :timeout - open/read timeout Integer in seconds - # :open_timeout - read timeout Integer in seconds - # :proxy - Hash of proxy options - # :uri - Proxy Server URI - # :user - Proxy server username - # :password - Proxy server password - # :ssl - Hash of options for configuring SSL requests. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:201 - def build_env(connection, request); end - - # Processes a Request into a Response by passing it through this Builder's - # middleware stack. - # - # @param connection [Faraday::Connection] - # @param request [Faraday::Request] - # @return [Faraday::Response] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:152 - def build_response(connection, request); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:140 - def delete(handler); end - - # Returns the value of attribute handlers. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:19 - def handlers; end - - # Sets the attribute handlers - # - # @param value the value to set the attribute handlers to. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:19 - def handlers=(_arg0); end - - # methods to push onto the various positions in the stack: - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:119 - def insert(index, *args, **_arg2, &block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:128 - def insert_after(index, *args, **_arg2, &block); end - - # methods to push onto the various positions in the stack: - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:119 - def insert_before(index, *args, **_arg2, &block); end - - # Locks the middleware stack to ensure no further modifications are made. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:84 - def lock!; end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:88 - def locked?; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:102 - def request(key, *args, **_arg2, &block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:106 - def response(key, *args, **_arg2, &block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:133 - def swap(index, *args, **_arg2, &block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:171 - def to_app; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:92 - def use(klass, *args, **_arg2, &block); end - - private - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:233 - def adapter_set?; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:245 - def assert_index(index); end - - # @raise [MISSING_ADAPTER_ERROR] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:229 - def ensure_adapter!; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:67 - def initialize_dup(original); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:237 - def is_adapter?(klass); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:223 - def raise_if_adapter(klass); end - - # @raise [StackLocked] - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:219 - def raise_if_locked; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:241 - def use_symbol(mod, key, *args, **_arg3, &block); end -end - -# borrowed from ActiveSupport::Dependencies::Reference & -# ActionDispatch::MiddlewareStack::Middleware -# -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:26 -class Faraday::RackBuilder::Handler - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:31 - def initialize(klass, *args, **_arg2, &block); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:46 - def ==(other); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:56 - def build(app = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:42 - def inspect; end - - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:38 - def klass; end - - # Returns the value of attribute name. - # - # source://faraday-2.3.0/lib/faraday/rack_builder.rb:29 - def name; end -end - -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:27 -Faraday::RackBuilder::Handler::REGISTRY = T.let(T.unsafe(nil), Faraday::AdapterRegistry) - -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:214 -Faraday::RackBuilder::LOCK_ERR = T.let(T.unsafe(nil), String) - -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:215 -Faraday::RackBuilder::MISSING_ADAPTER_ERROR = T.let(T.unsafe(nil), String) - -# Used to detect missing arguments -# -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:17 -Faraday::RackBuilder::NO_ARGUMENT = T.let(T.unsafe(nil), Object) - -# Error raised when trying to modify the stack after calling `lock!` -# -# source://faraday-2.3.0/lib/faraday/rack_builder.rb:22 -class Faraday::RackBuilder::StackLocked < ::RuntimeError; end - -# Used to setup URLs, params, headers, and the request body in a sane manner. -# -# -# @example -# @connection.post do |req| -# req.url 'http://localhost', 'a' => '1' # 'http://localhost?a=1' -# req.headers['b'] = '2' # Header -# req.params['c'] = '3' # GET Param -# req['b'] = '2' # also Header -# req.body = 'abc' -# end -# -# source://faraday-2.3.0/lib/faraday/request.rb:30 -class Faraday::Request < ::Struct - extend ::Faraday::MiddlewareRegistry - - # @param key [Object] key to look up in headers - # @return [Object] value of the given header name - # - # source://faraday-2.3.0/lib/faraday/request.rb:89 - def [](key); end - - # @param key [Object] key of header to write - # @param value [Object] value of header - # - # source://faraday-2.3.0/lib/faraday/request.rb:95 - def []=(key, value); end - - # Replace request headers, preserving the existing hash type. - # - # @param hash [Hash] new headers - # - # source://faraday-2.3.0/lib/faraday/request.rb:58 - def headers=(hash); end - - # Marshal serialization support. - # - # @return [Hash] the hash ready to be serialized in Marshal. - # - # source://faraday-2.3.0/lib/faraday/request.rb:102 - def marshal_dump; end - - # Marshal serialization support. - # Restores the instance variables according to the +serialised+. - # - # @param serialised [Hash] the serialised object. - # - # source://faraday-2.3.0/lib/faraday/request.rb:116 - def marshal_load(serialised); end - - # Replace params, preserving the existing hash type. - # - # @param hash [Hash] new params - # - # source://faraday-2.3.0/lib/faraday/request.rb:47 - def params=(hash); end - - # @return [Env] the Env for this Request - # - # source://faraday-2.3.0/lib/faraday/request.rb:126 - def to_env(connection); end - - # Update path and params. - # - # @param path [URI, String] - # @param params [Hash, nil] - # @return [void] - # - # source://faraday-2.3.0/lib/faraday/request.rb:71 - def url(path, params = T.unsafe(nil)); end - - class << self - # @param request_method [String] - # @return [Request] - # @yield [request] for block customization, if block given - # @yieldparam request [Request] - # - # source://faraday-2.3.0/lib/faraday/request.rb:38 - def create(request_method); end - end -end - -# Request middleware for the Authorization HTTP header -# -# source://faraday-2.3.0/lib/faraday/request/authorization.rb:6 -class Faraday::Request::Authorization < ::Faraday::Middleware - # @param app [#call] - # @param type [String, Symbol] Type of Authorization - # @param params [Array] parameters to build the Authorization header. - # If the type is `:basic`, then these can be a login and password pair. - # Otherwise, a single value is expected that will be appended after the type. - # This value can be a proc or an object responding to `.call`, in which case - # it will be invoked on each request. - # @return [Authorization] a new instance of Authorization - # - # source://faraday-2.3.0/lib/faraday/request/authorization.rb:16 - def initialize(app, type, *params); end - - # @param env [Faraday::Env] - # - # source://faraday-2.3.0/lib/faraday/request/authorization.rb:23 - def on_request(env); end - - private - - # @param type [String, Symbol] - # @param params [Array] - # @return [String] a header value - # - # source://faraday-2.3.0/lib/faraday/request/authorization.rb:34 - def header_from(type, *params); end -end - -# source://faraday-2.3.0/lib/faraday/request/authorization.rb:7 -Faraday::Request::Authorization::KEY = T.let(T.unsafe(nil), String) - -# Middleware for instrumenting Requests. -# -# source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:7 -class Faraday::Request::Instrumentation < ::Faraday::Middleware - # Instruments requests using Active Support. - # - # Measures time spent only for synchronous requests. - # - # @example Using ActiveSupport::Notifications to measure time spent - # for Faraday requests. - # ActiveSupport::Notifications - # .subscribe('request.faraday') do |name, starts, ends, _, env| - # url = env[:url] - # http_method = env[:method].to_s.upcase - # duration = ends - starts - # $stderr.puts '[%s] %s %s (%.3f s)' % - # [url.host, http_method, url.request_uri, duration] - # end - # @option options - # @option options - # @param app [#call] - # @param options [nil, Hash] Options hash - # @return [Instrumentation] a new instance of Instrumentation - # - # source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:40 - def initialize(app, options = T.unsafe(nil)); end - - # @param env [Faraday::Env] - # - # source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:47 - def call(env); end -end - -# Options class used in Request::Instrumentation class. -# -# source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:9 -class Faraday::Request::Instrumentation::Options < ::Faraday::Options - # @return [Class] - # - # source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:15 - def instrumenter; end - - # @return [String] - # - # source://faraday-2.3.0/lib/faraday/request/instrumentation.rb:10 - def name; end -end - -# Request middleware that encodes the body as JSON. -# -# Processes only requests with matching Content-type or those without a type. -# If a request doesn't have a type but has a body, it sets the Content-type -# to JSON MIME-type. -# -# Doesn't try to encode bodies that already are in string form. -# -# source://faraday-2.3.0/lib/faraday/request/json.rb:14 -class Faraday::Request::Json < ::Faraday::Middleware - # source://faraday-2.3.0/lib/faraday/request/json.rb:18 - def on_request(env); end - - private - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/request/json.rb:42 - def body?(env); end - - # source://faraday-2.3.0/lib/faraday/request/json.rb:26 - def encode(data); end - - # @yield [] - # - # source://faraday-2.3.0/lib/faraday/request/json.rb:30 - def match_content_type(env); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/request/json.rb:37 - def process_request?(env); end - - # source://faraday-2.3.0/lib/faraday/request/json.rb:46 - def request_type(env); end -end - -# source://faraday-2.3.0/lib/faraday/request/json.rb:15 -Faraday::Request::Json::MIME_TYPE = T.let(T.unsafe(nil), String) - -# source://faraday-2.3.0/lib/faraday/request/json.rb:16 -Faraday::Request::Json::MIME_TYPE_REGEX = T.let(T.unsafe(nil), Regexp) - -# Middleware for supporting urlencoded requests. -# -# source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:6 -class Faraday::Request::UrlEncoded < ::Faraday::Middleware - # Encodes as "application/x-www-form-urlencoded" if not already encoded or - # of another type. - # - # @param env [Faraday::Env] - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:20 - def call(env); end - - # @param env [Faraday::Env] - # @yield [request_body] Body of the request - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:30 - def match_content_type(env); end - - # @param env [Faraday::Env] - # @return [Boolean] True if the request has a body and its Content-Type is - # urlencoded. - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:43 - def process_request?(env); end - - # @param env [Faraday::Env] - # @return [String] - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:51 - def request_type(env); end - - class << self - # Returns the value of attribute mime_type. - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:12 - def mime_type; end - - # Sets the attribute mime_type - # - # @param value the value to set the attribute mime_type to. - # - # source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:12 - def mime_type=(_arg0); end - end -end - -# source://faraday-2.3.0/lib/faraday/request/url_encoded.rb:8 -Faraday::Request::UrlEncoded::CONTENT_TYPE = T.let(T.unsafe(nil), String) - -# RequestOptions contains the configurable properties for a Faraday request. -# -# source://faraday-2.3.0/lib/faraday/options/request_options.rb:8 -class Faraday::RequestOptions < ::Faraday::Options - # source://faraday-2.3.0/lib/faraday/options/request_options.rb:10 - def []=(key, value); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/options/request_options.rb:18 - def stream_response?; end -end - -# Raised by Faraday::Response::RaiseError in case of a 404 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:102 -class Faraday::ResourceNotFound < ::Faraday::ClientError; end - -# Response represents an HTTP response from making an HTTP request. -# -# source://faraday-2.3.0/lib/faraday/response.rb:7 -class Faraday::Response - extend ::Forwardable - extend ::Faraday::MiddlewareRegistry - - # @return [Response] a new instance of Response - # - # source://faraday-2.3.0/lib/faraday/response.rb:11 - def initialize(env = T.unsafe(nil)); end - - # source://RUBY_ROOT/forwardable.rb:229 - def [](*args, **_arg1, &block); end - - # Expand the env with more properties, without overriding existing ones. - # Useful for applying request params after restoring a marshalled Response. - # - # source://faraday-2.3.0/lib/faraday/response.rb:79 - def apply_request(request_env); end - - # source://faraday-2.3.0/lib/faraday/response.rb:32 - def body; end - - # Returns the value of attribute env. - # - # source://faraday-2.3.0/lib/faraday/response.rb:16 - def env; end - - # source://faraday-2.3.0/lib/faraday/response.rb:49 - def finish(env); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/response.rb:36 - def finished?; end - - # source://faraday-2.3.0/lib/faraday/response.rb:26 - def headers; end - - # because @on_complete_callbacks cannot be marshalled - # - # source://faraday-2.3.0/lib/faraday/response.rb:69 - def marshal_dump; end - - # source://faraday-2.3.0/lib/faraday/response.rb:73 - def marshal_load(env); end - - # source://faraday-2.3.0/lib/faraday/response.rb:40 - def on_complete(&block); end - - # source://faraday-2.3.0/lib/faraday/response.rb:22 - def reason_phrase; end - - # source://faraday-2.3.0/lib/faraday/response.rb:18 - def status; end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/response.rb:57 - def success?; end - - # source://faraday-2.3.0/lib/faraday/response.rb:61 - def to_hash; end -end - -# Parse response bodies as JSON. -# -# source://faraday-2.3.0/lib/faraday/response/json.rb:8 -class Faraday::Response::Json < ::Faraday::Middleware - # @return [Json] a new instance of Json - # - # source://faraday-2.3.0/lib/faraday/response/json.rb:9 - def initialize(app = T.unsafe(nil), parser_options: T.unsafe(nil), content_type: T.unsafe(nil), preserve_raw: T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/response/json.rb:16 - def on_complete(env); end - - private - - # source://faraday-2.3.0/lib/faraday/response/json.rb:29 - def parse(body); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/response/json.rb:33 - def parse_response?(env); end - - # source://faraday-2.3.0/lib/faraday/response/json.rb:22 - def process_response(env); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/response/json.rb:38 - def process_response_type?(env); end - - # source://faraday-2.3.0/lib/faraday/response/json.rb:45 - def response_type(env); end -end - -# Logger is a middleware that logs internal events in the HTTP request -# lifecycle to a given Logger object. By default, this logs to STDOUT. See -# Faraday::Logging::Formatter to see specifically what is logged. -# -# source://faraday-2.3.0/lib/faraday/response/logger.rb:12 -class Faraday::Response::Logger < ::Faraday::Middleware - # @return [Logger] a new instance of Logger - # @yield [@formatter] - # - # source://faraday-2.3.0/lib/faraday/response/logger.rb:13 - def initialize(app, logger = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/response/logger.rb:21 - def call(env); end - - # source://faraday-2.3.0/lib/faraday/response/logger.rb:26 - def on_complete(env); end -end - -# RaiseError is a Faraday middleware that raises exceptions on common HTTP -# client or server error responses. -# -# source://faraday-2.3.0/lib/faraday/response/raise_error.rb:8 -class Faraday::Response::RaiseError < ::Faraday::Middleware - # source://faraday-2.3.0/lib/faraday/response/raise_error.rb:13 - def on_complete(env); end - - # source://faraday-2.3.0/lib/faraday/response/raise_error.rb:56 - def query_params(env); end - - # source://faraday-2.3.0/lib/faraday/response/raise_error.rb:40 - def response_values(env); end -end - -# source://faraday-2.3.0/lib/faraday/response/raise_error.rb:9 -Faraday::Response::RaiseError::ClientErrorStatuses = T.let(T.unsafe(nil), Range) - -# source://faraday-2.3.0/lib/faraday/response/raise_error.rb:10 -Faraday::Response::RaiseError::ServerErrorStatuses = T.let(T.unsafe(nil), Range) - -# A unified client error for SSL errors. -# -# source://faraday-2.3.0/lib/faraday/error.rb:141 -class Faraday::SSLError < ::Faraday::Error; end - -# SSL-related options. -# -# source://faraday-2.3.0/lib/faraday/options/ssl_options.rb:47 -class Faraday::SSLOptions < ::Faraday::Options - # @return [Boolean] true if should not verify - # - # source://faraday-2.3.0/lib/faraday/options/ssl_options.rb:55 - def disable?; end - - # @return [Boolean] true if should verify - # - # source://faraday-2.3.0/lib/faraday/options/ssl_options.rb:50 - def verify?; end -end - -# Faraday server error class. Represents 5xx status responses. -# -# source://faraday-2.3.0/lib/faraday/error.rb:118 -class Faraday::ServerError < ::Faraday::Error; end - -# A unified client error for timeouts. -# -# source://faraday-2.3.0/lib/faraday/error.rb:122 -class Faraday::TimeoutError < ::Faraday::ServerError - # @return [TimeoutError] a new instance of TimeoutError - # - # source://faraday-2.3.0/lib/faraday/error.rb:123 - def initialize(exc = T.unsafe(nil), response = T.unsafe(nil)); end -end - -# Raised by Faraday::Response::RaiseError in case of a 401 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:94 -class Faraday::UnauthorizedError < ::Faraday::ClientError; end - -# Raised by Faraday::Response::RaiseError in case of a 422 response. -# -# source://faraday-2.3.0/lib/faraday/error.rb:114 -class Faraday::UnprocessableEntityError < ::Faraday::ClientError; end - -# multipart-post v2.2.0 introduces a new class hierarchy for classes like Parts and UploadIO -# For backwards compatibility, detect the gem version and use the right class -# -# source://faraday-multipart-1.0.4/lib/faraday/multipart.rb:21 -Faraday::UploadIO = Multipart::Post::UploadIO - -# Utils contains various static helper methods. -# -# source://faraday-2.3.0/lib/faraday/utils/headers.rb:4 -module Faraday::Utils - private - - # Normalize URI() behavior across Ruby versions - # - # url - A String or URI. - # - # Returns a parsed URI. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:71 - def URI(url); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:56 - def basic_header_from(login, pass); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:17 - def build_nested_query(params); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:13 - def build_query(params); end - - # Recursive hash merge - # - # source://faraday-2.3.0/lib/faraday/utils.rb:114 - def deep_merge(source, hash); end - - # Recursive hash update - # - # source://faraday-2.3.0/lib/faraday/utils.rb:102 - def deep_merge!(target, hash); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:52 - def default_params_encoder; end - - # source://faraday-2.3.0/lib/faraday/utils.rb:21 - def default_space_encoding; end - - # source://faraday-2.3.0/lib/faraday/utils.rb:81 - def default_uri_parser; end - - # source://faraday-2.3.0/lib/faraday/utils.rb:85 - def default_uri_parser=(parser); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:31 - def escape(str); end - - # Receives a String or URI and returns just - # the path with the query string sorted. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:95 - def normalize_path(url); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:48 - def parse_nested_query(query); end - - # Adapted from Rack - # - # source://faraday-2.3.0/lib/faraday/utils.rb:44 - def parse_query(query); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:118 - def sort_query_params(query); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:37 - def unescape(str); end - - class << self - # Normalize URI() behavior across Ruby versions - # - # url - A String or URI. - # - # Returns a parsed URI. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:71 - def URI(url); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:56 - def basic_header_from(login, pass); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:17 - def build_nested_query(params); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:13 - def build_query(params); end - - # Recursive hash merge - # - # source://faraday-2.3.0/lib/faraday/utils.rb:114 - def deep_merge(source, hash); end - - # Recursive hash update - # - # source://faraday-2.3.0/lib/faraday/utils.rb:102 - def deep_merge!(target, hash); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:52 - def default_params_encoder; end - - # Sets the attribute default_params_encoder - # - # @param value the value to set the attribute default_params_encoder to. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:63 - def default_params_encoder=(_arg0); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:21 - def default_space_encoding; end - - # Sets the attribute default_space_encoding - # - # @param value the value to set the attribute default_space_encoding to. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:26 - def default_space_encoding=(_arg0); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:81 - def default_uri_parser; end - - # source://faraday-2.3.0/lib/faraday/utils.rb:85 - def default_uri_parser=(parser); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:31 - def escape(str); end - - # Receives a String or URI and returns just - # the path with the query string sorted. - # - # source://faraday-2.3.0/lib/faraday/utils.rb:95 - def normalize_path(url); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:48 - def parse_nested_query(query); end - - # Adapted from Rack - # - # source://faraday-2.3.0/lib/faraday/utils.rb:44 - def parse_query(query); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:118 - def sort_query_params(query); end - - # source://faraday-2.3.0/lib/faraday/utils.rb:37 - def unescape(str); end - end -end - -# source://faraday-2.3.0/lib/faraday/utils.rb:41 -Faraday::Utils::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) - -# source://faraday-2.3.0/lib/faraday/utils.rb:29 -Faraday::Utils::ESCAPE_RE = T.let(T.unsafe(nil), Regexp) - -# A case-insensitive Hash that preserves the original case of a header -# when set. -# -# Adapted from Rack::Utils::HeaderHash -# -# source://faraday-2.3.0/lib/faraday/utils/headers.rb:9 -class Faraday::Utils::Headers < ::Hash - # @return [Headers] a new instance of Headers - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:20 - def initialize(hash = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:52 - def [](key); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:57 - def []=(key, val); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:71 - def delete(key); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:65 - def fetch(key, *args, &block); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:80 - def has_key?(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:80 - def include?(key); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:26 - def initialize_names; end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:80 - def key?(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:80 - def member?(key); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:95 - def merge(other); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:88 - def merge!(other); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:111 - def parse(header_string); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:100 - def replace(other); end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:107 - def to_hash; end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:88 - def update(other); end - - protected - - # Returns the value of attribute names. - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:129 - def names; end - - private - - # Join multiple values with a comma. - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:134 - def add_parsed(key, value); end - - # on dup/clone, we need to duplicate @names hash - # - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:31 - def initialize_copy(other); end - - class << self - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:14 - def allocate; end - - # source://faraday-2.3.0/lib/faraday/utils/headers.rb:10 - def from(value); end - end -end - -# symbol -> string mapper + cache -# -# source://faraday-2.3.0/lib/faraday/utils/headers.rb:40 -Faraday::Utils::Headers::KeyMap = T.let(T.unsafe(nil), Hash) - -# A hash with stringified keys. -# -# source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:6 -class Faraday::Utils::ParamsHash < ::Hash - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:7 - def [](key); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:11 - def []=(key, value); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:15 - def delete(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:19 - def has_key?(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:19 - def include?(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:19 - def key?(key); end - - # @return [Boolean] - # - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:19 - def member?(key); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:35 - def merge(params); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:27 - def merge!(params); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:44 - def merge_query(query, encoder = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:39 - def replace(other); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:50 - def to_query(encoder = T.unsafe(nil)); end - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:27 - def update(params); end - - private - - # source://faraday-2.3.0/lib/faraday/utils/params_hash.rb:56 - def convert_key(key); end -end - -# source://faraday-2.3.0/lib/faraday/version.rb:4 -Faraday::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/method_source@1.0.0.rbi b/sorbet/rbi/gems/method_source@1.0.0.rbi deleted file mode 100644 index 462f0f4..0000000 --- a/sorbet/rbi/gems/method_source@1.0.0.rbi +++ /dev/null @@ -1,272 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `method_source` gem. -# Please instead update this file by running `bin/tapioca gem method_source`. - -# source://method_source-1.0.0/lib/method_source.rb:127 -class Method - include ::MethodSource::SourceLocation::MethodExtensions - include ::MethodSource::MethodExtensions -end - -# source://method_source-1.0.0/lib/method_source/version.rb:1 -module MethodSource - extend ::MethodSource::CodeHelpers - - class << self - # Helper method responsible for opening source file and buffering up - # the comments for a specified method. Defined here to avoid polluting - # `Method` class. - # - # @param source_location [Array] The array returned by Method#source_location - # @param method_name [String] - # @raise [SourceNotFoundError] - # @return [String] The comments up to the point of the method. - # - # source://method_source-1.0.0/lib/method_source.rb:38 - def comment_helper(source_location, name = T.unsafe(nil)); end - - # @deprecated — use MethodSource::CodeHelpers#expression_at - # - # source://method_source-1.0.0/lib/method_source.rb:66 - def extract_code(source_location); end - - # Load a memoized copy of the lines in a file. - # - # @param file_name [String] - # @param method_name [String] - # @raise [SourceNotFoundError] - # @return [Array] the contents of the file - # - # source://method_source-1.0.0/lib/method_source.rb:51 - def lines_for(file_name, name = T.unsafe(nil)); end - - # Helper method responsible for extracting method body. - # Defined here to avoid polluting `Method` class. - # - # @param source_location [Array] The array returned by Method#source_location - # @param method_name [String] - # @return [String] The method body - # - # source://method_source-1.0.0/lib/method_source.rb:23 - def source_helper(source_location, name = T.unsafe(nil)); end - - # @deprecated — use MethodSource::CodeHelpers#complete_expression? - # @return [Boolean] - # - # source://method_source-1.0.0/lib/method_source.rb:59 - def valid_expression?(str); end - end -end - -# source://method_source-1.0.0/lib/method_source/code_helpers.rb:3 -module MethodSource::CodeHelpers - # Retrieve the comment describing the expression on the given line of the given file. - # - # This is useful to get module or method documentation. - # - # @param file [Array, File, String] The file to parse, either as a File or as - # a String or an Array of lines. - # @param line_number [Integer] The line number at which to look. - # NOTE: The first line in a file is line 1! - # @return [String] The comment - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:52 - def comment_describing(file, line_number); end - - # Determine if a string of code is a complete Ruby expression. - # - # @example - # complete_expression?("class Hello") #=> false - # complete_expression?("class Hello; end") #=> true - # complete_expression?("class 123") #=> SyntaxError: unexpected tINTEGER - # @param code [String] The code to validate. - # @raise [SyntaxError] Any SyntaxError that does not represent incompleteness. - # @return [Boolean] Whether or not the code is a complete Ruby expression. - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:66 - def complete_expression?(str); end - - # Retrieve the first expression starting on the given line of the given file. - # - # This is useful to get module or method source code. - # - # line 1! - # - # @option options - # @option options - # @param file [Array, File, String] The file to parse, either as a File or as - # @param line_number [Integer] The line number at which to look. - # NOTE: The first line in a file is - # @param options [Hash] The optional configuration parameters. - # @raise [SyntaxError] If the first complete expression can't be identified - # @return [String] The first complete expression - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:20 - def expression_at(file, line_number, options = T.unsafe(nil)); end - - private - - # Get the first expression from the input. - # - # @param lines [Array] - # @param consume [Integer] A number of lines to automatically - # consume (add to the expression buffer) without checking for validity. - # @raise [SyntaxError] - # @return [String] a valid ruby expression - # @yield a clean-up function to run before checking for complete_expression - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:92 - def extract_first_expression(lines, consume = T.unsafe(nil), &block); end - - # Get the last comment from the input. - # - # @param lines [Array] - # @return [String] - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:106 - def extract_last_comment(lines); end -end - -# An exception matcher that matches only subsets of SyntaxErrors that can be -# fixed by adding more input to the buffer. -# -# source://method_source-1.0.0/lib/method_source/code_helpers.rb:124 -module MethodSource::CodeHelpers::IncompleteExpression - class << self - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:137 - def ===(ex); end - - # @return [Boolean] - # - # source://method_source-1.0.0/lib/method_source/code_helpers.rb:149 - def rbx?; end - end -end - -# source://method_source-1.0.0/lib/method_source/code_helpers.rb:125 -MethodSource::CodeHelpers::IncompleteExpression::GENERIC_REGEXPS = T.let(T.unsafe(nil), Array) - -# source://method_source-1.0.0/lib/method_source/code_helpers.rb:133 -MethodSource::CodeHelpers::IncompleteExpression::RBX_ONLY_REGEXPS = T.let(T.unsafe(nil), Array) - -# This module is to be included by `Method` and `UnboundMethod` and -# provides the `#source` functionality -# -# source://method_source-1.0.0/lib/method_source.rb:72 -module MethodSource::MethodExtensions - # Return the comments associated with the method as a string. - # - # @example - # Set.instance_method(:clear).comment.display - # => - # # Removes all elements and returns self. - # @raise SourceNotFoundException - # @return [String] The method's comments as a string - # - # source://method_source-1.0.0/lib/method_source.rb:121 - def comment; end - - # Return the sourcecode for the method as a string - # - # @example - # Set.instance_method(:clear).source.display - # => - # def clear - # @hash.clear - # self - # end - # @raise SourceNotFoundException - # @return [String] The method sourcecode as a string - # - # source://method_source-1.0.0/lib/method_source.rb:109 - def source; end - - class << self - # We use the included hook to patch Method#source on rubinius. - # We need to use the included hook as Rubinius defines a `source` - # on Method so including a module will have no effect (as it's - # higher up the MRO). - # - # @param klass [Class] The class that includes the module. - # - # source://method_source-1.0.0/lib/method_source.rb:79 - def included(klass); end - end -end - -# source://method_source-1.0.0/lib/method_source/source_location.rb:2 -module MethodSource::ReeSourceLocation - # Ruby enterprise edition provides all the information that's - # needed, in a slightly different way. - # - # source://method_source-1.0.0/lib/method_source/source_location.rb:5 - def source_location; end -end - -# source://method_source-1.0.0/lib/method_source/source_location.rb:10 -module MethodSource::SourceLocation; end - -# source://method_source-1.0.0/lib/method_source/source_location.rb:11 -module MethodSource::SourceLocation::MethodExtensions - # Return the source location of a method for Ruby 1.8. - # - # @return [Array] A two element array. First element is the - # file, second element is the line in the file where the - # method definition is found. - # - # source://method_source-1.0.0/lib/method_source/source_location.rb:40 - def source_location; end - - private - - # source://method_source-1.0.0/lib/method_source/source_location.rb:26 - def trace_func(event, file, line, id, binding, classname); end -end - -# source://method_source-1.0.0/lib/method_source/source_location.rb:54 -module MethodSource::SourceLocation::ProcExtensions - # Return the source location for a Proc (in implementations - # without Proc#source_location) - # - # @return [Array] A two element array. First element is the - # file, second element is the line in the file where the - # proc definition is found. - # - # source://method_source-1.0.0/lib/method_source/source_location.rb:74 - def source_location; end -end - -# source://method_source-1.0.0/lib/method_source/source_location.rb:81 -module MethodSource::SourceLocation::UnboundMethodExtensions - # Return the source location of an instance method for Ruby 1.8. - # - # @return [Array] A two element array. First element is the - # file, second element is the line in the file where the - # method definition is found. - # - # source://method_source-1.0.0/lib/method_source/source_location.rb:101 - def source_location; end -end - -# An Exception to mark errors that were raised trying to find the source from -# a given source_location. -# -# source://method_source-1.0.0/lib/method_source.rb:16 -class MethodSource::SourceNotFoundError < ::StandardError; end - -# source://method_source-1.0.0/lib/method_source/version.rb:2 -MethodSource::VERSION = T.let(T.unsafe(nil), String) - -# source://method_source-1.0.0/lib/method_source.rb:137 -class Proc - include ::MethodSource::SourceLocation::ProcExtensions - include ::MethodSource::MethodExtensions -end - -# source://method_source-1.0.0/lib/method_source.rb:132 -class UnboundMethod - include ::MethodSource::SourceLocation::UnboundMethodExtensions - include ::MethodSource::MethodExtensions -end diff --git a/sorbet/rbi/gems/minitest@5.16.1.rbi b/sorbet/rbi/gems/minitest@5.16.1.rbi deleted file mode 100644 index 6b83541..0000000 --- a/sorbet/rbi/gems/minitest@5.16.1.rbi +++ /dev/null @@ -1,1459 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `minitest` gem. -# Please instead update this file by running `bin/tapioca gem minitest`. - -# :include: README.rdoc -# -# source://minitest-5.16.1/lib/minitest/parallel.rb:1 -module Minitest - class << self - # Internal run method. Responsible for telling all Runnable - # sub-classes to run. - # - # source://minitest-5.16.1/lib/minitest.rb:173 - def __run(reporter, options); end - - # A simple hook allowing you to run a block of code after everything - # is done running. Eg: - # - # Minitest.after_run { p $debugging_info } - # - # source://minitest-5.16.1/lib/minitest.rb:94 - def after_run(&block); end - - # Registers Minitest to run at process exit - # - # source://minitest-5.16.1/lib/minitest.rb:66 - def autorun; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def backtrace_filter; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def backtrace_filter=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:18 - def cattr_accessor(name); end - - # source://minitest-5.16.1/lib/minitest.rb:1067 - def clock_time; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def extensions; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def extensions=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:264 - def filter_backtrace(bt); end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def info_signal; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def info_signal=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:98 - def init_plugins(options); end - - # source://minitest-5.16.1/lib/minitest.rb:105 - def load_plugins; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def parallel_executor; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def parallel_executor=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:186 - def process_args(args = T.unsafe(nil)); end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def reporter; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def reporter=(_arg0); end - - # This is the top-level run method. Everything starts from here. It - # tells each Runnable sub-class to run, and each of those are - # responsible for doing whatever they do. - # - # The overall structure of a run looks like this: - # - # Minitest.autorun - # Minitest.run(args) - # Minitest.__run(reporter, options) - # Runnable.runnables.each - # runnable.run(reporter, options) - # self.runnable_methods.each - # self.run_one_method(self, runnable_method, reporter) - # Minitest.run_one_method(klass, runnable_method) - # klass.new(runnable_method).run - # - # source://minitest-5.16.1/lib/minitest.rb:140 - def run(args = T.unsafe(nil)); end - - # source://minitest-5.16.1/lib/minitest.rb:1058 - def run_one_method(klass, method_name); end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def seed; end - - # source://minitest-5.16.1/lib/minitest.rb:19 - def seed=(_arg0); end - end -end - -# Defines the API for Reporters. Subclass this and override whatever -# you want. Go nuts. -# -# source://minitest-5.16.1/lib/minitest.rb:578 -class Minitest::AbstractReporter - include ::Mutex_m - - # source://RUBY_ROOT/mutex_m.rb:93 - def lock; end - - # source://RUBY_ROOT/mutex_m.rb:83 - def locked?; end - - # Did this run pass? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:612 - def passed?; end - - # About to start running a test. This allows a reporter to show - # that it is starting or that we are in the middle of a test run. - # - # source://minitest-5.16.1/lib/minitest.rb:591 - def prerecord(klass, name); end - - # Output and record the result of the test. Call - # {result#result_code}[rdoc-ref:Runnable#result_code] to get the - # result character string. Stores the result of the run if the run - # did not pass. - # - # source://minitest-5.16.1/lib/minitest.rb:600 - def record(result); end - - # Outputs the summary of the run. - # - # source://minitest-5.16.1/lib/minitest.rb:606 - def report; end - - # Starts reporting on the run. - # - # source://minitest-5.16.1/lib/minitest.rb:584 - def start; end - - # source://RUBY_ROOT/mutex_m.rb:78 - def synchronize(&block); end - - # source://RUBY_ROOT/mutex_m.rb:88 - def try_lock; end - - # source://RUBY_ROOT/mutex_m.rb:98 - def unlock; end -end - -# Represents run failures. -# -# source://minitest-5.16.1/lib/minitest.rb:903 -class Minitest::Assertion < ::Exception - # source://minitest-5.16.1/lib/minitest.rb:904 - def error; end - - # Where was this run before an assertion was raised? - # - # source://minitest-5.16.1/lib/minitest.rb:911 - def location; end - - # source://minitest-5.16.1/lib/minitest.rb:920 - def result_code; end - - # source://minitest-5.16.1/lib/minitest.rb:924 - def result_label; end -end - -# Minitest Assertions. All assertion methods accept a +msg+ which is -# printed if the assertion fails. -# -# Protocol: Nearly everything here boils up to +assert+, which -# expects to be able to increment an instance accessor named -# +assertions+. This is not provided by Assertions and must be -# provided by the thing including Assertions. See Minitest::Runnable -# for an example. -# -# source://minitest-5.16.1/lib/minitest/assertions.rb:18 -module Minitest::Assertions - # source://minitest-5.16.1/lib/minitest/assertions.rb:188 - def _synchronize; end - - # Fails unless +test+ is truthy. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:178 - def assert(test, msg = T.unsafe(nil)); end - - # Fails unless +obj+ is empty. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:195 - def assert_empty(obj, msg = T.unsafe(nil)); end - - # Fails unless exp == act printing the difference between - # the two, if possible. - # - # If there is no visible difference but the assertion fails, you - # should suspect that your #== is buggy, or your inspect output is - # missing crucial details. For nicer structural diffing, set - # Minitest::Test.make_my_diffs_pretty! - # - # For floats use assert_in_delta. - # - # See also: Minitest::Assertions.diff - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:216 - def assert_equal(exp, act, msg = T.unsafe(nil)); end - - # For comparing Floats. Fails unless +exp+ and +act+ are within +delta+ - # of each other. - # - # assert_in_delta Math::PI, (22.0 / 7.0), 0.01 - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:240 - def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end - - # For comparing Floats. Fails unless +exp+ and +act+ have a relative - # error less than +epsilon+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:252 - def assert_in_epsilon(exp, act, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end - - # Fails unless +collection+ includes +obj+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:259 - def assert_includes(collection, obj, msg = T.unsafe(nil)); end - - # Fails unless +obj+ is an instance of +cls+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:270 - def assert_instance_of(cls, obj, msg = T.unsafe(nil)); end - - # Fails unless +obj+ is a kind of +cls+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:281 - def assert_kind_of(cls, obj, msg = T.unsafe(nil)); end - - # Fails unless +matcher+ =~ +obj+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:291 - def assert_match(matcher, obj, msg = T.unsafe(nil)); end - - # Fails unless +obj+ is nil - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:303 - def assert_nil(obj, msg = T.unsafe(nil)); end - - # For testing with binary operators. Eg: - # - # assert_operator 5, :<=, 4 - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:313 - def assert_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end - - # Fails if stdout or stderr do not output the expected results. - # Pass in nil if you don't care about that streams output. Pass in - # "" if you require it to be silent. Pass in a regexp if you want - # to pattern match. - # - # assert_output(/hey/) { method_with_output } - # - # NOTE: this uses #capture_io, not #capture_subprocess_io. - # - # See also: #assert_silent - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:331 - def assert_output(stdout = T.unsafe(nil), stderr = T.unsafe(nil)); end - - # Fails unless +path+ exists. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:355 - def assert_path_exists(path, msg = T.unsafe(nil)); end - - # For testing with predicates. Eg: - # - # assert_predicate str, :empty? - # - # This is really meant for specs and is front-ended by assert_operator: - # - # str.must_be :empty? - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:369 - def assert_predicate(o1, op, msg = T.unsafe(nil)); end - - # Fails unless the block raises one of +exp+. Returns the - # exception matched so you can check the message, attributes, etc. - # - # +exp+ takes an optional message on the end to help explain - # failures and defaults to StandardError if no exception class is - # passed. Eg: - # - # assert_raises(CustomError) { method_with_custom_error } - # - # With custom error message: - # - # assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error } - # - # Using the returned object: - # - # error = assert_raises(CustomError) do - # raise CustomError, 'This is really bad' - # end - # - # assert_equal 'This is really bad', error.message - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:396 - def assert_raises(*exp); end - - # Fails unless +obj+ responds to +meth+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:427 - def assert_respond_to(obj, meth, msg = T.unsafe(nil)); end - - # Fails unless +exp+ and +act+ are #equal? - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:437 - def assert_same(exp, act, msg = T.unsafe(nil)); end - - # +send_ary+ is a receiver, message and arguments. - # - # Fails unless the call returns a true value - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:450 - def assert_send(send_ary, m = T.unsafe(nil)); end - - # Fails if the block outputs anything to stderr or stdout. - # - # See also: #assert_output - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:466 - def assert_silent; end - - # Fails unless the block throws +sym+ - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:475 - def assert_throws(sym, msg = T.unsafe(nil)); end - - # Captures $stdout and $stderr into strings: - # - # out, err = capture_io do - # puts "Some info" - # warn "You did a bad thing" - # end - # - # assert_match %r%info%, out - # assert_match %r%bad%, err - # - # NOTE: For efficiency, this method uses StringIO and does not - # capture IO for subprocesses. Use #capture_subprocess_io for - # that. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:516 - def capture_io; end - - # Captures $stdout and $stderr into strings, using Tempfile to - # ensure that subprocess IO is captured as well. - # - # out, err = capture_subprocess_io do - # system "echo Some info" - # system "echo You did a bad thing 1>&2" - # end - # - # assert_match %r%info%, out - # assert_match %r%bad%, err - # - # NOTE: This method is approximately 10x slower than #capture_io so - # only use it when you need to test the output of a subprocess. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:549 - def capture_subprocess_io; end - - # Returns a diff between +exp+ and +act+. If there is no known - # diff command or if it doesn't make sense to diff the output - # (single line, short output), then it simply returns a basic - # comparison between the two. - # - # See +things_to_diff+ for more info. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:59 - def diff(exp, act); end - - # Returns details for exception +e+ - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:581 - def exception_details(e, msg); end - - # Fails after a given date (in the local time zone). This allows - # you to put time-bombs in your tests if you need to keep - # something around until a later date lest you forget about it. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:597 - def fail_after(y, m, d, msg); end - - # Fails with +msg+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:604 - def flunk(msg = T.unsafe(nil)); end - - # Returns a proc that will output +msg+ along with the default message. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:612 - def message(msg = T.unsafe(nil), ending = T.unsafe(nil), &default); end - - # This returns a human-readable version of +obj+. By default - # #inspect is called. You can override this to use #pretty_inspect - # if you want. - # - # See Minitest::Test.make_my_diffs_pretty! - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:129 - def mu_pp(obj); end - - # This returns a diff-able more human-readable version of +obj+. - # This differs from the regular mu_pp because it expands escaped - # newlines and makes hex-values (like object_ids) generic. This - # uses mu_pp to do the first pass and then cleans it up. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:152 - def mu_pp_for_diff(obj); end - - # used for counting assertions - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:623 - def pass(_msg = T.unsafe(nil)); end - - # Fails if +test+ is truthy. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:630 - def refute(test, msg = T.unsafe(nil)); end - - # Fails if +obj+ is empty. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:638 - def refute_empty(obj, msg = T.unsafe(nil)); end - - # Fails if exp == act. - # - # For floats use refute_in_delta. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:649 - def refute_equal(exp, act, msg = T.unsafe(nil)); end - - # For comparing Floats. Fails if +exp+ is within +delta+ of +act+. - # - # refute_in_delta Math::PI, (22.0 / 7.0) - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:661 - def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end - - # For comparing Floats. Fails if +exp+ and +act+ have a relative error - # less than +epsilon+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:673 - def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end - - # Fails if +collection+ includes +obj+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:680 - def refute_includes(collection, obj, msg = T.unsafe(nil)); end - - # Fails if +obj+ is an instance of +cls+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:691 - def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end - - # Fails if +obj+ is a kind of +cls+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:701 - def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end - - # Fails if +matcher+ =~ +obj+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:709 - def refute_match(matcher, obj, msg = T.unsafe(nil)); end - - # Fails if +obj+ is nil. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:719 - def refute_nil(obj, msg = T.unsafe(nil)); end - - # Fails if +o1+ is not +op+ +o2+. Eg: - # - # refute_operator 1, :>, 2 #=> pass - # refute_operator 1, :<, 2 #=> fail - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:730 - def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end - - # Fails if +path+ exists. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:739 - def refute_path_exists(path, msg = T.unsafe(nil)); end - - # For testing with predicates. - # - # refute_predicate str, :empty? - # - # This is really meant for specs and is front-ended by refute_operator: - # - # str.wont_be :empty? - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:753 - def refute_predicate(o1, op, msg = T.unsafe(nil)); end - - # Fails if +obj+ responds to the message +meth+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:761 - def refute_respond_to(obj, meth, msg = T.unsafe(nil)); end - - # Fails if +exp+ is the same (by object identity) as +act+. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:770 - def refute_same(exp, act, msg = T.unsafe(nil)); end - - # Skips the current run. If run in verbose-mode, the skipped run - # gets listed at the end of the run but doesn't cause a failure - # exit code. - # - # @raise [Minitest::Skip] - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:783 - def skip(msg = T.unsafe(nil), bt = T.unsafe(nil)); end - - # Skips the current run until a given date (in the local time - # zone). This allows you to put some fixes on hold until a later - # date, but still holds you accountable and prevents you from - # forgetting it. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:795 - def skip_until(y, m, d, msg); end - - # Was this testcase skipped? Meant for #teardown. - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:804 - def skipped?; end - - # Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff. - # - # Criterion: - # - # 1. Strings include newlines or escaped newlines, but not both. - # 2. or: String lengths are > 30 characters. - # 3. or: Strings are equal to each other (but maybe different encodings?). - # 4. and: we found a diff executable. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:104 - def things_to_diff(exp, act); end - - class << self - # Returns the diff command to use in #diff. Tries to intelligently - # figure out what diff to use. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:29 - def diff; end - - # Set the diff command to use in #diff. - # - # source://minitest-5.16.1/lib/minitest/assertions.rb:47 - def diff=(o); end - end -end - -# source://minitest-5.16.1/lib/minitest/assertions.rb:201 -Minitest::Assertions::E = T.let(T.unsafe(nil), String) - -# source://minitest-5.16.1/lib/minitest/assertions.rb:19 -Minitest::Assertions::UNDEFINED = T.let(T.unsafe(nil), Object) - -# The standard backtrace filter for minitest. -# -# See Minitest.backtrace_filter=. -# -# source://minitest-5.16.1/lib/minitest.rb:1035 -class Minitest::BacktraceFilter - # Filter +bt+ to something useful. Returns the whole thing if - # $DEBUG (ruby) or $MT_DEBUG (env). - # - # source://minitest-5.16.1/lib/minitest.rb:1043 - def filter(bt); end -end - -# source://minitest-5.16.1/lib/minitest.rb:1037 -Minitest::BacktraceFilter::MT_RE = T.let(T.unsafe(nil), Regexp) - -# Dispatch to multiple reporters as one. -# -# source://minitest-5.16.1/lib/minitest.rb:854 -class Minitest::CompositeReporter < ::Minitest::AbstractReporter - # @return [CompositeReporter] a new instance of CompositeReporter - # - # source://minitest-5.16.1/lib/minitest.rb:858 - def initialize(*reporters); end - - # Add another reporter to the mix. - # - # source://minitest-5.16.1/lib/minitest.rb:870 - def <<(reporter); end - - # source://minitest-5.16.1/lib/minitest.rb:863 - def io; end - - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:874 - def passed?; end - - # source://minitest-5.16.1/lib/minitest.rb:882 - def prerecord(klass, name); end - - # source://minitest-5.16.1/lib/minitest.rb:889 - def record(result); end - - # source://minitest-5.16.1/lib/minitest.rb:895 - def report; end - - # The list of reporters to dispatch to. - # - # source://minitest-5.16.1/lib/minitest.rb:856 - def reporters; end - - # The list of reporters to dispatch to. - # - # source://minitest-5.16.1/lib/minitest.rb:856 - def reporters=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:878 - def start; end -end - -# Provides a simple set of guards that you can use in your tests -# to skip execution if it is not applicable. These methods are -# mixed into Test as both instance and class methods so you -# can use them inside or outside of the test methods. -# -# def test_something_for_mri -# skip "bug 1234" if jruby? -# # ... -# end -# -# if windows? then -# # ... lots of test methods ... -# end -# -# source://minitest-5.16.1/lib/minitest.rb:979 -module Minitest::Guard - # Is this running on jruby? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:984 - def jruby?(platform = T.unsafe(nil)); end - - # Is this running on maglev? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:991 - def maglev?(platform = T.unsafe(nil)); end - - # Is this running on mri? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:1001 - def mri?(platform = T.unsafe(nil)); end - - # Is this running on macOS? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:1008 - def osx?(platform = T.unsafe(nil)); end - - # Is this running on rubinius? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:1015 - def rubinius?(platform = T.unsafe(nil)); end - - # Is this running on windows? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:1025 - def windows?(platform = T.unsafe(nil)); end -end - -# source://minitest-5.16.1/lib/minitest/parallel.rb:2 -module Minitest::Parallel; end - -# The engine used to run multiple tests in parallel. -# -# source://minitest-5.16.1/lib/minitest/parallel.rb:7 -class Minitest::Parallel::Executor - # Create a parallel test executor of with +size+ workers. - # - # @return [Executor] a new instance of Executor - # - # source://minitest-5.16.1/lib/minitest/parallel.rb:17 - def initialize(size); end - - # Add a job to the queue - # - # source://minitest-5.16.1/lib/minitest/parallel.rb:43 - def <<(work); end - - # Shuts down the pool of workers by signalling them to quit and - # waiting for them all to finish what they're currently working - # on. - # - # source://minitest-5.16.1/lib/minitest/parallel.rb:50 - def shutdown; end - - # The size of the pool of workers. - # - # source://minitest-5.16.1/lib/minitest/parallel.rb:12 - def size; end - - # Start the executor - # - # source://minitest-5.16.1/lib/minitest/parallel.rb:26 - def start; end -end - -# source://minitest-5.16.1/lib/minitest/parallel.rb:56 -module Minitest::Parallel::Test - # source://minitest-5.16.1/lib/minitest/parallel.rb:57 - def _synchronize; end -end - -# source://minitest-5.16.1/lib/minitest/parallel.rb:59 -module Minitest::Parallel::Test::ClassMethods - # source://minitest-5.16.1/lib/minitest/parallel.rb:60 - def run_one_method(klass, method_name, reporter); end - - # source://minitest-5.16.1/lib/minitest/parallel.rb:64 - def test_order; end -end - -# A very simple reporter that prints the "dots" during the run. -# -# This is added to the top-level CompositeReporter at the start of -# the run. If you want to change the output of minitest via a -# plugin, pull this out of the composite and replace it with your -# own. -# -# source://minitest-5.16.1/lib/minitest.rb:643 -class Minitest::ProgressReporter < ::Minitest::Reporter - # source://minitest-5.16.1/lib/minitest.rb:644 - def prerecord(klass, name); end - - # source://minitest-5.16.1/lib/minitest.rb:651 - def record(result); end -end - -# Shared code for anything that can get passed to a Reporter. See -# Minitest::Test & Minitest::Result. -# -# source://minitest-5.16.1/lib/minitest.rb:475 -module Minitest::Reportable - # @raise [NotImplementedError] - # - # source://minitest-5.16.1/lib/minitest.rb:495 - def class_name; end - - # Did this run error? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:516 - def error?; end - - # The location identifier of this test. Depends on a method - # existing called class_name. - # - # source://minitest-5.16.1/lib/minitest.rb:490 - def location; end - - # Did this run pass? - # - # Note: skipped runs are not considered passing, but they don't - # cause the process to exit non-zero. - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:482 - def passed?; end - - # Returns ".", "F", or "E" based on the result of the run. - # - # source://minitest-5.16.1/lib/minitest.rb:502 - def result_code; end - - # Was this run skipped? - # - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:509 - def skipped?; end -end - -# source://minitest-5.16.1/lib/minitest.rb:619 -class Minitest::Reporter < ::Minitest::AbstractReporter - # @return [Reporter] a new instance of Reporter - # - # source://minitest-5.16.1/lib/minitest.rb:628 - def initialize(io = T.unsafe(nil), options = T.unsafe(nil)); end - - # The IO used to report. - # - # source://minitest-5.16.1/lib/minitest.rb:621 - def io; end - - # The IO used to report. - # - # source://minitest-5.16.1/lib/minitest.rb:621 - def io=(_arg0); end - - # Command-line options for this run. - # - # source://minitest-5.16.1/lib/minitest.rb:626 - def options; end - - # Command-line options for this run. - # - # source://minitest-5.16.1/lib/minitest.rb:626 - def options=(_arg0); end -end - -# This represents a test result in a clean way that can be -# marshalled over a wire. Tests can do anything they want to the -# test instance and can create conditions that cause Marshal.dump to -# blow up. By using Result.from(a_test) you can be reasonably sure -# that the test result can be marshalled. -# -# source://minitest-5.16.1/lib/minitest.rb:528 -class Minitest::Result < ::Minitest::Runnable - include ::Minitest::Reportable - - # source://minitest-5.16.1/lib/minitest.rb:561 - def class_name; end - - # The class name of the test result. - # - # source://minitest-5.16.1/lib/minitest.rb:537 - def klass; end - - # The class name of the test result. - # - # source://minitest-5.16.1/lib/minitest.rb:537 - def klass=(_arg0); end - - # The location of the test method. - # - # source://minitest-5.16.1/lib/minitest.rb:542 - def source_location; end - - # The location of the test method. - # - # source://minitest-5.16.1/lib/minitest.rb:542 - def source_location=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:565 - def to_s; end - - class << self - # Create a new test result from a Runnable instance. - # - # source://minitest-5.16.1/lib/minitest.rb:547 - def from(runnable); end - end -end - -# re-open -# -# source://minitest-5.16.1/lib/minitest.rb:277 -class Minitest::Runnable - # @return [Runnable] a new instance of Runnable - # - # source://minitest-5.16.1/lib/minitest.rb:431 - def initialize(name); end - - # Number of assertions executed in this run. - # - # source://minitest-5.16.1/lib/minitest.rb:281 - def assertions; end - - # Number of assertions executed in this run. - # - # source://minitest-5.16.1/lib/minitest.rb:281 - def assertions=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:427 - def failure; end - - # An assertion raised during the run, if any. - # - # source://minitest-5.16.1/lib/minitest.rb:286 - def failures; end - - # An assertion raised during the run, if any. - # - # source://minitest-5.16.1/lib/minitest.rb:286 - def failures=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:413 - def marshal_dump; end - - # source://minitest-5.16.1/lib/minitest.rb:423 - def marshal_load(ary); end - - # Name of the run. - # - # source://minitest-5.16.1/lib/minitest.rb:304 - def name; end - - # Set the name of the run. - # - # source://minitest-5.16.1/lib/minitest.rb:311 - def name=(o); end - - # Did this run pass? - # - # Note: skipped runs are not considered passing, but they don't - # cause the process to exit non-zero. - # - # @raise [NotImplementedError] - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:450 - def passed?; end - - # Returns a single character string to print based on the result - # of the run. One of ".", "F", - # "E" or "S". - # - # @raise [NotImplementedError] - # - # source://minitest-5.16.1/lib/minitest.rb:459 - def result_code; end - - # Runs a single method. Needs to return self. - # - # @raise [NotImplementedError] - # - # source://minitest-5.16.1/lib/minitest.rb:440 - def run; end - - # Was this run skipped? See #passed? for more information. - # - # @raise [NotImplementedError] - # @return [Boolean] - # - # source://minitest-5.16.1/lib/minitest.rb:466 - def skipped?; end - - # The time it took to run. - # - # source://minitest-5.16.1/lib/minitest.rb:291 - def time; end - - # The time it took to run. - # - # source://minitest-5.16.1/lib/minitest.rb:291 - def time=(_arg0); end - - # source://minitest-5.16.1/lib/minitest.rb:293 - def time_it; end - - class << self - # source://minitest-5.16.1/lib/minitest.rb:1077 - def inherited(klass); end - - # Returns all instance methods matching the pattern +re+. - # - # source://minitest-5.16.1/lib/minitest.rb:318 - def methods_matching(re); end - - # source://minitest-5.16.1/lib/minitest.rb:383 - def on_signal(name, action); end - - # source://minitest-5.16.1/lib/minitest.rb:322 - def reset; end - - # Responsible for running all runnable methods in a given class, - # each in its own instance. Each instance is passed to the - # reporter to record. - # - # source://minitest-5.16.1/lib/minitest.rb:333 - def run(reporter, options = T.unsafe(nil)); end - - # Runs a single method and has the reporter record the result. - # This was considered internal API but is factored out of run so - # that subclasses can specialize the running of an individual - # test. See Minitest::ParallelTest::ClassMethods for an example. - # - # source://minitest-5.16.1/lib/minitest.rb:363 - def run_one_method(klass, method_name, reporter); end - - # Each subclass of Runnable is responsible for overriding this - # method to return all runnable methods. See #methods_matching. - # - # @raise [NotImplementedError] - # - # source://minitest-5.16.1/lib/minitest.rb:400 - def runnable_methods; end - - # Returns all subclasses of Runnable. - # - # source://minitest-5.16.1/lib/minitest.rb:407 - def runnables; end - - # source://minitest-5.16.1/lib/minitest.rb:368 - def with_info_handler(reporter, &block); end - end -end - -# source://minitest-5.16.1/lib/minitest.rb:381 -Minitest::Runnable::SIGNALS = T.let(T.unsafe(nil), Hash) - -# Assertion raised when skipping a run. -# -# source://minitest-5.16.1/lib/minitest.rb:932 -class Minitest::Skip < ::Minitest::Assertion - # source://minitest-5.16.1/lib/minitest.rb:933 - def result_label; end -end - -# A reporter that gathers statistics about a test run. Does not do -# any IO because meant to be used as a parent class for a reporter -# that does. -# -# If you want to create an entirely different type of output (eg, -# CI, HTML, etc), this is the place to start. -# -# Example: -# -# class JenkinsCIReporter < StatisticsReporter -# def report -# super # Needed to calculate some statistics -# -# print " "onetwothree" -# -# source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:33 -class Multipart::Post::CompositeReadIO - # Create a new composite-read IO from the arguments, all of which should - # respond to #read in a manner consistent with IO. - # - # @return [CompositeReadIO] a new instance of CompositeReadIO - # - # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:36 - def initialize(*ios); end - - # Read from IOs in order until `length` bytes have been received. - # - # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:42 - def read(length = T.unsafe(nil), outbuf = T.unsafe(nil)); end - - # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:59 - def rewind; end - - private - - # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:70 - def advance_io; end - - # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:66 - def current_io; end -end - -# source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:30 -module Multipart::Post::Multipartable - # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:45 - def initialize(path, params, headers = T.unsafe(nil), boundary = T.unsafe(nil)); end - - # Returns the value of attribute boundary. - # - # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:68 - def boundary; end - - private - - # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:73 - def symbolize_keys(hash); end - - class << self - # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:31 - def secure_boundary; end - end -end - -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:27 -module Multipart::Post::Parts; end - -# Represents the epilogue or closing boundary. -# -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:139 -class Multipart::Post::Parts::EpiloguePart - include ::Multipart::Post::Parts::Part - - # @return [EpiloguePart] a new instance of EpiloguePart - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:142 - def initialize(boundary); end -end - -# Represents a part to be filled from file IO. -# -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:84 -class Multipart::Post::Parts::FilePart - include ::Multipart::Post::Parts::Part - - # @param boundary [String] - # @param name [#to_s] - # @param io [IO] - # @param headers [Hash] - # @return [FilePart] a new instance of FilePart - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:93 - def initialize(boundary, name, io, headers = T.unsafe(nil)); end - - # @param boundary [String] - # @param name [#to_s] - # @param filename [String] - # @param type [String] - # @param content_len [Integer] - # @param opts [Hash] - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:108 - def build_head(boundary, name, filename, type, content_len, opts = T.unsafe(nil)); end - - # Returns the value of attribute length. - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:87 - def length; end -end - -# Represents a parametric part to be filled with given value. -# -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:52 -class Multipart::Post::Parts::ParamPart - include ::Multipart::Post::Parts::Part - - # @param boundary [String] - # @param name [#to_s] - # @param value [String] - # @param headers [Hash] Content-Type and Content-ID are used, if present. - # @return [ParamPart] a new instance of ParamPart - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:59 - def initialize(boundary, name, value, headers = T.unsafe(nil)); end - - # @param boundary [String] - # @param name [#to_s] - # @param value [String] - # @param headers [Hash] Content-Type is used, if present. - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:72 - def build_part(boundary, name, value, headers = T.unsafe(nil)); end - - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:64 - def length; end -end - -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:28 -module Multipart::Post::Parts::Part - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:42 - def length; end - - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:46 - def to_io; end - - class << self - # @return [Boolean] - # - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:38 - def file?(value); end - - # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:29 - def new(boundary, name, value, headers = T.unsafe(nil)); end - end -end - -# Convenience methods for dealing with files and IO that are to be uploaded. -# -# source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:26 -class Multipart::Post::UploadIO - # Create an upload IO suitable for including in the params hash of a - # Net::HTTP::Post::Multipart. - # - # Can take two forms. The first accepts a filename and content type, and - # opens the file for reading (to be closed by finalizer). - # - # The second accepts an already-open IO, but also requires a third argument, - # the filename from which it was opened (particularly useful/recommended if - # uploading directly from a form in a framework, which often save the file to - # an arbitrarily named RackMultipart file in /tmp). - # - # @example - # UploadIO.new("file.txt", "text/plain") - # UploadIO.new(file_io, "text/plain", "file.txt") - # @return [UploadIO] a new instance of UploadIO - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:43 - def initialize(filename_or_io, content_type, filename = T.unsafe(nil), opts = T.unsafe(nil)); end - - # Returns the value of attribute content_type. - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27 - def content_type; end - - # Returns the value of attribute io. - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27 - def io; end - - # Returns the value of attribute local_path. - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27 - def local_path; end - - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:69 - def method_missing(*args); end - - # Returns the value of attribute opts. - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27 - def opts; end - - # Returns the value of attribute original_filename. - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27 - def original_filename; end - - # @return [Boolean] - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:73 - def respond_to?(meth, include_all = T.unsafe(nil)); end - - class << self - # @raise [ArgumentError] - # - # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:63 - def convert!(io, content_type, original_filename, local_path); end - end -end - -# source://multipart-post-2.2.3/lib/multipart/post/version.rb:25 -Multipart::Post::VERSION = T.let(T.unsafe(nil), String) - -# source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:85 -Multipartable = Multipart::Post::Multipartable - -# source://multipart-post-2.2.3/lib/multipart/post/parts.rb:151 -Parts = Multipart::Post::Parts - -# source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:80 -UploadIO = Multipart::Post::UploadIO diff --git a/sorbet/rbi/gems/netrc@0.11.0.rbi b/sorbet/rbi/gems/netrc@0.11.0.rbi deleted file mode 100644 index 0000cae..0000000 --- a/sorbet/rbi/gems/netrc@0.11.0.rbi +++ /dev/null @@ -1,150 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `netrc` gem. -# Please instead update this file by running `bin/tapioca gem netrc`. - -# source://netrc-0.11.0/lib/netrc.rb:3 -class Netrc - # @return [Netrc] a new instance of Netrc - # - # source://netrc-0.11.0/lib/netrc.rb:166 - def initialize(path, data); end - - # source://netrc-0.11.0/lib/netrc.rb:180 - def [](k); end - - # source://netrc-0.11.0/lib/netrc.rb:188 - def []=(k, info); end - - # source://netrc-0.11.0/lib/netrc.rb:200 - def delete(key); end - - # source://netrc-0.11.0/lib/netrc.rb:211 - def each(&block); end - - # source://netrc-0.11.0/lib/netrc.rb:196 - def length; end - - # source://netrc-0.11.0/lib/netrc.rb:215 - def new_item(m, l, p); end - - # Returns the value of attribute new_item_prefix. - # - # source://netrc-0.11.0/lib/netrc.rb:178 - def new_item_prefix; end - - # Sets the attribute new_item_prefix - # - # @param value the value to set the attribute new_item_prefix to. - # - # source://netrc-0.11.0/lib/netrc.rb:178 - def new_item_prefix=(_arg0); end - - # source://netrc-0.11.0/lib/netrc.rb:219 - def save; end - - # source://netrc-0.11.0/lib/netrc.rb:233 - def unparse; end - - class << self - # source://netrc-0.11.0/lib/netrc.rb:42 - def check_permissions(path); end - - # source://netrc-0.11.0/lib/netrc.rb:33 - def config; end - - # @yield [self.config] - # - # source://netrc-0.11.0/lib/netrc.rb:37 - def configure; end - - # source://netrc-0.11.0/lib/netrc.rb:10 - def default_path; end - - # source://netrc-0.11.0/lib/netrc.rb:14 - def home_path; end - - # source://netrc-0.11.0/lib/netrc.rb:85 - def lex(lines); end - - # source://netrc-0.11.0/lib/netrc.rb:29 - def netrc_filename; end - - # Returns two values, a header and a list of items. - # Each item is a tuple, containing some or all of: - # - machine keyword (including trailing whitespace+comments) - # - machine name - # - login keyword (including surrounding whitespace+comments) - # - login - # - password keyword (including surrounding whitespace+comments) - # - password - # - trailing chars - # This lets us change individual fields, then write out the file - # with all its original formatting. - # - # source://netrc-0.11.0/lib/netrc.rb:129 - def parse(ts); end - - # Reads path and parses it as a .netrc file. If path doesn't - # exist, returns an empty object. Decrypt paths ending in .gpg. - # - # source://netrc-0.11.0/lib/netrc.rb:51 - def read(path = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://netrc-0.11.0/lib/netrc.rb:112 - def skip?(s); end - end -end - -# source://netrc-0.11.0/lib/netrc.rb:244 -class Netrc::Entry < ::Struct - # Returns the value of attribute login - # - # @return [Object] the current value of login - def login; end - - # Sets the attribute login - # - # @param value [Object] the value to set the attribute login to. - # @return [Object] the newly set value - def login=(_); end - - # Returns the value of attribute password - # - # @return [Object] the current value of password - def password; end - - # Sets the attribute password - # - # @param value [Object] the value to set the attribute password to. - # @return [Object] the newly set value - def password=(_); end - - def to_ary; end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://netrc-0.11.0/lib/netrc.rb:250 -class Netrc::Error < ::StandardError; end - -# source://netrc-0.11.0/lib/netrc.rb:68 -class Netrc::TokenArray < ::Array - # source://netrc-0.11.0/lib/netrc.rb:76 - def readto; end - - # source://netrc-0.11.0/lib/netrc.rb:69 - def take; end -end - -# source://netrc-0.11.0/lib/netrc.rb:4 -Netrc::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/oj@3.13.14.rbi b/sorbet/rbi/gems/oj@3.13.14.rbi deleted file mode 100644 index beb0c4d..0000000 --- a/sorbet/rbi/gems/oj@3.13.14.rbi +++ /dev/null @@ -1,589 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `oj` gem. -# Please instead update this file by running `bin/tapioca gem oj`. - -# source://RUBY_ROOT/json/common.rb:35 -JSON::Parser = JSON::Ext::Parser - -# source://RUBY_ROOT/json/common.rb:73 -JSON::State = JSON::Ext::Generator::State - -# source://oj-3.13.14/lib/oj.rb:2 -module Oj - private - - def add_to_json(*_arg0); end - def compat_load(*_arg0); end - def debug_odd(_arg0); end - def default_options; end - def default_options=(_arg0); end - def dump(*_arg0); end - def fast_generate(*_arg0); end - def generate(*_arg0); end - def load(*_arg0); end - def load_file(*_arg0); end - def mimic_JSON(*_arg0); end - def object_load(*_arg0); end - def optimize_rails; end - def register_odd(*_arg0); end - def register_odd_raw(*_arg0); end - def remove_to_json(*_arg0); end - def safe_load(_arg0); end - def saj_parse(*_arg0); end - def sc_parse(*_arg0); end - def strict_load(*_arg0); end - def to_file(*_arg0); end - def to_json; end - def to_stream(*_arg0); end - def wab_load(*_arg0); end - - class << self - def add_to_json(*_arg0); end - def compat_load(*_arg0); end - def debug_odd(_arg0); end - def default_options; end - def default_options=(_arg0); end - def dump(*_arg0); end - def fast_generate(*_arg0); end - def generate(*_arg0); end - def load(*_arg0); end - def load_file(*_arg0); end - def mimic_JSON(*_arg0); end - - # Loads mimic-ed JSON paths. Used by Oj.mimic_JSON(). - # - # @param mimic_paths [Array] additional paths to add to the Ruby loaded features. - # - # source://oj-3.13.14/lib/oj/mimic.rb:81 - def mimic_loaded(mimic_paths = T.unsafe(nil)); end - - def object_load(*_arg0); end - def optimize_rails; end - def register_odd(*_arg0); end - def register_odd_raw(*_arg0); end - def remove_to_json(*_arg0); end - def safe_load(_arg0); end - def saj_parse(*_arg0); end - def sc_parse(*_arg0); end - def strict_load(*_arg0); end - def to_file(*_arg0); end - def to_json; end - def to_stream(*_arg0); end - def wab_load(*_arg0); end - end -end - -# A generic class that is used only for storing attributes. It is the base -# Class for auto-generated classes in the storage system. Instance variables -# are added using the instance_variable_set() method. All instance variables -# can be accessed using the variable name (without the @ prefix). No setters -# are provided as the Class is intended for reading only. -# -# source://oj-3.13.14/lib/oj/bag.rb:10 -class Oj::Bag - # The initializer can take multiple arguments in the form of key values - # where the key is the variable name and the value is the variable - # value. This is intended for testing purposes only. - # - # @example Oj::Bag.new(:@x => 42, :@y => 57) - # @param args [Hash] instance variable symbols and their values - # @return [Bag] a new instance of Bag - # - # source://oj-3.13.14/lib/oj/bag.rb:17 - def initialize(args = T.unsafe(nil)); end - - # Replaces eql?() with something more reasonable for this Class. - # - # @param other [Object] Object to compare self to - # @return [Boolean] true if each variable and value are the same, otherwise false. - # - # source://oj-3.13.14/lib/oj/bag.rb:48 - def ==(other); end - - # Replaces eql?() with something more reasonable for this Class. - # - # @param other [Object] Object to compare self to - # @return [Boolean] true if each variable and value are the same, otherwise false. - # - # source://oj-3.13.14/lib/oj/bag.rb:48 - def eql?(other); end - - # Handles requests for variable values. Others cause an Exception to be - # raised. - # - # @param m [Symbol] method symbol - # @raise [ArgumentError] if an argument is given. Zero arguments expected. - # @raise [NoMethodError] if the instance variable is not defined. - # @return [Boolean] the value of the specified instance variable. - # - # source://oj-3.13.14/lib/oj/bag.rb:38 - def method_missing(m, *args, &block); end - - # Replaces the Object.respond_to?() method. - # - # @param m [Symbol] method symbol - # @return [Boolean] true for any method that matches an instance - # variable reader, otherwise false. - # - # source://oj-3.13.14/lib/oj/bag.rb:27 - def respond_to?(m); end - - class << self - # Define a new class based on the Oj::Bag class. This is used internally in - # the Oj module and is available to service wrappers that receive XML - # requests that include Objects of Classes not defined in the storage - # process. - # - # @param classname [String] Class name or symbol that includes Module names. - # @raise [NameError] if the classname is invalid. - # @return [Object] an instance of the specified Class. - # - # source://oj-3.13.14/lib/oj/bag.rb:64 - def define_class(classname); end - end -end - -class Oj::CStack; end - -# Custom mode can be used to emulate the compat mode with some minor -# differences. These are the options that setup the custom mode to be like -# the compat mode. -# -# source://oj-3.13.14/lib/oj/mimic.rb:15 -Oj::CUSTOM_MIMIC_JSON_OPTIONS = T.let(T.unsafe(nil), Hash) - -class Oj::Cache; end - -# An Exception that is raised as a result of a path being too deep. -# -# source://oj-3.13.14/lib/oj/error.rb:14 -class Oj::DepthError < ::Oj::Error; end - -class Oj::Doc - def clone; end - def close; end - def dump(*_arg0); end - def dup; end - def each_child(*_arg0); end - def each_leaf(*_arg0); end - def each_value(*_arg0); end - def exists?(_arg0); end - def fetch(*_arg0); end - def home; end - def local_key; end - def move(_arg0); end - def path; end - def size; end - def type(*_arg0); end - def where; end - def where?; end - - class << self - def open(_arg0); end - def open_file(_arg0); end - def parse(_arg0); end - end -end - -# A Hash subclass that normalizes the hash keys to allow lookup by the -# key.to_s or key.to_sym. It also supports looking up hash values by methods -# that match the keys. -# -# source://oj-3.13.14/lib/oj/easy_hash.rb:7 -class Oj::EasyHash < ::Hash - # Initializes the instance to an empty Hash. - # - # @return [EasyHash] a new instance of EasyHash - # - # source://oj-3.13.14/lib/oj/easy_hash.rb:10 - def initialize; end - - # source://oj-3.13.14/lib/oj/easy_hash.rb:25 - def [](key); end - - # Handles requests for Hash values. Others cause an Exception to be raised. - # - # @param m [Symbol|String] method symbol - # @raise [ArgumentError] if an argument is given. Zero arguments expected. - # @raise [NoMethodError] if the instance variable is not defined. - # @return [Boolean] the value of the specified instance variable. - # - # source://oj-3.13.14/lib/oj/easy_hash.rb:36 - def method_missing(m, *args, &block); end - - # Replaces the Object.respond_to?() method. - # - # @param m [Symbol] method symbol - # @param include_all [Boolean] whether to include private and protected methods in the search - # @return [Boolean] true for any method that matches an instance - # variable reader, otherwise false. - # - # source://oj-3.13.14/lib/oj/easy_hash.rb:18 - def respond_to?(m, include_all = T.unsafe(nil)); end -end - -# Inherit Error class from StandardError. -# -# source://oj-3.13.14/lib/oj/error.rb:5 -class Oj::Error < ::StandardError; end - -# An Exception that is raised if a file fails to load. -# -# source://oj-3.13.14/lib/oj/error.rb:17 -class Oj::LoadError < ::Oj::Error; end - -# A bit hack-ish but does the trick. The JSON.dump_default_options is a Hash -# but in mimic we use a C struct to store defaults. This class creates a view -# onto that struct. -# -# source://oj-3.13.14/lib/oj/mimic.rb:60 -class Oj::MimicDumpOption < ::Hash - # @return [MimicDumpOption] a new instance of MimicDumpOption - # - # source://oj-3.13.14/lib/oj/mimic.rb:61 - def initialize; end - - # source://oj-3.13.14/lib/oj/mimic.rb:69 - def []=(key, value); end -end - -# An Exception that is raised if there is a conflict with mimicking JSON -# -# source://oj-3.13.14/lib/oj/error.rb:20 -class Oj::MimicError < ::Oj::Error; end - -# An Exception that is raised as a result of a parse error while parsing a JSON document. -# -# source://oj-3.13.14/lib/oj/error.rb:11 -class Oj::ParseError < ::Oj::Error; end - -class Oj::Parser - def file(_arg0); end - def just_one; end - def just_one=(_arg0); end - def load(_arg0); end - def method_missing(*_arg0); end - def parse(_arg0); end - - private - - def new(*_arg0); end - def saj; end - def usual; end - def validate; end - - class << self - def new(*_arg0); end - def saj; end - def usual; end - def validate; end - end -end - -module Oj::Rails - private - - def deoptimize(*_arg0); end - def encode(*_arg0); end - def mimic_JSON; end - def optimize(*_arg0); end - def optimized?(_arg0); end - def set_decoder; end - def set_encoder; end - - class << self - def deoptimize(*_arg0); end - def encode(*_arg0); end - def mimic_JSON; end - def optimize(*_arg0); end - def optimized?(_arg0); end - def set_decoder; end - def set_encoder; end - end -end - -class Oj::Rails::Encoder - def deoptimize(*_arg0); end - def encode(_arg0); end - def optimize(*_arg0); end - def optimized?(_arg0); end - - private - - def new(*_arg0); end - - class << self - def new(*_arg0); end - end -end - -# A SAX style parse handler for JSON hence the acronym SAJ for Simple API for -# JSON. The Oj::Saj handler class should be subclassed and then used with the -# Oj::Saj key_parse() method. The Saj methods will then be called as the file -# is parsed. -# -# To make the desired methods active while parsing the desired method should -# be made public in the subclasses. If the methods remain private they will -# not be called during parsing. -# -# def hash_start(key); end -# def hash_end(key); end -# def array_start(key); end -# def array_end(key); end -# def add_value(value, key); end -# def error(message, line, column); end -# -# @example -# -# require 'oj' -# -# class MySaj < ::Oj::Saj -# def initialize() -# @hash_cnt = 0 -# end -# -# def hash_start(key) -# @hash_cnt += 1 -# end -# end -# -# cnt = MySaj.new() -# File.open('any.json', 'r') do |f| -# Oj.saj_parse(cnt, f) -# end -# -# source://oj-3.13.14/lib/oj/saj.rb:37 -class Oj::Saj - # Create a new instance of the Saj handler class. - # - # @return [Saj] a new instance of Saj - # - # source://oj-3.13.14/lib/oj/saj.rb:39 - def initialize; end - - private - - # source://oj-3.13.14/lib/oj/saj.rb:59 - def add_value(value, key); end - - # source://oj-3.13.14/lib/oj/saj.rb:56 - def array_end(key); end - - # source://oj-3.13.14/lib/oj/saj.rb:53 - def array_start(key); end - - # source://oj-3.13.14/lib/oj/saj.rb:62 - def error(message, line, column); end - - # source://oj-3.13.14/lib/oj/saj.rb:50 - def hash_end(key); end - - # source://oj-3.13.14/lib/oj/saj.rb:47 - def hash_start(key); end -end - -# A Simple Callback Parser (SCP) for JSON. The Oj::ScHandler class should be -# subclassed and then used with the Oj.sc_parse() method. The Scp methods will -# then be called as the file is parsed. The handler does not have to be a -# subclass of the ScHandler class as long as it responds to the desired -# methods. -# -# To make the desired methods active while parsing the desired method should -# be made public in the subclasses. If the methods remain private they will -# not be called during parsing. -# -# def hash_start(); end -# def hash_end(); end -# def hash_key(key); end -# def hash_set(h, key, value); end -# def array_start(); end -# def array_end(); end -# def array_append(a, value); end -# def add_value(value); end -# -# As certain elements of a JSON document are reached during parsing the -# callbacks are called. The parser helps by keeping track of objects created -# by the callbacks but does not create those objects itself. -# -# hash_start -# -# When a JSON object element starts the hash_start() callback is called if -# public. It should return what ever Ruby Object is to be used as the element -# that will later be included in the hash_set() callback. -# -# hash_end -# -# When a hash key is encountered the hash_key method is called with the parsed -# hash value key. The return value from the call is then used as the key in -# the key-value pair that follows. -# -# hash_key -# -# At the end of a JSON object element the hash_end() callback is called if public. -# -# hash_set -# -# When a key value pair is encountered during parsing the hash_set() callback -# is called if public. The first element will be the object returned from the -# enclosing hash_start() callback. The second argument is the key and the last -# is the value. -# -# array_start -# -# When a JSON array element is started the array_start() callback is called if -# public. It should return what ever Ruby Object is to be used as the element -# that will later be included in the array_append() callback. -# -# array_end -# -# At the end of a JSON array element the array_end() callback is called if public. -# -# array_append -# -# When a element is encountered that is an element of an array the -# array_append() callback is called if public. The first argument to the -# callback is the Ruby object returned from the enclosing array_start() -# callback. -# -# add_value -# -# The handler is expected to handle multiple JSON elements in one stream, -# file, or string. When a top level JSON has been read completely the -# add_value() callback is called. Even if only one element was ready this -# callback returns the Ruby object that was constructed during the parsing. -# -# @example -# -# require 'oj' -# -# class MyHandler < ::Oj::ScHandler -# def hash_start -# {} -# end -# -# def hash_set(h,k,v) -# h[k] = v -# end -# -# def array_start -# [] -# end -# -# def array_append(a,v) -# a << v -# end -# -# def add_value(v) -# p v -# end -# -# def error(message, line, column) -# p "ERROR: #{message}" -# end -# end -# -# File.open('any.json', 'r') do |f| -# Oj.sc_parse(MyHandler.new, f) -# end -# -# source://oj-3.13.14/lib/oj/schandler.rb:106 -class Oj::ScHandler - # Create a new instance of the ScHandler class. - # - # @return [ScHandler] a new instance of ScHandler - # - # source://oj-3.13.14/lib/oj/schandler.rb:108 - def initialize; end - - private - - # source://oj-3.13.14/lib/oj/schandler.rb:135 - def add_value(value); end - - # source://oj-3.13.14/lib/oj/schandler.rb:138 - def array_append(a, value); end - - # source://oj-3.13.14/lib/oj/schandler.rb:132 - def array_end; end - - # source://oj-3.13.14/lib/oj/schandler.rb:129 - def array_start; end - - # source://oj-3.13.14/lib/oj/schandler.rb:119 - def hash_end; end - - # source://oj-3.13.14/lib/oj/schandler.rb:122 - def hash_key(key); end - - # source://oj-3.13.14/lib/oj/schandler.rb:126 - def hash_set(h, key, value); end - - # source://oj-3.13.14/lib/oj/schandler.rb:116 - def hash_start; end -end - -class Oj::StreamWriter - def flush; end - def pop; end - def pop_all; end - def push_array(*_arg0); end - def push_json(*_arg0); end - def push_key(_arg0); end - def push_object(*_arg0); end - def push_value(*_arg0); end - - private - - def new(*_arg0); end - - class << self - def new(*_arg0); end - end -end - -class Oj::StringWriter - def as_json; end - def pop; end - def pop_all; end - def push_array(*_arg0); end - def push_json(*_arg0); end - def push_key(_arg0); end - def push_object(*_arg0); end - def push_value(*_arg0); end - def raw_json; end - def reset; end - def to_s; end - - private - - def new(*_arg0); end - - class << self - def new(*_arg0); end - end -end - -# Current version of the module. -# -# source://oj-3.13.14/lib/oj/version.rb:4 -Oj::VERSION = T.let(T.unsafe(nil), String) - -# More monkey patches. -# -# source://oj-3.13.14/lib/oj/mimic.rb:282 -class String - include ::Comparable - - # source://oj-3.13.14/lib/oj/mimic.rb:289 - def to_json_raw(*_arg0); end - - # source://oj-3.13.14/lib/oj/mimic.rb:283 - def to_json_raw_object; end - - class << self - # source://oj-3.13.14/lib/oj/mimic.rb:292 - def json_create(obj); end - end -end diff --git a/sorbet/rbi/gems/zeitwerk@2.6.0.rbi b/sorbet/rbi/gems/zeitwerk@2.6.0.rbi deleted file mode 100644 index e371709..0000000 --- a/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +++ /dev/null @@ -1,867 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `zeitwerk` gem. -# Please instead update this file by running `bin/tapioca gem zeitwerk`. - -# Kernel extensions for minitest -# -# source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:3 -module Kernel - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:24 - def require(path); end - - class << self - # source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:24 - def require(path); end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk.rb:3 -module Zeitwerk - class << self - # This is a dangerous method. - # - # source://zeitwerk-2.6.0/lib/zeitwerk.rb:19 - def with_loader; end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:4 -class Zeitwerk::Error < ::StandardError; end - -# Centralizes the logic for the trace point used to detect the creation of -# explicit namespaces, needed to descend into matching subdirectories right -# after the constant has been defined. -# -# The implementation assumes an explicit namespace is managed by one loader. -# Loaders that reopen namespaces owned by other projects are responsible for -# loading their constant before setup. This is documented. -# -# source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:11 -module Zeitwerk::ExplicitNamespace - extend ::Zeitwerk::RealModName - - class << self - # Maps constant paths that correspond to explicit namespaces according to - # the file system, to the loader responsible for them. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:20 - def cpaths; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:24 - def mutex; end - - # Asserts `cpath` corresponds to an explicit namespace for which `loader` - # is responsible. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:35 - def register(cpath, loader); end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:28 - def tracer; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:46 - def unregister_loader(loader); end - - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:54 - def disable_tracer_if_unneeded; end - - # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:61 - def tracepoint_class_callback(event); end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:5 -class Zeitwerk::GemInflector < ::Zeitwerk::Inflector - # @return [GemInflector] a new instance of GemInflector - # - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:6 - def initialize(root_file); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:13 - def camelize(basename, abspath); end -end - -# @private -# -# source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:7 -class Zeitwerk::GemLoader < ::Zeitwerk::Loader - # @return [GemLoader] a new instance of GemLoader - # - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:17 - def initialize(root_file, warn_on_extra_files:); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:30 - def setup; end - - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:38 - def warn_on_extra_files; end - - class << self - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:12 - def _new(root_file, warn_on_extra_files:); end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:4 -class Zeitwerk::Inflector - # Very basic snake case -> camel case conversion. - # - # inflector = Zeitwerk::Inflector.new - # inflector.camelize("post", ...) # => "Post" - # inflector.camelize("users_controller", ...) # => "UsersController" - # inflector.camelize("api", ...) # => "Api" - # - # Takes into account hard-coded mappings configured with `inflect`. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:15 - def camelize(basename, _abspath); end - - # Configures hard-coded inflections: - # - # inflector = Zeitwerk::Inflector.new - # inflector.inflect( - # "html_parser" => "HTMLParser", - # "mysql_adapter" => "MySQLAdapter" - # ) - # - # inflector.camelize("html_parser", abspath) # => "HTMLParser" - # inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter" - # inflector.camelize("users_controller", abspath) # => "UsersController" - # - # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:32 - def inflect(inflections); end - - private - - # Hard-coded basename to constant name user maps that override the default - # inflection logic. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:42 - def overrides; end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:6 -class Zeitwerk::Loader - include ::Zeitwerk::RealModName - include ::Zeitwerk::Loader::Callbacks - include ::Zeitwerk::Loader::Helpers - include ::Zeitwerk::Loader::Config - - # @return [Loader] a new instance of Loader - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:83 - def initialize; end - - # We keep track of autoloaded directories to remove them from the registry - # at the end of eager loading. - # - # Files are removed as they are autoloaded, but directories need to wait due - # to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded). - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:39 - def autoloaded_dirs; end - - # Maps absolute paths for which an autoload has been set ---and not - # executed--- to their corresponding parent class or module and constant - # name. - # - # "/Users/fxn/blog/app/models/user.rb" => [Object, :User], - # "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing] - # ... - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:29 - def autoloads; end - - # Eager loads all files in the root directories, recursively. Files do not - # need to be in `$LOAD_PATH`, absolute file names are used. Ignored files - # are not eager loaded. You can opt-out specifically in specific files and - # directories with `do_not_eager_load`, and that can be overridden passing - # `force: true`. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:218 - def eager_load(force: T.unsafe(nil)); end - - # Maps constant paths of namespaces to arrays of corresponding directories. - # - # For example, given this mapping: - # - # "Admin" => [ - # "/Users/fxn/blog/app/controllers/admin", - # "/Users/fxn/blog/app/models/admin", - # ... - # ] - # - # when `Admin` gets defined we know that it plays the role of a namespace and - # that its children are spread over those directories. We'll visit them to set - # up the corresponding autoloads. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:73 - def lazy_subdirs; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:77 - def mutex; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:81 - def mutex2; end - - # Unloads all loaded code, and calls setup again so that the loader is able - # to pick any changes in the file system. - # - # This method is not thread-safe, please see how this can be achieved by - # client code in the README of the project. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:202 - def reload; end - - # Sets autoloads in the root namespace. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:101 - def setup; end - - # Stores metadata needed for unloading. Its entries look like this: - # - # "Admin::Role" => [".../admin/role.rb", [Admin, :Role]] - # - # The cpath as key helps implementing unloadable_cpath? The file name is - # stored in order to be able to delete it from $LOADED_FEATURES, and the - # pair [Module, Symbol] is used to remove_const the constant from the class - # or module object. - # - # If reloading is enabled, this hash is filled as constants are autoloaded - # or eager loaded. Otherwise, the collection remains empty. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:55 - def to_unload; end - - # Removes loaded constants and configured autoloads. - # - # The objects the constants stored are no longer reachable through them. In - # addition, since said objects are normally not referenced from anywhere - # else, they are eligible for garbage collection, which would effectively - # unload them. - # - # This method is public but undocumented. Main interface is `reload`, which - # means `unload` + `setup`. This one is avaiable to be used together with - # `unregister`, which is undocumented too. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:127 - def unload; end - - # Says if the given constant path would be unloaded on reload. This - # predicate returns `false` if reloading is disabled. - # - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:267 - def unloadable_cpath?(cpath); end - - # Returns an array with the constant paths that would be unloaded on reload. - # This predicate returns an empty array if reloading is disabled. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:275 - def unloadable_cpaths; end - - # This is a dangerous method. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:283 - def unregister; end - - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:397 - def autoload_file(parent, cname, file); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:453 - def autoload_path_set_by_me_for?(parent, cname); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:376 - def autoload_subdir(parent, cname, subdir); end - - # `dir` is the directory that would have autovivified a namespace. `file` is - # the file where we've found the namespace is explicitly defined. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:421 - def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:467 - def raise_if_conflicting_directory(dir); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:462 - def register_explicit_namespace(cpath); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:491 - def run_on_unload_callbacks(cpath, value, abspath); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:432 - def set_autoload(parent, cname, abspath); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:333 - def set_autoloads_in_dir(dir, parent); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:498 - def unload_autoload(parent, cname); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:504 - def unload_cref(parent, cname); end - - class << self - # Returns an array with the absolute paths of the root directories of all - # registered loaders. This is a read-only collection. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:325 - def all_dirs; end - - # Returns the value of attribute default_logger. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:292 - def default_logger; end - - # Sets the attribute default_logger - # - # @param value the value to set the attribute default_logger to. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:292 - def default_logger=(_arg0); end - - # Broadcasts `eager_load` to all loaders. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:317 - def eager_load_all; end - - # This is a shortcut for - # - # require "zeitwerk" - # loader = Zeitwerk::Loader.new - # loader.tag = File.basename(__FILE__, ".rb") - # loader.inflector = Zeitwerk::GemInflector.new(__FILE__) - # loader.push_dir(__dir__) - # - # except that this method returns the same object in subsequent calls from - # the same file, in the unlikely case the gem wants to be able to reload. - # - # This method returns a subclass of Zeitwerk::Loader, but the exact type - # is private, client code can only rely on the interface. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:309 - def for_gem(warn_on_extra_files: T.unsafe(nil)); end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:3 -module Zeitwerk::Loader::Callbacks - include ::Zeitwerk::RealModName - - # Invoked from our decorated Kernel#require when a managed directory is - # autoloaded. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:34 - def on_dir_autoloaded(dir); end - - # Invoked from our decorated Kernel#require when a managed file is autoloaded. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:10 - def on_file_autoloaded(file); end - - # Invoked when a class or module is created or reopened, either from the - # tracer or from module autovivification. If the namespace has matching - # subdirectories, we descend into them now. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:73 - def on_namespace_loaded(namespace); end - - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:84 - def run_on_load_callbacks(cpath, value, abspath); end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:6 -module Zeitwerk::Loader::Config - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:82 - def initialize; end - - # Configure directories or glob patterns to be collapsed. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:191 - def collapse(*glob_patterns); end - - # The actual collection of absolute directory names at the time the collapse - # glob patterns were expanded. Computed on setup, and recomputed on reload. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:51 - def collapse_dirs; end - - # Absolute paths of directories or glob patterns to be collapsed. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:44 - def collapse_glob_patterns; end - - # Absolute paths of the root directories. This is a read-only collection, - # please push here via `push_dir`. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:143 - def dirs; end - - # Let eager load ignore the given files or directories. The constants defined - # in those files are still autoloadable. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:173 - def do_not_eager_load(*paths); end - - # Absolute paths of files or directories not to be eager loaded. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:57 - def eager_load_exclusions; end - - # You need to call this method before setup in order to be able to reload. - # There is no way to undo this, either you want to reload or you don't. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:152 - def enable_reloading; end - - # Configure files, directories, or glob patterns to be totally ignored. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:180 - def ignore(*glob_patterns); end - - # Absolute paths of files, directories, or glob patterns to be totally - # ignored. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:30 - def ignored_glob_patterns; end - - # The actual collection of absolute file and directory names at the time the - # ignored glob patterns were expanded. Computed on setup, and recomputed on - # reload. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:38 - def ignored_paths; end - - # @private - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:269 - def ignores?(abspath); end - - # Returns the value of attribute inflector. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:23 - def inflector; end - - # Sets the attribute inflector - # - # @param value the value to set the attribute inflector to. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:23 - def inflector=(_arg0); end - - # Logs to `$stdout`, handy shortcut for debugging. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:263 - def log!; end - - # Returns the value of attribute logger. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:80 - def logger; end - - # Sets the attribute logger - # - # @param value the value to set the attribute logger to. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:80 - def logger=(_arg0); end - - # Configure a block to be invoked once a certain constant path is loaded. - # Supports multiple callbacks, and if there are many, they are executed in - # the order in which they were defined. - # - # loader.on_load("SomeApiClient") do |klass, _abspath| - # klass.endpoint = "https://api.dev" - # end - # - # Can also be configured for any constant loaded: - # - # loader.on_load do |cpath, value, abspath| - # # ... - # end - # - # @raise [TypeError] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:227 - def on_load(cpath = T.unsafe(nil), &block); end - - # User-oriented callbacks to be fired when a constant is loaded. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:70 - def on_load_callbacks; end - - # Configure a block to be called after setup and on each reload. - # If setup was already done, the block runs immediately. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:203 - def on_setup(&block); end - - # User-oriented callbacks to be fired on setup and on reload. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:63 - def on_setup_callbacks; end - - # Configure a block to be invoked right before a certain constant is removed. - # Supports multiple callbacks, and if there are many, they are executed in the - # order in which they were defined. - # - # loader.on_unload("Country") do |klass, _abspath| - # klass.clear_cache - # end - # - # Can also be configured for any removed constant: - # - # loader.on_unload do |cpath, value, abspath| - # # ... - # end - # - # @raise [TypeError] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:252 - def on_unload(cpath = T.unsafe(nil), &block); end - - # User-oriented callbacks to be fired before constants are removed. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:77 - def on_unload_callbacks; end - - # Pushes `path` to the list of root directories. - # - # Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in - # the same process already manages that directory or one of its ascendants or - # descendants. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:107 - def push_dir(path, namespace: T.unsafe(nil)); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:165 - def reloading_enabled?; end - - # Absolute paths of the root directories. Stored in a hash to preserve - # order, easily handle duplicates, and also be able to have a fast lookup, - # needed for detecting nested paths. - # - # "/Users/fxn/blog/app/assets" => true, - # "/Users/fxn/blog/app/channels" => true, - # ... - # - # This is a private collection maintained by the loader. The public - # interface for it is `push_dir` and `dirs`. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:20 - def root_dirs; end - - # Returns the loader's tag. - # - # Implemented as a method instead of via attr_reader for symmetry with the - # writer below. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:128 - def tag; end - - # Sets a tag for the loader, useful for logging. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:135 - def tag=(tag); end - - private - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:278 - def actual_root_dirs; end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:295 - def collapse?(dir); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:290 - def excluded_from_eager_load?(abspath); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:305 - def expand_glob_patterns(glob_patterns); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:300 - def expand_paths(paths); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:317 - def recompute_collapse_dirs; end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:312 - def recompute_ignored_paths; end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:285 - def root_dir?(dir); end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:3 -module Zeitwerk::Loader::Helpers - private - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:120 - def cdef?(parent, cname); end - - # @raise [NameError] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:126 - def cget(parent, cname); end - - # Symbol#name was introduced in Ruby 3.0. It returns always the same - # frozen object, so we may save a few string allocations. - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:110 - def cpath(parent, cname); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:68 - def dir?(path); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:46 - def has_at_least_one_ruby_file?(dir); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:73 - def hidden?(basename); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:9 - def log(message); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:17 - def ls(dir); end - - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:63 - def ruby?(path); end - - # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:101 - def strict_autoload_path(parent, cname); end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:16 -Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) - -# source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:13 -class Zeitwerk::NameError < ::NameError; end - -# source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:3 -module Zeitwerk::RealModName - # source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:14 - def real_mod_name(mod); end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:4 -Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod) - -# source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:4 -module Zeitwerk::Registry - class << self - # Maps absolute paths to the loaders responsible for them. - # - # This information is used by our decorated `Kernel#require` to be able to - # invoke callbacks and autovivify modules. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:26 - def autoloads; end - - # Registers gem loaders to let `for_gem` be idempotent in case of reload. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:17 - def gem_loaders_by_root_file; end - - # @private - # @return [Boolean] - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:113 - def inception?(cpath); end - - # This hash table addresses an edge case in which an autoload is ignored. - # - # For example, let's suppose we want to autoload in a gem like this: - # - # # lib/my_gem.rb - # loader = Zeitwerk::Loader.new - # loader.push_dir(__dir__) - # loader.setup - # - # module MyGem - # end - # - # if you require "my_gem", as Bundler would do, this happens while setting - # up autoloads: - # - # 1. Object.autoload?(:MyGem) returns `nil` because the autoload for - # the constant is issued by Zeitwerk while the same file is being - # required. - # 2. The constant `MyGem` is undefined while setup runs. - # - # Therefore, a directory `lib/my_gem` would autovivify a module according to - # the existing information. But that would be wrong. - # - # To overcome this fundamental limitation, we keep track of the constant - # paths that are in this situation ---in the example above, "MyGem"--- and - # take this collection into account for the autovivification logic. - # - # Note that you cannot generally address this by moving the setup code - # below the constant definition, because we want libraries to be able to - # use managed constants in the module body: - # - # module MyGem - # include MyConcern - # end - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:65 - def inceptions; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:121 - def loader_for(path); end - - # This method returns always a loader, the same instance for the same root - # file. That is how Zeitwerk::Loader.for_gem is idempotent. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:89 - def loader_for_gem(root_file, warn_on_extra_files:); end - - # Keeps track of all loaders. Useful to broadcast messages and to prevent - # them from being garbage collected. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:11 - def loaders; end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:127 - def on_unload(loader); end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:95 - def register_autoload(loader, abspath); end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:107 - def register_inception(cpath, abspath, loader); end - - # Registers a loader. - # - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:71 - def register_loader(loader); end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:101 - def unregister_autoload(abspath); end - - # @private - # - # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:77 - def unregister_loader(loader); end - end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:7 -class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error - # @return [ReloadingDisabledError] a new instance of ReloadingDisabledError - # - # source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:8 - def initialize; end -end - -# source://zeitwerk-2.6.0/lib/zeitwerk/version.rb:4 -Zeitwerk::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/todo.rbi b/sorbet/rbi/todo.rbi deleted file mode 100644 index dadd491..0000000 --- a/sorbet/rbi/todo.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# DO NOT EDIT MANUALLY -# This is an autogenerated file for unresolved constants. -# Please instead update this file by running `bin/tapioca todo`. - -# typed: false - -module Mocha::Mock; end -module WhatsappSdk::Api::Responses::DataResponse::NotImplemented; end diff --git a/sorbet/shims/request.rbi b/sorbet/shims/request.rbi deleted file mode 100644 index 2ffa04f..0000000 --- a/sorbet/shims/request.rbi +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -# typed: strict - -module WhatsappSdk - module Api - class Request - def download_file(url, path_to_file_name = nil); end - end - end -end diff --git a/sorbet/tapioca/config.yml b/sorbet/tapioca/config.yml deleted file mode 100644 index 886ae58..0000000 --- a/sorbet/tapioca/config.yml +++ /dev/null @@ -1,13 +0,0 @@ -gem: - # Add your `gem` command parameters here: - # - # exclude: - # - gem_name - # doc: true - # workers: 5 -dsl: - # Add your `dsl` command parameters here: - # - # exclude: - # - SomeGeneratorName - # workers: 5 diff --git a/sorbet/tapioca/require.rb b/sorbet/tapioca/require.rb deleted file mode 100644 index b1092eb..0000000 --- a/sorbet/tapioca/require.rb +++ /dev/null @@ -1,4 +0,0 @@ -# typed: true -# frozen_string_literal: true - -# Add your extra requires here (`bin/tapioca require` can be used to boostrap this list) From ffe8bf721cccdead783473b3e5f45f45664fc02f Mon Sep 17 00:00:00 2001 From: ignacio-chiazzo Date: Sun, 1 Sep 2024 11:08:04 -0300 Subject: [PATCH 4/5] replace Sorbet enums with Ruby modules --- lib/whatsapp_sdk/api/client.rb | 10 +- lib/whatsapp_sdk/api/messages.rb | 2 +- lib/whatsapp_sdk/api/phone_numbers.rb | 1 - lib/whatsapp_sdk/api/request.rb | 2 - .../business_profile_data_response.rb | 2 +- .../responses/phone_number_data_response.rb | 6 +- .../api/responses/template_data_response.rb | 4 +- lib/whatsapp_sdk/api/templates.rb | 4 +- lib/whatsapp_sdk/error.rb | 1 - lib/whatsapp_sdk/resource/address_type.rb | 8 +- lib/whatsapp_sdk/resource/button_parameter.rb | 11 +-- lib/whatsapp_sdk/resource/component.rb | 27 +++-- lib/whatsapp_sdk/resource/email.rb | 1 - lib/whatsapp_sdk/resource/interactive.rb | 14 ++- .../resource/interactive_action.rb | 20 ++-- .../interactive_action_reply_button.rb | 12 +-- .../resource/interactive_action_section.rb | 2 +- .../resource/interactive_header.rb | 58 +++++------ lib/whatsapp_sdk/resource/media.rb | 30 ++---- lib/whatsapp_sdk/resource/parameter_object.rb | 99 ++++++++++--------- lib/whatsapp_sdk/resource/template.rb | 40 +++++--- lib/whatsapp_sdk/version.rb | 1 - test/whatsapp/api/messages_test.rb | 54 +++++----- test/whatsapp/api/templates_test.rb | 4 +- test/whatsapp/contact_helper.rb | 16 +-- .../resource/button_parameter_test.rb | 8 +- test/whatsapp/resource/component_test.rb | 48 ++++----- .../resource/interactive_action_test.rb | 14 +-- test/whatsapp/resource/interactive_test.rb | 72 +++++++------- test/whatsapp/resource/media_test.rb | 14 +-- .../resource/parameter_object_test.rb | 46 ++++----- 31 files changed, 312 insertions(+), 319 deletions(-) diff --git a/lib/whatsapp_sdk/api/client.rb b/lib/whatsapp_sdk/api/client.rb index d45f339..cae0059 100644 --- a/lib/whatsapp_sdk/api/client.rb +++ b/lib/whatsapp_sdk/api/client.rb @@ -7,11 +7,11 @@ module WhatsappSdk module Api class Client API_VERSIONS = [ - 'v19.0', 'v18.0', 'v17.0', 'v16.0', 'v15.0', 'v14.0', 'v13.0', 'v12.0', - 'v11.0', 'v10.0', 'v9.0', 'v8.0', 'v7.0', 'v6.0', 'v5.0', 'v4.0', 'v3.3', - 'v3.2', 'v3.1', 'v3.0', 'v2.12', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7', - 'v2.6', 'v2.5', 'v2.4', 'v2.3', 'v2.2', 'v2.1' - ].freeze + 'v19.0', 'v18.0', 'v17.0', 'v16.0', 'v15.0', 'v14.0', 'v13.0', 'v12.0', + 'v11.0', 'v10.0', 'v9.0', 'v8.0', 'v7.0', 'v6.0', 'v5.0', 'v4.0', 'v3.3', + 'v3.2', 'v3.1', 'v3.0', 'v2.12', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7', + 'v2.6', 'v2.5', 'v2.4', 'v2.3', 'v2.2', 'v2.1' + ].freeze def initialize( access_token, diff --git a/lib/whatsapp_sdk/api/messages.rb b/lib/whatsapp_sdk/api/messages.rb index a3e0d34..b6a0e84 100644 --- a/lib/whatsapp_sdk/api/messages.rb +++ b/lib/whatsapp_sdk/api/messages.rb @@ -245,7 +245,7 @@ def send_sticker(sender_id:, recipient_number:, sticker_id: nil, link: nil, mess messaging_product: "whatsapp", to: recipient_number, recipient_type: "individual", - type: Resource::Media::Type::Sticker + type: Resource::Media::Type::STICKER } params[:sticker] = link ? { link: link } : { id: sticker_id } params[:context] = { message_id: message_id } if message_id diff --git a/lib/whatsapp_sdk/api/phone_numbers.rb b/lib/whatsapp_sdk/api/phone_numbers.rb index a201372..ea6f782 100644 --- a/lib/whatsapp_sdk/api/phone_numbers.rb +++ b/lib/whatsapp_sdk/api/phone_numbers.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true require_relative "request" diff --git a/lib/whatsapp_sdk/api/request.rb b/lib/whatsapp_sdk/api/request.rb index 7b5ec99..d415158 100644 --- a/lib/whatsapp_sdk/api/request.rb +++ b/lib/whatsapp_sdk/api/request.rb @@ -4,8 +4,6 @@ module WhatsappSdk module Api class Request - - def initialize(client = WhatsappSdk.configuration.client) @client = client end diff --git a/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb b/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb index 47c8b2a..6c6133d 100644 --- a/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb @@ -7,7 +7,7 @@ module Api module Responses class BusinessProfileDataResponse < DataResponse attr_accessor :about, :address, :description, :email, :messaging_product, - :profile_picture_url, :vertical, :websites + :profile_picture_url, :vertical, :websites def initialize(response) @about = response["data"][0]["about"] diff --git a/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb b/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb index a27e6f3..f438c39 100644 --- a/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb @@ -7,9 +7,9 @@ module Api module Responses class PhoneNumberDataResponse < DataResponse attr_accessor :id, :verified_name, :display_phone_number, :quality_rating, :is_pin_enabled, - :is_official_business_account, :account_mode, :certificate, :code_verification_status, - :eligibility_for_api_business_global_search, :name_status, :new_name_status, :status, - :search_visibility, :messaging_limit_tier + :is_official_business_account, :account_mode, :certificate, :code_verification_status, + :eligibility_for_api_business_global_search, :name_status, :new_name_status, :status, + :search_visibility, :messaging_limit_tier def initialize(response) @id = response["id"] diff --git a/lib/whatsapp_sdk/api/responses/template_data_response.rb b/lib/whatsapp_sdk/api/responses/template_data_response.rb index c7ab47c..333a0e7 100644 --- a/lib/whatsapp_sdk/api/responses/template_data_response.rb +++ b/lib/whatsapp_sdk/api/responses/template_data_response.rb @@ -24,8 +24,8 @@ def self.build_from_response(response:) private def parse_template(template_json) - status = ::WhatsappSdk::Resource::Template::Status.try_deserialize(template_json["status"]) - category = ::WhatsappSdk::Resource::Template::Category.try_deserialize(template_json["category"]) + status = template_json["status"] + category = template_json["category"] id = template_json["id"] language = template_json["language"] name = template_json["name"] diff --git a/lib/whatsapp_sdk/api/templates.rb b/lib/whatsapp_sdk/api/templates.rb index ea1fc22..4e7d144 100644 --- a/lib/whatsapp_sdk/api/templates.rb +++ b/lib/whatsapp_sdk/api/templates.rb @@ -40,7 +40,7 @@ def initialize(category:) def create( business_id:, name:, category:, language:, components_json: nil, allow_category_change: nil ) - unless WhatsappSdk::Resource::Template::Category.try_deserialize(category) + unless WhatsappSdk::Resource::Template::Category.valid?(category) raise InvalidCategoryError.new(category: category) end @@ -122,7 +122,7 @@ def get_message_template_namespace(business_id:) # @param components_json [Json] Components that make up the template.. # return [Response] Response object. def update(template_id:, category: nil, components_json: nil) - if category && !WhatsappSdk::Resource::Template::Category.try_deserialize(category) + if category && !WhatsappSdk::Resource::Template::Category.valid?(category) raise InvalidCategoryError.new(category: category) end diff --git a/lib/whatsapp_sdk/error.rb b/lib/whatsapp_sdk/error.rb index 4312576..0df3522 100644 --- a/lib/whatsapp_sdk/error.rb +++ b/lib/whatsapp_sdk/error.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true module WhatsappSdk diff --git a/lib/whatsapp_sdk/resource/address_type.rb b/lib/whatsapp_sdk/resource/address_type.rb index 9ce1bc8..4189010 100644 --- a/lib/whatsapp_sdk/resource/address_type.rb +++ b/lib/whatsapp_sdk/resource/address_type.rb @@ -2,11 +2,9 @@ module WhatsappSdk module Resource - class AddressType < T::Enum - enums do - Home = new("Home") - Work = new("Work") - end + module AddressType + HOME = "Home" + WORK = "Work" end end end diff --git a/lib/whatsapp_sdk/resource/button_parameter.rb b/lib/whatsapp_sdk/resource/button_parameter.rb index f33cfd4..0200942 100644 --- a/lib/whatsapp_sdk/resource/button_parameter.rb +++ b/lib/whatsapp_sdk/resource/button_parameter.rb @@ -3,17 +3,14 @@ module WhatsappSdk module Resource class ButtonParameter - # Returns the button parameter type. # # @returns type [String] Valid options are payload and text. attr_accessor :type - class Type < T::Enum - enums do - Text = new("text") - Payload = new("payload") - end + module Type + TEXT = "text" + PAYLOAD = "payload" end # Required for quick_reply buttons. @@ -37,7 +34,7 @@ def initialize(type:, payload: nil, text: nil) def to_json json = { - type: type.serialize + type: type } json[:payload] = payload if payload json[:text] = text if text diff --git a/lib/whatsapp_sdk/resource/component.rb b/lib/whatsapp_sdk/resource/component.rb index bd59d12..d8d7208 100644 --- a/lib/whatsapp_sdk/resource/component.rb +++ b/lib/whatsapp_sdk/resource/component.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true module WhatsappSdk @@ -14,19 +13,15 @@ def initialize(field, message) end end - class Type < T::Enum - enums do - Header = new("header") - Body = new("body") - Button = new("button") - end + module Type + HEADER = "header" + BODY = "body" + BUTTON = "button" end - class Subtype < T::Enum - enums do - QuickReply = new("quick_reply") - Url = new("url") - end + module Subtype + QUICK_REPLY = "quick_reply" + URL = "url" end # Returns the Component type. @@ -63,16 +58,16 @@ def initialize(type:, parameters: [], sub_type: nil, index: nil) @parameters = parameters @type = type @sub_type = sub_type - @index = index.nil? && type == Type::Button ? 0 : index + @index = index.nil? && type == Type::BUTTON ? 0 : index validate_fields end def to_json json = { - type: type.serialize, + type: type, parameters: parameters.map(&:to_json) } - json[:sub_type] = sub_type&.serialize if sub_type + json[:sub_type] = sub_type if sub_type json[:index] = index if index json end @@ -80,7 +75,7 @@ def to_json private def validate_fields - return if type == Type::Button + return if type == Type::BUTTON raise InvalidField.new(:sub_type, 'sub_type is not required when type is not button') if sub_type diff --git a/lib/whatsapp_sdk/resource/email.rb b/lib/whatsapp_sdk/resource/email.rb index 144513f..d8a71c7 100644 --- a/lib/whatsapp_sdk/resource/email.rb +++ b/lib/whatsapp_sdk/resource/email.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true module WhatsappSdk diff --git a/lib/whatsapp_sdk/resource/interactive.rb b/lib/whatsapp_sdk/resource/interactive.rb index 26769eb..0b384fa 100644 --- a/lib/whatsapp_sdk/resource/interactive.rb +++ b/lib/whatsapp_sdk/resource/interactive.rb @@ -3,13 +3,11 @@ module WhatsappSdk module Resource class Interactive - class Type < T::Enum - enums do - ListMessage = new("list") - ReplyButton = new("button") - SingleProductMessage = new("product") - MultiProductMessage = new("product_list") - end + module Type + LIST_MESSAGE = "list" + REPLY_BUTTON = "button" + SINGLE_PRODUCT_MESSAGE = "product" + MULTI_PRODUCT_MESSAGE = "product_list" end # Returns the Interactive type of message you want to send. @@ -47,7 +45,7 @@ def initialize(type:, body:, action:, header: nil, footer: nil) end def to_json - json = { type: type.serialize } + json = { type: type } json[:header] = header.to_json if header json[:body] = body.to_json json[:footer] = footer.to_json if footer diff --git a/lib/whatsapp_sdk/resource/interactive_action.rb b/lib/whatsapp_sdk/resource/interactive_action.rb index 6bd21ef..0395b4e 100644 --- a/lib/whatsapp_sdk/resource/interactive_action.rb +++ b/lib/whatsapp_sdk/resource/interactive_action.rb @@ -3,10 +3,14 @@ module WhatsappSdk module Resource class InteractiveAction - class Type < T::Enum - enums do - ListMessage = new("list_message") - ReplyButton = new("reply_button") + module Type + LIST_MESSAGE = "list_message" + REPLY_BUTTON = "reply_button" + + TYPES = [LIST_MESSAGE, REPLY_BUTTON].freeze + + def valid?(type) + TYPES.include?(type) end end @@ -56,7 +60,7 @@ def initialize(type:, buttons: [], button: "", sections: []) def to_json json = {} - case type.serialize + case type when "list_message" json = { button: button, sections: sections.map(&:to_json) } when "reply_button" @@ -73,10 +77,10 @@ def validate private def validate_fields - case type.serialize - when "list_message" + case type + when Type::LIST_MESSAGE validate_list_message - when "reply_button" + when Type::REPLY_BUTTON validate_reply_button end end diff --git a/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb b/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb index 61ab753..607bc7c 100644 --- a/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb +++ b/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb @@ -3,10 +3,8 @@ module WhatsappSdk module Resource class InteractiveActionReplyButton - class Type < T::Enum - enums do - Reply = new("reply") - end + module Type + REPLY = "reply" end # Returns the ActionButton type of message you want to send. @@ -29,15 +27,15 @@ class Type < T::Enum ACTION_BUTTON_ID_MAXIMUM = 256 def initialize(title:, id:) - @type = Type::Reply + @type = Type::REPLY @title = title @id = id validate end def to_json - json = { type: type.serialize } - json[type.serialize.to_sym] = { + json = { type: type } + json[type.to_sym] = { id: id, title: title } diff --git a/lib/whatsapp_sdk/resource/interactive_action_section.rb b/lib/whatsapp_sdk/resource/interactive_action_section.rb index da7fde1..df44a03 100644 --- a/lib/whatsapp_sdk/resource/interactive_action_section.rb +++ b/lib/whatsapp_sdk/resource/interactive_action_section.rb @@ -10,7 +10,7 @@ class InteractiveActionSection # Returns the ActionSection rows you want to send. # - # @returns id [T::Array[InteractiveActionSectionRow]]. There must be at least one rows object. + # @returns an array of InteractiveActionSectionRow. There must be at least one rows object. attr_accessor :rows def add_row(row) diff --git a/lib/whatsapp_sdk/resource/interactive_header.rb b/lib/whatsapp_sdk/resource/interactive_header.rb index 3a7e805..1e82e8b 100644 --- a/lib/whatsapp_sdk/resource/interactive_header.rb +++ b/lib/whatsapp_sdk/resource/interactive_header.rb @@ -8,13 +8,11 @@ class InteractiveHeader # @returns type [String] Valid options are text, image, document, video. attr_accessor :type - class Type < T::Enum - enums do - Text = new("text") - Image = new("image") - Document = new("document") - Video = new("video") - end + module Type + TEXT = "text" + IMAGE = "image" + DOCUMENT = "document" + VIDEO = "video" end # Returns Text string if the interactive header type is text. @@ -40,7 +38,7 @@ class Type < T::Enum attr_accessor :video def initialize(type:, text: nil, image: nil, document: nil, video: nil) - @type = deserialize_type(type) + @type = type @text = text @image = image @document = document @@ -49,49 +47,43 @@ def initialize(type:, text: nil, image: nil, document: nil, video: nil) end def to_json - json = { type: type.serialize } - json[type.serialize.to_sym] = case type.serialize - when "text" - text - when "image" - image.to_json - when "document" - document.to_json - when "video" - video.to_json - else - raise "Invalid type: #{type}" - end + json = { type: type } + json[type.to_sym] = case type + when "text" + text + when "image" + image.to_json + when "document" + document.to_json + when "video" + video.to_json + else + raise "Invalid type: #{type}" + end json end private - def deserialize_type(type) - return type if type.is_a?(Type) - - Type.deserialize(type) - end - def validate validate_attributes end def validate_attributes [ - [Type::Text, text], - [Type::Image, image], - [Type::Document, document], - [Type::Video, video] + [Type::TEXT, text], + [Type::IMAGE, image], + [Type::DOCUMENT, document], + [Type::VIDEO, video] ].each do |type_b, value| next unless type == type_b next unless value.nil? raise Resource::Errors::MissingValue.new( - type.serialize, - "#{type.serialize} is required when the type is #{type_b}" + type, + "#{type} is required when the type is #{type_b}" ) end end diff --git a/lib/whatsapp_sdk/resource/media.rb b/lib/whatsapp_sdk/resource/media.rb index 8da22ef..df95128 100644 --- a/lib/whatsapp_sdk/resource/media.rb +++ b/lib/whatsapp_sdk/resource/media.rb @@ -4,9 +4,7 @@ module WhatsappSdk module Resource class Media class InvalidMedia < StandardError - attr_reader :field - - attr_reader :message + attr_reader :field, :message def initialize(field, message) @field = field @@ -20,14 +18,12 @@ def initialize(field, message) # @returns id [String]. attr_accessor :id - class Type < T::Enum - enums do - Audio = new('audio') - Document = new('document') - Image = new('image') - Video = new('video') - Sticker = new('sticker') - end + module Type + AUDIO = 'audio' + DOCUMENT = 'document' + IMAGE = 'image' + VIDEO = 'video' + STICKER = 'sticker' end # @returns type [String]. Valid options ar audio, document, image, video and sticker. @@ -50,7 +46,7 @@ class Type < T::Enum attr_accessor :filename def initialize(type:, id: nil, link: nil, caption: nil, filename: nil) - @type = deserialize_type(type) + @type = type @id = id @link = link @caption = caption @@ -69,12 +65,6 @@ def to_json private - def deserialize_type(type) - return type if type.is_a?(Type) - - Type.deserialize(type) - end - def validate_media raise InvalidMedia.new(:filename, "filename can only be used with document") if filename && !supports_filename? @@ -86,11 +76,11 @@ def validate_media end def supports_filename? - type == Type::Document + type == Type::DOCUMENT end def supports_caption? - type == Type::Document || type == Type::Image + type == Type::DOCUMENT || type == Type::IMAGE end end end diff --git a/lib/whatsapp_sdk/resource/parameter_object.rb b/lib/whatsapp_sdk/resource/parameter_object.rb index 186f652..af0dfee 100644 --- a/lib/whatsapp_sdk/resource/parameter_object.rb +++ b/lib/whatsapp_sdk/resource/parameter_object.rb @@ -18,15 +18,27 @@ def initialize(type) # @returns type [String] Valid options are text, currency, date_time, image, document, video. attr_accessor :type - class Type < T::Enum - enums do - Text = new("text") - Currency = new("currency") - DateTime = new("date_time") - Image = new("image") - Document = new("document") - Video = new("video") - Location = new("location") + module Type + TEXT = "text" + CURRENCY = "currency" + DATE_TIME = "date_time" + IMAGE = "image" + DOCUMENT = "document" + VIDEO = "video" + LOCATION = "location" + + TYPES = [ + TEXT, + CURRENCY, + DATE_TIME, + IMAGE, + DOCUMENT, + VIDEO, + LOCATION + ].freeze + + def self.valid?(type) + TYPES.include?(type) end end @@ -77,7 +89,7 @@ def initialize( video: nil, location: nil ) - @type = deserialize_type(type) + @type = type @text = text @currency = currency @date_time = date_time @@ -89,37 +101,31 @@ def initialize( end def to_json - json = { type: type.serialize } - json[type.serialize.to_sym] = case type.serialize - when "text" - text - when "currency" - currency.to_json - when "date_time" - date_time.to_json - when "image" - image.to_json - when "document" - document.to_json - when "video" - video.to_json - when "location" - location.to_json - else - raise "Invalid type: #{type}" - end + json = { type: type } + json[type.to_sym] = case type + when "text" + text + when "currency" + currency.to_json + when "date_time" + date_time.to_json + when "image" + image.to_json + when "document" + document.to_json + when "video" + video.to_json + when "location" + location.to_json + else + raise "Invalid type: #{type}" + end json end private - def deserialize_type(type) - return type if type.is_a?(Type) - - Type.deserialize(type) - end - def validate validate_attributes validate_type @@ -133,20 +139,21 @@ def validate_type def validate_attributes [ - [Type::Text, text], - [Type::Currency, currency], - [Type::DateTime, date_time], - [Type::Image, image], - [Type::Document, document], - [Type::Video, video], - [Type::Location, location] + [Type::TEXT, text], + [Type::CURRENCY, currency], + [Type::DATE_TIME, date_time], + [Type::IMAGE, image], + [Type::DOCUMENT, document], + [Type::VIDEO, video], + [Type::LOCATION, location] ].each do |type_b, value| next unless type == type_b + next unless value.nil? - if value.nil? - raise Errors::MissingValue.new(type.serialize, - "#{type_b} is required when the type is #{type_b}") - end + raise Errors::MissingValue.new( + type, + "#{type_b} is required when the type is #{type_b}" + ) end end end diff --git a/lib/whatsapp_sdk/resource/template.rb b/lib/whatsapp_sdk/resource/template.rb index 32fc1bd..fbc22ba 100644 --- a/lib/whatsapp_sdk/resource/template.rb +++ b/lib/whatsapp_sdk/resource/template.rb @@ -3,24 +3,40 @@ module WhatsappSdk module Resource class Template - class Status < T::Enum - enums do - PENDING_DELETION = new("PENDING_DELETION") - APPROVED = new("APPROVED") - PENDING = new("PENDING") - REJECTED = new("REJECTED") + module Status + PENDING_DELETION = "PENDING_DELETION" + APPROVED = "APPROVED" + PENDING = "PENDING" + REJECTED = "REJECTED" + + STATUSES = [PENDING_DELETION, APPROVED, PENDING, REJECTED].freeze + + def valid?(status) + STATUSES.include?(status) + end + + def serialize(status) + STATUSES.include?(status) ? status : nil end end - class Category < T::Enum - enums do - AUTHENTICATION = new("AUTHENTICATION") - MARKETING = new("MARKETING") - UTILITY = new("UTILITY") + module Category + AUTHENTICATION = "AUTHENTICATION" + MARKETING = "MARKETING" + UTILITY = "UTILITY" + + CATEGORIES = [AUTHENTICATION, MARKETING, UTILITY].freeze + + def self.valid?(category) + CATEGORIES.include?(category) + end + + def self.serialize(category) + CATEGORIES.include?(category) ? category : nil end end - attr_accessor :id,:status, :category, :language, :name, :components_json + attr_accessor :id, :status, :category, :language, :name, :components_json def initialize(id:, status:, category:, language: nil, name: nil, components_json: nil) @id = id diff --git a/lib/whatsapp_sdk/version.rb b/lib/whatsapp_sdk/version.rb index 850687c..2b2309e 100644 --- a/lib/whatsapp_sdk/version.rb +++ b/lib/whatsapp_sdk/version.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true module WhatsappSdk diff --git a/test/whatsapp/api/messages_test.rb b/test/whatsapp/api/messages_test.rb index bfd31c4..c0bd542 100644 --- a/test/whatsapp/api/messages_test.rb +++ b/test/whatsapp/api/messages_test.rb @@ -444,7 +444,7 @@ def test_send_sticker_message_with_a_link messaging_product: "whatsapp", to: 56_789, recipient_type: "individual", - type: Resource::Media::Type::Sticker, + type: Resource::Media::Type::STICKER, sticker: { link: sticker_link } }, headers: { "Content-Type" => "application/json" } @@ -466,7 +466,7 @@ def test_send_sticker_message_with_an_sticker_id messaging_product: "whatsapp", to: 56_789, recipient_type: "individual", - type: Resource::Media::Type::Sticker, + type: Resource::Media::Type::STICKER, sticker: { id: sticker_id } }, headers: { "Content-Type" => "application/json" } @@ -578,59 +578,63 @@ def test_send_template_with_success_response_by_passing_components_json def test_send_template_with_success_response_by_passing_components currency = Resource::Currency.new(code: "USD", amount: 1000, fallback_value: "1000") date_time = Resource::DateTime.new(fallback_value: "2020-01-01T00:00:00Z") - image = Resource::Media.new(type: Resource::Media::Type::Image, link: "http(s)://URL") + image = Resource::Media.new(type: Resource::Media::Type::IMAGE, link: "http(s)://URL") location = Resource::Location.new(latitude: 25.779510, longitude: -80.338631, name: "miami store", address: "820 nw 87th ave, miami, fl") parameter_image = Resource::ParameterObject.new( - type: Resource::ParameterObject::Type::Image, image: image + type: Resource::ParameterObject::Type::IMAGE, image: image ) parameter_text = Resource::ParameterObject.new( - type: Resource::ParameterObject::Type::Text, text: "TEXT_STRING" + type: Resource::ParameterObject::Type::TEXT, text: "TEXT_STRING" ) parameter_currency = Resource::ParameterObject.new( - type: Resource::ParameterObject::Type::Currency, currency: currency + type: Resource::ParameterObject::Type::CURRENCY, currency: currency ) parameter_date_time = Resource::ParameterObject.new( - type: Resource::ParameterObject::Type::DateTime, date_time: date_time + type: Resource::ParameterObject::Type::DATE_TIME, date_time: date_time ) parameter_location = Resource::ParameterObject.new( - type: Resource::ParameterObject::Type::Location, + type: Resource::ParameterObject::Type::LOCATION, location: location ) header_component = Resource::Component.new( - type: Resource::Component::Type::Header, + type: Resource::Component::Type::HEADER, parameters: [parameter_image] ) body_component = Resource::Component.new( - type: Resource::Component::Type::Body, + type: Resource::Component::Type::BODY, parameters: [parameter_text, parameter_currency, parameter_date_time] ) button_component1 = Resource::Component.new( - type: Resource::Component::Type::Button, + type: Resource::Component::Type::BUTTON, index: 0, - sub_type: Resource::Component::Subtype::QuickReply, + sub_type: Resource::Component::Subtype::QUICK_REPLY, parameters: [ - Resource::ButtonParameter.new(type: Resource::ButtonParameter::Type::Payload, - payload: "PAYLOAD") + Resource::ButtonParameter.new( + type: Resource::ButtonParameter::Type::PAYLOAD, + payload: "PAYLOAD" + ) ] ) button_component2 = Resource::Component.new( - type: Resource::Component::Type::Button, + type: Resource::Component::Type::BUTTON, index: 1, - sub_type: Resource::Component::Subtype::QuickReply, + sub_type: Resource::Component::Subtype::QUICK_REPLY, parameters: [ - Resource::ButtonParameter.new(type: Resource::ButtonParameter::Type::Payload, - payload: "PAYLOAD") + Resource::ButtonParameter.new( + type: Resource::ButtonParameter::Type::PAYLOAD, + payload: "PAYLOAD" + ) ] ) location_component = Resource::Component.new( - type: Resource::Component::Type::Header, + type: Resource::Component::Type::HEADER, parameters: [parameter_location] ) @@ -804,7 +808,7 @@ def test_send_interactive_reply_buttons_with_success_response_by_passing_interac def test_send_interactive_reply_buttons_with_success_response_by_passing_interactive interactive_header = Resource::InteractiveHeader.new( - type: Resource::InteractiveHeader::Type::Text, + type: Resource::InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -817,7 +821,7 @@ def test_send_interactive_reply_buttons_with_success_response_by_passing_interac ) interactive_action = Resource::InteractiveAction.new( - type: Resource::InteractiveAction::Type::ReplyButton + type: Resource::InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = Resource::InteractiveActionReplyButton.new( @@ -833,7 +837,7 @@ def test_send_interactive_reply_buttons_with_success_response_by_passing_interac interactive_action.add_reply_button(interactive_reply_button_2) interactive_reply_buttons = Resource::Interactive.new( - type: Resource::Interactive::Type::ReplyButton, + type: Resource::Interactive::Type::REPLY_BUTTON, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -933,7 +937,7 @@ def test_send_interactive_list_messages_with_success_response_by_passing_interac def test_send_interactive_list_messages_with_success_response_by_passing_interactive interactive_header = Resource::InteractiveHeader.new( - type: Resource::InteractiveHeader::Type::Text, + type: Resource::InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -946,7 +950,7 @@ def test_send_interactive_list_messages_with_success_response_by_passing_interac ) interactive_action = Resource::InteractiveAction.new( - type: Resource::InteractiveAction::Type::ListMessage + type: Resource::InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -963,7 +967,7 @@ def test_send_interactive_list_messages_with_success_response_by_passing_interac interactive_action.add_section(interactive_section_1) interactive_list_messages = Resource::Interactive.new( - type: Resource::Interactive::Type::ListMessage, + type: Resource::Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, diff --git a/test/whatsapp/api/templates_test.rb b/test/whatsapp/api/templates_test.rb index ec1827c..217816b 100644 --- a/test/whatsapp/api/templates_test.rb +++ b/test/whatsapp/api/templates_test.rb @@ -280,8 +280,8 @@ def assert_templates_mock_response(expected_template_response, template_response [ [Responses::TemplateDataResponse, template_response.class], [expected_template_response["id"], template_response.template.id], - [expected_template_response["status"], template_response.template.status.serialize], - [expected_template_response["category"], template_response.template.category.serialize], + [expected_template_response["status"], template_response.template.status], + [expected_template_response["category"], template_response.template.category], [expected_template_response["language"], template_response.template.language], [expected_template_response["name"], template_response.template.name], [expected_template_response["components"], template_response.template.components_json] diff --git a/test/whatsapp/contact_helper.rb b/test/whatsapp/contact_helper.rb index 025f820..73c15ee 100644 --- a/test/whatsapp/contact_helper.rb +++ b/test/whatsapp/contact_helper.rb @@ -10,7 +10,7 @@ def create_addresses zip: "ZIP", country: "COUNTRY", country_code: "COUNTRY_CODE", - type: Resource::AddressType::Work + type: Resource::AddressType::WORK ) address2 = Resource::Address.new( @@ -20,15 +20,15 @@ def create_addresses zip: "ZIP", country: "COUNTRY", country_code: "COUNTRY_CODE", - type: Resource::AddressType::Work + type: Resource::AddressType::WORK ) [address1, address2] end def create_emails - email1 = Resource::Email.new(email: "ignacio@gmail.com", type: Resource::AddressType::Work) - email2 = Resource::Email.new(email: "ignacio2@gmail.com", type: Resource::AddressType::Home) + email1 = Resource::Email.new(email: "ignacio@gmail.com", type: Resource::AddressType::WORK) + email2 = Resource::Email.new(email: "ignacio2@gmail.com", type: Resource::AddressType::HOME) [email1, email2] end @@ -49,15 +49,15 @@ def create_org end def create_phone_numbers - phone1 = Resource::PhoneNumber.new(phone: "1234567", type: Resource::AddressType::Home, wa_id: "1234") - phone2 = Resource::PhoneNumber.new(phone: "9876543", type: Resource::AddressType::Work, wa_id: "1234") + phone1 = Resource::PhoneNumber.new(phone: "1234567", type: Resource::AddressType::HOME, wa_id: "1234") + phone2 = Resource::PhoneNumber.new(phone: "9876543", type: Resource::AddressType::WORK, wa_id: "1234") [phone1, phone2] end def create_urls - url1 = Resource::Url.new(url: "1234567", type: Resource::AddressType::Home) - url2 = Resource::Url.new(url: "1234567", type: Resource::AddressType::Work) + url1 = Resource::Url.new(url: "1234567", type: Resource::AddressType::HOME) + url2 = Resource::Url.new(url: "1234567", type: Resource::AddressType::WORK) [url1, url2] end diff --git a/test/whatsapp/resource/button_parameter_test.rb b/test/whatsapp/resource/button_parameter_test.rb index f2d4e39..dd9dfc9 100644 --- a/test/whatsapp/resource/button_parameter_test.rb +++ b/test/whatsapp/resource/button_parameter_test.rb @@ -9,16 +9,16 @@ module Resource module Resource class ButtonParameterTest < Minitest::Test def test_creates_a_valid_parameter_object_with_a_valid_type - ButtonParameter.new(type: ButtonParameter::Type::Payload, payload: "payload") - ButtonParameter.new(type: ButtonParameter::Type::Text, text: "text") + ButtonParameter.new(type: ButtonParameter::Type::PAYLOAD, payload: "payload") + ButtonParameter.new(type: ButtonParameter::Type::TEXT, text: "text") end def test_to_json - button_parameter_payload = ButtonParameter.new(type: ButtonParameter::Type::Payload, payload: "payload") + button_parameter_payload = ButtonParameter.new(type: ButtonParameter::Type::PAYLOAD, payload: "payload") assert_equal({ type: "payload", payload: "payload" }, button_parameter_payload.to_json) button_parameter_test = ButtonParameter.new( - type: ButtonParameter::Type::Text, text: "text" + type: ButtonParameter::Type::TEXT, text: "text" ) assert_equal({ type: "text", text: "text" }, button_parameter_test.to_json) end diff --git a/test/whatsapp/resource/component_test.rb b/test/whatsapp/resource/component_test.rb index 5429cc0..789a9eb 100644 --- a/test/whatsapp/resource/component_test.rb +++ b/test/whatsapp/resource/component_test.rb @@ -13,41 +13,41 @@ module Resource module Resource class ComponentTest < Minitest::Test def test_button_index_is_set_to_0_by_default - button_component = Component.new(type: Component::Type::Button, sub_type: Component::Subtype::QuickReply) + button_component = Component.new(type: Component::Type::BUTTON, sub_type: Component::Subtype::QUICK_REPLY) assert_equal(0, button_component.index) end def test_validation error = assert_raises(Component::InvalidField) do - Component.new(type: Component::Type::Header, sub_type: Component::Subtype::QuickReply) + Component.new(type: Component::Type::HEADER, sub_type: Component::Subtype::QUICK_REPLY) end assert_equal("sub_type is not required when type is not button", error.message) assert_equal(:sub_type, error.field) error = assert_raises(Component::InvalidField) do - Component.new(type: Component::Type::Header, index: 0) + Component.new(type: Component::Type::HEADER, index: 0) end assert_equal("index is not required when type is not button", error.message) assert_equal(:index, error.field) end def test_add_parameters - image = Media.new(type: Media::Type::Image, + image = Media.new(type: Media::Type::IMAGE, link: "http(s)://URL", caption: "caption") - document = Media.new(type: Media::Type::Document, + document = Media.new(type: Media::Type::DOCUMENT, link: "http(s)://URL", filename: "txt.rb") - video = Media.new(type: Media::Type::Video, id: "123") + video = Media.new(type: Media::Type::VIDEO, id: "123") currency = Currency.new(code: "USD", amount: 1000, fallback_value: "1000") date_time = DateTime.new(fallback_value: "2020-01-01T00:00:00Z") - parameter_text = ParameterObject.new(type: ParameterObject::Type::Text, text: "I am a text") - parameter_currency = ParameterObject.new(type: ParameterObject::Type::Currency, currency: currency) - parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DateTime, date_time: date_time) - parameter_image = ParameterObject.new(type: ParameterObject::Type::Image, image: image) - parameter_document = ParameterObject.new(type: ParameterObject::Type::Document, document: document) - parameter_video = ParameterObject.new(type: ParameterObject::Type::Video, video: video) + parameter_text = ParameterObject.new(type: ParameterObject::Type::TEXT, text: "I am a text") + parameter_currency = ParameterObject.new(type: ParameterObject::Type::CURRENCY, currency: currency) + parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DATE_TIME, date_time: date_time) + parameter_image = ParameterObject.new(type: ParameterObject::Type::IMAGE, image: image) + parameter_document = ParameterObject.new(type: ParameterObject::Type::DOCUMENT, document: document) + parameter_video = ParameterObject.new(type: ParameterObject::Type::VIDEO, video: video) - header_component = Component.new(type: Component::Type::Header) + header_component = Component.new(type: Component::Type::HEADER) header_component.add_parameter(parameter_text) header_component.add_parameter(parameter_currency) @@ -67,11 +67,11 @@ def test_add_parameters end def test_to_json_header_component - image = Media.new(type: Media::Type::Image, link: "http(s)://URL", caption: "caption") - parameter_image = ParameterObject.new(type: ParameterObject::Type::Image, image: image) + image = Media.new(type: Media::Type::IMAGE, link: "http(s)://URL", caption: "caption") + parameter_image = ParameterObject.new(type: ParameterObject::Type::IMAGE, image: image) header_component = Component.new( - type: Component::Type::Header, + type: Component::Type::HEADER, parameters: [parameter_image] ) @@ -93,16 +93,16 @@ def test_to_json_header_component end def test_to_json_body_component - parameter_text = ParameterObject.new(type: ParameterObject::Type::Text, text: "I am a text") + parameter_text = ParameterObject.new(type: ParameterObject::Type::TEXT, text: "I am a text") currency = Currency.new(code: "USD", amount: 1000, fallback_value: "1000") - parameter_currency = ParameterObject.new(type: ParameterObject::Type::Currency, currency: currency) + parameter_currency = ParameterObject.new(type: ParameterObject::Type::CURRENCY, currency: currency) date_time = DateTime.new(fallback_value: "2020-01-01T00:00:00Z") - parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DateTime, date_time: date_time) + parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DATE_TIME, date_time: date_time) body_component = Component.new( - type: Component::Type::Body, + type: Component::Type::BODY, parameters: [parameter_text, parameter_currency, parameter_date_time] ) @@ -136,12 +136,12 @@ def test_to_json_body_component def test_to_json_button_component button_component = Component.new( - type: Component::Type::Button, + type: Component::Type::BUTTON, index: 0, - sub_type: Component::Subtype::QuickReply, + sub_type: Component::Subtype::QUICK_REPLY, parameters: [ - ButtonParameter.new(type: ButtonParameter::Type::Payload, payload: "payload"), - ButtonParameter.new(type: ButtonParameter::Type::Text, text: "text") + ButtonParameter.new(type: ButtonParameter::Type::PAYLOAD, payload: "payload"), + ButtonParameter.new(type: ButtonParameter::Type::TEXT, text: "text") ] ) diff --git a/test/whatsapp/resource/interactive_action_test.rb b/test/whatsapp/resource/interactive_action_test.rb index fa485d3..c511f57 100644 --- a/test/whatsapp/resource/interactive_action_test.rb +++ b/test/whatsapp/resource/interactive_action_test.rb @@ -8,7 +8,7 @@ module Resource class InteractionActionTest < Minitest::Test def test_validation error = assert_raises(Errors::InvalidInteractiveActionButton) do - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ListMessage) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::LIST_MESSAGE) interactive_action.validate end assert_equal( @@ -17,7 +17,7 @@ def test_validation ) error = assert_raises(Errors::InvalidInteractiveActionButton) do - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ListMessage) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::LIST_MESSAGE) interactive_action.button = "I am the longer CTA button" interactive_action.validate end @@ -27,7 +27,7 @@ def test_validation ) error = assert_raises(Errors::InvalidInteractiveActionSection) do - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ListMessage) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::LIST_MESSAGE) interactive_action.button = "I am the CTA button" interactive_action.validate end @@ -37,7 +37,7 @@ def test_validation ) error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ReplyButton) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::REPLY_BUTTON) interactive_action.validate end @@ -47,7 +47,7 @@ def test_validation ) error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ReplyButton) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::REPLY_BUTTON) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", id: "button_1" @@ -69,7 +69,7 @@ def test_validation end def test_to_json_list_message - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ListMessage) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::LIST_MESSAGE) interactive_action.button = "I am the CTA button" interactive_section = InteractiveActionSection.new(title: "I am the section title") @@ -97,7 +97,7 @@ def test_to_json_list_message end def test_to_json_reply_button - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ReplyButton) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::REPLY_BUTTON) interactive_reply_button = InteractiveActionReplyButton.new( title: "I am the button", id: "button" diff --git a/test/whatsapp/resource/interactive_test.rb b/test/whatsapp/resource/interactive_test.rb index 9d63bf5..41b29d9 100644 --- a/test/whatsapp/resource/interactive_test.rb +++ b/test/whatsapp/resource/interactive_test.rb @@ -17,7 +17,7 @@ class InteractiveTest < Minitest::Test def test_validation_reply_buttons error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do interactive_body = InteractiveBody.new(text: "This is the body!") - interactive_action = InteractiveAction.new(type: InteractiveAction::Type::ReplyButton) + interactive_action = InteractiveAction.new(type: InteractiveAction::Type::REPLY_BUTTON) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", id: "button_1" @@ -40,7 +40,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_4) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, action: interactive_action ) @@ -50,7 +50,7 @@ def test_validation_reply_buttons error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do interactive_body = InteractiveBody.new(text: "This is the body!") interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", @@ -64,7 +64,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_2) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, action: interactive_action ) @@ -75,7 +75,7 @@ def test_validation_reply_buttons error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do interactive_body = InteractiveBody.new(text: "This is the body!") interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the longer button 1", @@ -84,7 +84,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_1) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, action: interactive_action ) @@ -94,7 +94,7 @@ def test_validation_reply_buttons error = assert_raises(Errors::InvalidInteractiveActionReplyButton) do interactive_body = InteractiveBody.new(text: "This is the body!") interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", @@ -103,7 +103,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_1) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, action: interactive_action ) @@ -114,7 +114,7 @@ def test_validation_reply_buttons interactive_body = InteractiveBody.new(text: "This is the body!") interactive_footer = InteractiveFooter.new(text: "Footer " * 10) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", @@ -133,7 +133,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_3) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, footer: interactive_footer, action: interactive_action @@ -144,7 +144,7 @@ def test_validation_reply_buttons error = assert_raises(Errors::InvalidInteractiveBody) do interactive_body = InteractiveBody.new(text: "Body " * 250) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( title: "I am the button 1", @@ -163,7 +163,7 @@ def test_validation_reply_buttons interactive_action.add_reply_button(interactive_reply_button_3) Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, body: interactive_body, action: interactive_action ) @@ -174,7 +174,7 @@ def test_validation_reply_buttons def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionButton) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -187,7 +187,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_section_1 = InteractiveActionSection.new( @@ -202,7 +202,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -213,7 +213,7 @@ def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionSection) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -226,7 +226,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -243,7 +243,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -254,7 +254,7 @@ def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionSection) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -267,7 +267,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -286,7 +286,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -297,7 +297,7 @@ def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionSectionRow) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -310,7 +310,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -327,7 +327,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -338,7 +338,7 @@ def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionSectionRow) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -351,7 +351,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -368,7 +368,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -379,7 +379,7 @@ def test_validation_list_messages error = assert_raises(Errors::InvalidInteractiveActionSectionRow) do interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -392,7 +392,7 @@ def test_validation_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -409,7 +409,7 @@ def test_validation_list_messages interactive_action.add_section(interactive_section_1) Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -421,7 +421,7 @@ def test_validation_list_messages def test_to_json_reply_buttons interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -434,7 +434,7 @@ def test_to_json_reply_buttons ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ReplyButton + type: InteractiveAction::Type::REPLY_BUTTON ) interactive_reply_button_1 = InteractiveActionReplyButton.new( @@ -450,7 +450,7 @@ def test_to_json_reply_buttons interactive_action.add_reply_button(interactive_reply_button_2) interactive_reply_buttons = Interactive.new( - type: Interactive::Type::ReplyButton, + type: Interactive::Type::REPLY_BUTTON, header: interactive_header, body: interactive_body, footer: interactive_footer, @@ -495,7 +495,7 @@ def test_to_json_reply_buttons def test_to_json_list_messages interactive_header = InteractiveHeader.new( - type: InteractiveHeader::Type::Text, + type: InteractiveHeader::Type::TEXT, text: "I am the header!" ) @@ -508,7 +508,7 @@ def test_to_json_list_messages ) interactive_action = InteractiveAction.new( - type: InteractiveAction::Type::ListMessage + type: InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -525,7 +525,7 @@ def test_to_json_list_messages interactive_action.add_section(interactive_section_1) interactive_list_messages = Interactive.new( - type: Interactive::Type::ListMessage, + type: Interactive::Type::LIST_MESSAGE, header: interactive_header, body: interactive_body, footer: interactive_footer, diff --git a/test/whatsapp/resource/media_test.rb b/test/whatsapp/resource/media_test.rb index ee6a0bb..b10c92c 100644 --- a/test/whatsapp/resource/media_test.rb +++ b/test/whatsapp/resource/media_test.rb @@ -10,7 +10,7 @@ module Resource class MediaTest < Minitest::Test def test_raise_an_error_when_filename_is_passed_and_type_is_not_document error = assert_raises(Media::InvalidMedia) do - Media.new(type: Media::Type::Sticker, filename: "afs") + Media.new(type: Media::Type::STICKER, filename: "afs") end assert_equal(:filename, error.field) @@ -19,7 +19,7 @@ def test_raise_an_error_when_filename_is_passed_and_type_is_not_document def test_raise_an_error_when_caption_is_passed_and_type_is_not_document_nor_image error = assert_raises(Media::InvalidMedia) do - Media.new(type: Media::Type::Video, caption: "I am a caption") + Media.new(type: Media::Type::VIDEO, caption: "I am a caption") end assert_equal(:caption, error.field) @@ -27,11 +27,11 @@ def test_raise_an_error_when_caption_is_passed_and_type_is_not_document_nor_imag end def test_to_json - image = Media.new(type: Media::Type::Image, link: "http(s)://URL", caption: "caption") - document = Media.new(type: Media::Type::Document, link: "http(s)://URL", filename: "txt.rb") - video = Media.new(type: Media::Type::Video, id: "123") - audio = Media.new(type: Media::Type::Audio, id: "456") - sticker = Media.new(type: Media::Type::Sticker, id: "789") + image = Media.new(type: Media::Type::IMAGE, link: "http(s)://URL", caption: "caption") + document = Media.new(type: Media::Type::DOCUMENT, link: "http(s)://URL", filename: "txt.rb") + video = Media.new(type: Media::Type::VIDEO, id: "123") + audio = Media.new(type: Media::Type::AUDIO, id: "456") + sticker = Media.new(type: Media::Type::STICKER, id: "789") assert_equal({ link: "http(s)://URL", caption: "caption" }, image.to_json) assert_equal({ link: "http(s)://URL", filename: "txt.rb" }, document.to_json) diff --git a/test/whatsapp/resource/parameter_object_test.rb b/test/whatsapp/resource/parameter_object_test.rb index 9a64dbd..ef0c67c 100644 --- a/test/whatsapp/resource/parameter_object_test.rb +++ b/test/whatsapp/resource/parameter_object_test.rb @@ -15,11 +15,11 @@ module Resource module Resource class ParameterObjectTest < Minitest::Test def setup - @image_media = Media.new(type: Media::Type::Image, + @image_media = Media.new(type: Media::Type::IMAGE, link: "http(s)://URL", caption: "caption") - @document_media = Media.new(type: Media::Type::Document, + @document_media = Media.new(type: Media::Type::DOCUMENT, link: "http://URL", filename: "txt.rb") - @video_media = Media.new(type: Media::Type::Video, id: "123") + @video_media = Media.new(type: Media::Type::VIDEO, id: "123") @currency = Currency.new(code: "USD", amount: 1000, fallback_value: "USD") @date_time = DateTime.new(fallback_value: "2020-01-01T00:00:00Z") @location = Location.new(latitude: 25.779510, longitude: -80.338631, name: "Miami Store", @@ -27,14 +27,14 @@ def setup end [ - ParameterObject::Type::Text, ParameterObject::Type::Currency, ParameterObject::Type::DateTime, - ParameterObject::Type::Image, ParameterObject::Type::Document, ParameterObject::Type::Video, - ParameterObject::Type::Location + ParameterObject::Type::TEXT, ParameterObject::Type::CURRENCY, ParameterObject::Type::DATE_TIME, + ParameterObject::Type::IMAGE, ParameterObject::Type::DOCUMENT, ParameterObject::Type::VIDEO, + ParameterObject::Type::LOCATION ].each do |type| define_method( - "test_raise_an_error_when_type_is_#{type.serialize}_but_the_attribute_#{type.serialize}_is_not_passed" + "test_raise_an_error_when_type_is_#{type}_but_the_attribute_#{type}_is_not_passed" ) do - if type == ParameterObject::Type::Image + if type == ParameterObject::Type::IMAGE object = @video_media attr_name = :video else @@ -46,65 +46,65 @@ def setup ParameterObject.new(type: type, attr_name => object) end - assert_equal(type.serialize, error.field) + assert_equal(type, error.field) assert_equal("#{type} is required when the type is #{type}", error.message) end end def test_creates_a_valid_parameter_object_with_for_type - ParameterObject.new(type: ParameterObject::Type::Text, text: "foo") - ParameterObject.new(type: ParameterObject::Type::Currency, currency: @currency) - ParameterObject.new(type: ParameterObject::Type::DateTime, date_time: @date_time) - ParameterObject.new(type: ParameterObject::Type::Image, image: @image_media) - ParameterObject.new(type: ParameterObject::Type::Video, video: @video_media) - ParameterObject.new(type: ParameterObject::Type::Document, document: @document_media) - ParameterObject.new(type: ParameterObject::Type::Location, location: @location) + ParameterObject.new(type: ParameterObject::Type::TEXT, text: "foo") + ParameterObject.new(type: ParameterObject::Type::CURRENCY, currency: @currency) + ParameterObject.new(type: ParameterObject::Type::DATE_TIME, date_time: @date_time) + ParameterObject.new(type: ParameterObject::Type::IMAGE, image: @image_media) + ParameterObject.new(type: ParameterObject::Type::VIDEO, video: @video_media) + ParameterObject.new(type: ParameterObject::Type::DOCUMENT, document: @document_media) + ParameterObject.new(type: ParameterObject::Type::LOCATION, location: @location) end def test_to_json - parameter_image = ParameterObject.new(type: ParameterObject::Type::Image, + parameter_image = ParameterObject.new(type: ParameterObject::Type::IMAGE, image: @image_media) assert_equal( { type: "image", image: { link: "http(s)://URL", caption: "caption" } }, parameter_image.to_json ) - parameter_document = ParameterObject.new(type: ParameterObject::Type::Document, + parameter_document = ParameterObject.new(type: ParameterObject::Type::DOCUMENT, document: @document_media) assert_equal( { type: "document", document: { link: "http://URL", filename: "txt.rb" } }, parameter_document.to_json ) - parameter_video = ParameterObject.new(type: ParameterObject::Type::Video, + parameter_video = ParameterObject.new(type: ParameterObject::Type::VIDEO, video: @video_media) assert_equal( { type: "video", video: { id: "123" } }, parameter_video.to_json ) - parameter_text = ParameterObject.new(type: ParameterObject::Type::Text, + parameter_text = ParameterObject.new(type: ParameterObject::Type::TEXT, text: "I am a text") assert_equal( { type: "text", text: "I am a text" }, parameter_text.to_json ) - parameter_currency = ParameterObject.new(type: ParameterObject::Type::Currency, + parameter_currency = ParameterObject.new(type: ParameterObject::Type::CURRENCY, currency: @currency) assert_equal( { type: "currency", currency: { fallback_value: "USD", code: "USD", amount_1000: 1000 } }, parameter_currency.to_json ) - parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DateTime, + parameter_date_time = ParameterObject.new(type: ParameterObject::Type::DATE_TIME, date_time: @date_time) assert_equal( { type: "date_time", date_time: { fallback_value: @date_time.fallback_value } }, parameter_date_time.to_json ) - parameter_location = ParameterObject.new(type: ParameterObject::Type::Location, location: @location) + parameter_location = ParameterObject.new(type: ParameterObject::Type::LOCATION, location: @location) assert_equal( { From 97eafffa8906ea84b6f1f6cd3e675c59b5498ec0 Mon Sep 17 00:00:00 2001 From: ignacio-chiazzo Date: Sun, 1 Sep 2024 11:41:00 -0300 Subject: [PATCH 5/5] remove sorbet dependency --- .rubocop.yml | 3 --- Gemfile | 4 ---- Gemfile.lock | 19 ------------------- README.md | 4 ++-- lib/whatsapp_sdk.rb | 1 - test/test_helper.rb | 1 - whatsapp_sdk.gemspec | 3 --- 7 files changed, 2 insertions(+), 33 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index e501c89..3ded62e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,6 @@ require: - rubocop-minitest - rubocop-performance - - rubocop-sorbet AllCops: NewCops: enable @@ -53,6 +52,4 @@ Gemspec/RequiredRubyVersion: Minitest/MultipleAssertions: Enabled: false -Style/AccessorGrouping: # disabled so that we can use sorbet signatures for each attr - Enabled: false diff --git a/Gemfile b/Gemfile index 6bc5814..2763cac 100644 --- a/Gemfile +++ b/Gemfile @@ -10,16 +10,12 @@ group(:test) do gem('rubocop', require: false) gem('rubocop-minitest', require: false) gem('rubocop-performance', require: false) - gem('rubocop-sorbet', require: false) gem('webmock') end group(:development) do gem('pry') gem('pry-nav') - gem('sorbet') - gem('spoom') - gem('tapioca', require: false) end gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 0ae1def..fc28a76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,6 @@ PATH whatsapp_sdk (0.12.1) faraday (~> 2) faraday-multipart (~> 1) - sorbet-runtime (~> 0.5) zeitwerk (~> 2) GEM @@ -58,22 +57,8 @@ GEM rubocop-performance (1.14.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-sorbet (0.7.0) - rubocop (>= 0.90.0) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) - sorbet (0.5.10346) - sorbet-static (= 0.5.10346) - sorbet-runtime (0.5.10346) - sorbet-static (0.5.10346-universal-darwin-19) - sorbet-static (0.5.10346-universal-darwin-21) - sorbet-static (0.5.10346-x86_64-linux) - spoom (1.1.12) - sorbet (>= 0.5.9204) - sorbet-runtime (>= 0.5.9204) - thor (>= 0.19.2) - tapioca (0.0.1) - thor (1.2.1) unicode-display_width (2.2.0) webmock (3.18.1) addressable (>= 2.8.0) @@ -97,10 +82,6 @@ DEPENDENCIES rubocop rubocop-minitest rubocop-performance - rubocop-sorbet - sorbet - spoom - tapioca webmock whatsapp_sdk! diff --git a/README.md b/README.md index 708130b..4ebeb9c 100644 --- a/README.md +++ b/README.md @@ -450,7 +450,7 @@ interactive_footer = WhatsappSdk::Resource::InteractiveFooter.new( ) interactive_action = WhatsappSdk::Resource::InteractiveAction.new( - type: WhatsappSdk::Resource::InteractiveAction::Type::ListMessage + type: WhatsappSdk::Resource::InteractiveAction::Type::LIST_MESSAGE ) interactive_action.button = "I am the button CTA" @@ -509,7 +509,7 @@ interactive_footer = WhatsappSdk::Resource::InteractiveFooter.new( ) interactive_action = WhatsappSdk::Resource::InteractiveAction.new( - type: WhatsappSdk::Resource::InteractiveAction::Type::ReplyButton + type: WhatsappSdk::REPLY_BUTTON ) interactive_reply_button_1 = WhatsappSdk::Resource::InteractiveActionReplyButton.new( diff --git a/lib/whatsapp_sdk.rb b/lib/whatsapp_sdk.rb index 47bd34f..d818c65 100644 --- a/lib/whatsapp_sdk.rb +++ b/lib/whatsapp_sdk.rb @@ -4,7 +4,6 @@ require "zeitwerk" require "faraday" require "faraday/multipart" -require "sorbet-runtime" loader = Zeitwerk::Loader.for_gem loader.setup diff --git a/test/test_helper.rb b/test/test_helper.rb index 416dcf1..85c919b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,6 +8,5 @@ require 'mocha/minitest' require "pry" require "pry-nav" -require "sorbet-runtime" require "webmock/minitest" require "errors_helper" diff --git a/whatsapp_sdk.gemspec b/whatsapp_sdk.gemspec index 18d803a..3e9ab11 100644 --- a/whatsapp_sdk.gemspec +++ b/whatsapp_sdk.gemspec @@ -43,9 +43,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency("bundler", "~> 2.3") spec.add_development_dependency("minitest", "~> 5.0") spec.add_development_dependency("rake", "~> 12.3") - spec.add_development_dependency('sorbet', "~>0.5") - - spec.add_runtime_dependency('sorbet-runtime', "~>0.5") spec.add_dependency("faraday", "~> 2") spec.add_dependency("faraday-multipart", "~> 1")