Skip to content

Commit 82601ac

Browse files
authored
Merge pull request firecrawl#3461 from firecrawl/devin/1777532537-fix-ruby-sdk-qa-issues
fix(ruby-sdk): unwrap credit_usage data field and default skipTlsVerification to false
2 parents 2ada97c + b17bd23 commit 82601ac

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

apps/ruby-sdk/lib/firecrawl/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ def get_concurrency
372372
# @return [Models::CreditUsage]
373373
def get_credit_usage
374374
raw = @http.get("/v2/team/credit-usage")
375-
Models::CreditUsage.new(raw)
375+
data = raw["data"] || raw
376+
Models::CreditUsage.new(data)
376377
end
377378

378379
private

apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ScrapeOptions
1515

1616
def initialize(**kwargs)
1717
FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) }
18-
@skip_tls_verification = true if @skip_tls_verification.nil?
18+
@skip_tls_verification = false if @skip_tls_verification.nil?
1919
end
2020

2121
def to_h
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Firecrawl
4-
VERSION = "1.2.0"
4+
VERSION = "1.3.0"
55
end

apps/ruby-sdk/test/firecrawl/client_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def test_get_credit_usage
370370
stub_request(:get, "#{BASE_URL}/v2/team/credit-usage")
371371
.to_return(
372372
status: 200,
373-
body: JSON.generate(remainingCredits: 500, planCredits: 1000),
373+
body: JSON.generate(success: true, data: { remainingCredits: 500, planCredits: 1000 }),
374374
headers: { "Content-Type" => "application/json" }
375375
)
376376

@@ -454,14 +454,14 @@ def test_scrape_options_to_h
454454
assert_equal 1000, h["waitFor"]
455455
assert_equal false, h["mobile"]
456456
assert_equal "stealth", h["proxy"]
457-
assert_equal true, h["skipTlsVerification"] # defaults to true
457+
assert_equal false, h["skipTlsVerification"] # defaults to false
458458
refute h.key?("timeout") # nil values should be omitted
459459
end
460460

461-
def test_scrape_options_skip_tls_defaults_to_true
461+
def test_scrape_options_skip_tls_defaults_to_false
462462
opts = Firecrawl::Models::ScrapeOptions.new
463-
assert_equal true, opts.skip_tls_verification
464-
assert_equal true, opts.to_h["skipTlsVerification"]
463+
assert_equal false, opts.skip_tls_verification
464+
assert_equal false, opts.to_h["skipTlsVerification"]
465465
end
466466

467467
def test_scrape_options_skip_tls_can_be_overridden_to_false
@@ -530,7 +530,7 @@ def test_batch_scrape_options_to_h
530530
zero_data_retention: true
531531
)
532532
h = opts.to_h
533-
assert_equal({ "formats" => ["markdown"], "skipTlsVerification" => true }, h["options"])
533+
assert_equal({ "formats" => ["markdown"], "skipTlsVerification" => false }, h["options"])
534534
assert_equal 5, h["maxConcurrency"]
535535
assert_equal true, h["zeroDataRetention"]
536536
end

0 commit comments

Comments
 (0)