Class: CloudscrapeClient::Validate

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudscrape_client/validate.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response:) ⇒ Validate

Returns a new instance of Validate.



5
6
7
# File 'lib/cloudscrape_client/validate.rb', line 5

def initialize(response:)
  @response = response
end

Class Method Details

.to_procObject



9
10
11
# File 'lib/cloudscrape_client/validate.rb', line 9

def self.to_proc
  ->(response) { with(response) }
end

.with(response) ⇒ Object



13
14
15
# File 'lib/cloudscrape_client/validate.rb', line 13

def self.with(response)
  new(response: response).validate
end

Instance Method Details

#validateObject



17
18
19
20
21
22
# File 'lib/cloudscrape_client/validate.rb', line 17

def validate
  raise CloudscrapeClient::InternalServerError, message if internal_error?
  raise CloudscrapeClient::NotFound, message if not_found?

  true
end