Class: Google::Apis::SafebrowsingV5::SafebrowsingService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::SafebrowsingV5::SafebrowsingService
- Defined in:
- lib/google/apis/safebrowsing_v5/service.rb
Overview
Safe Browsing API
Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://safebrowsing.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#initialize ⇒ SafebrowsingService
constructor
A new instance of SafebrowsingService.
-
#search_hashes(hash_prefixes: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5SearchHashesResponse
Search for full hashes matching the specified prefixes.
Constructor Details
#initialize ⇒ SafebrowsingService
Returns a new instance of SafebrowsingService.
51 52 53 54 55 56 |
# File 'lib/google/apis/safebrowsing_v5/service.rb', line 51 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-safebrowsing_v5', client_version: Google::Apis::SafebrowsingV5::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44 45 46 |
# File 'lib/google/apis/safebrowsing_v5/service.rb', line 44 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49 50 51 |
# File 'lib/google/apis/safebrowsing_v5/service.rb', line 49 def quota_user @quota_user end |
Instance Method Details
#search_hashes(hash_prefixes: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5SearchHashesResponse
Search for full hashes matching the specified prefixes. This is a custom method as defined by https://google.aip.dev/136 (the custom method refers to this method having a custom name within Google's general API development nomenclature; it does not refer to using a custom HTTP method).
84 85 86 87 88 89 90 91 92 |
# File 'lib/google/apis/safebrowsing_v5/service.rb', line 84 def search_hashes(hash_prefixes: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v5/hashes:search', ) command.response_representation = Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5SearchHashesResponse::Representation command.response_class = Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5SearchHashesResponse command.query['hashPrefixes'] = hash_prefixes unless hash_prefixes.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |