crawlora-bbb 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +1 -1
- data/lib/crawlora/bbb/client.rb +32 -4
- data/lib/crawlora/bbb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6dea68bae3b0c2ff2c6004d52c8f19fd9acd390ba917f374c9e38637c9f8b70e
|
|
4
|
+
data.tar.gz: a7a511cd31d4de07d22a34eeb8468d78d67da3fe0558e7f5f3283214561f03ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 565cea8afccb79e10684368a24d0bef6daf749ee2b987644fa363d39295ae419136ab700b397ee8f5ee97daf6c3b4bd124dd246678a97d54da0fdc68b0586c4c
|
|
7
|
+
data.tar.gz: 3b137de00f7c1b74c4bb6367e09ee3fccd242d34f039592d5daf62e8fd85a65544e7fb704238830dfbc9bdae9bbc2b2018ad1e9f4e696dfd999af0109d796469
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ puts result
|
|
|
20
20
|
client.close
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Use an operation-specific method for normal calls. `request(operation_id, params = {}, response_type: :auto)` is available for every operation. `response_type: :text` returns raw response text. This gem includes
|
|
23
|
+
Use an operation-specific method for normal calls. `request(operation_id, params = {}, response_type: :auto)` is available for every operation. `response_type: :text` returns raw response text. This gem includes 16 API operations.
|
|
24
24
|
|
|
25
25
|
```ruby
|
|
26
26
|
client = Crawlora::Bbb::Client.new(api_key: ENV.fetch("CRAWLORA_API_KEY"), timeout: 30)
|
data/lib/crawlora/bbb/client.rb
CHANGED
|
@@ -19,17 +19,17 @@ module Crawlora
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
OPERATIONS = JSON.parse(<<~'JSON').freeze
|
|
22
|
-
{"bbb-business": {"id": "bbb-business", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-complaints": {"id": "bbb-business-complaints", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business/complaints", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-more-info": {"id": "bbb-business-more-info", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business/more-info", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-reviews": {"id": "bbb-business-reviews", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}, {"description": "Result page (10 per page), default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/business/reviews", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "bbb-category": {"id": "bbb-category", "method": "GET", "params": [{"description": "BBB category browse URL, from a bbb-search result's related_categories", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/category/plumber"}, {"description": "Result page, default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/category", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-detail": {"id": "bbb-scamtracker-detail", "method": "GET", "params": [{"description": "BBB Scam Tracker report id, from a bbb-scamtracker-search result's id or url", "in": "path", "name": "id", "required": true, "type": "string", "x-example": "1397968"}], "path": "/bbb/scamtracker/{id}", "pathParams": ["id"], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-search": {"id": "bbb-scamtracker-search", "method": "GET", "params": [{"description": "Free-text search (phone number, website, email, business name, scam ID, description). Omit to browse the most-recent feed", "in": "query", "name": "query", "type": "string", "x-example": "amazon"}, {"description": "Scam category filter", "enum": ["Advance Fee Loan", "Bank/Credit Card Company Imposter", "Business Email Compromise", "Charity", "Counterfeit Product", "COVID-19", "Credit Cards", "Credit Repair/Debt Relief", "CryptoCurrency", "Debt Collections", "Employment", "Fake Check/Money Order", "Fake Invoice/Supplier Bill", "Family/Friend Emergency", "Foreign Money Exchange", "Government Agency Imposter", "Government Grant", "Healthcare/Medicaid/Medicare", "Home Improvement", "Identity Theft", "Investment", "Moving", "Online Purchase", "Other", "Phishing", "Rental", "Retail Business", "Romance", "Scholarship", "Sweepstakes/Lottery/Prizes", "Tax Collection", "Tech Support", "Travel/Vacation/Timeshare", "Utility", "Vanity Award", "Worthless Problem-solving Service", "Yellow Pages/Directories"], "in": "query", "name": "scam_type", "type": "string"}, {"description": "Optional 2-letter targeted-victim state/province code (US state or Canadian province)", "in": "query", "name": "state", "type": "string", "x-example": "TX"}, {"description": "Optional 2-letter reported-scammer state/province code (US state or Canadian province) -- where the scammer is reported to be, not the victim", "in": "query", "name": "scammer_state", "type": "string", "x-example": "NY"}, {"description": "Optional report-date range start (YYYY-MM-DD), inclusive. Must be set together with date_to", "in": "query", "name": "date_from", "type": "string", "x-example": "2026-01-01"}, {"description": "Optional report-date range end (YYYY-MM-DD), inclusive. Must be set together with date_from", "in": "query", "name": "date_to", "type": "string", "x-example": "2026-01-31"}, {"description": "Optional minimum reported dollar loss. Must be set together with max_dollars_lost", "in": "query", "name": "min_dollars_lost", "type": "integer", "x-example": 500000}, {"description": "Optional maximum reported dollar loss. Must be set together with min_dollars_lost", "in": "query", "name": "max_dollars_lost", "type": "integer", "x-example": 1000000}, {"description": "Result page (10 per page), default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/scamtracker/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "query", "type": "string"}, {"enum": ["Advance Fee Loan", "Bank/Credit Card Company Imposter", "Business Email Compromise", "Charity", "Counterfeit Product", "COVID-19", "Credit Cards", "Credit Repair/Debt Relief", "CryptoCurrency", "Debt Collections", "Employment", "Fake Check/Money Order", "Fake Invoice/Supplier Bill", "Family/Friend Emergency", "Foreign Money Exchange", "Government Agency Imposter", "Government Grant", "Healthcare/Medicaid/Medicare", "Home Improvement", "Identity Theft", "Investment", "Moving", "Online Purchase", "Other", "Phishing", "Rental", "Retail Business", "Romance", "Scholarship", "Sweepstakes/Lottery/Prizes", "Tax Collection", "Tech Support", "Travel/Vacation/Timeshare", "Utility", "Vanity Award", "Worthless Problem-solving Service", "Yellow Pages/Directories"], "in": "query", "name": "scam_type", "type": "string"}, {"in": "query", "name": "state", "type": "string"}, {"in": "query", "name": "scammer_state", "type": "string"}, {"in": "query", "name": "date_from", "type": "string"}, {"in": "query", "name": "date_to", "type": "string"}, {"in": "query", "name": "min_dollars_lost", "type": "integer"}, {"in": "query", "name": "max_dollars_lost", "type": "integer"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-state-stats": {"id": "bbb-scamtracker-state-stats", "method": "GET", "params": [{"description": "Aggregation window, default 90", "enum": ["30", "90", "365", "all"], "in": "query", "name": "period", "type": "string"}], "path": "/bbb/scamtracker/state-stats", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["30", "90", "365", "all"], "in": "query", "name": "period", "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-search": {"id": "bbb-search", "method": "GET", "params": [{"description": "Business name or category/service keyword", "in": "query", "name": "query", "required": true, "type": "string", "x-example": "plumber"}, {"description": "City and state (e.g. 'Austin, TX') or a ZIP code", "in": "query", "name": "location", "required": true, "type": "string", "x-example": "Austin, TX"}, {"description": "Result page, default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "query", "required": true, "type": "string"}, {"in": "query", "name": "location", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}}
|
|
22
|
+
{"bbb-article": {"id": "bbb-article", "method": "GET", "params": [{"description": "Canonical BBB article URL", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/article/news-releases/34935-bbb-scam-alert-dont-be-fooled-by-free-gas-and-grocery-card-postcards"}], "path": "/bbb/article", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business": {"id": "bbb-business", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-complaints": {"id": "bbb-business-complaints", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business/complaints", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-more-info": {"id": "bbb-business-more-info", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}], "path": "/bbb/business/more-info", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-business-reviews": {"id": "bbb-business-reviews", "method": "GET", "params": [{"description": "BBB business profile URL, from a bbb-search result's url or hq_profile_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/profile/plumber/calixto-plumbing-0825-1000223803"}, {"description": "Result page (10 per page), default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/business/reviews", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "bbb-category": {"id": "bbb-category", "method": "GET", "params": [{"description": "BBB category browse URL, from a bbb-search result's related_categories", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/category/plumber"}, {"description": "Result page, default 1", "in": "query", "name": "page", "type": "integer"}, {"description": "Sort order", "enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"description": "Maximum distance in miles; omit for all distances", "enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "description": "One or more BBB rating buckets", "in": "query", "items": {"enum": ["A", "B", "C", "D", "F"], "type": "string"}, "name": "rating", "type": "array"}, {"collectionFormat": "multi", "description": "Query-scoped category ID from bbb-search-filters", "in": "query", "items": {"type": "string"}, "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "description": "Query-scoped state or province code from bbb-search-filters", "in": "query", "items": {"type": "string"}, "name": "state", "type": "array"}, {"description": "Only BBB-accredited businesses", "in": "query", "name": "accredited", "type": "boolean"}, {"description": "Only businesses offering quote requests", "in": "query", "name": "get_quote", "type": "boolean"}, {"description": "Only businesses serving the searched area", "in": "query", "name": "service_area", "type": "boolean"}], "path": "/bbb/category", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}, {"enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "enum": ["A", "B", "C", "D", "F"], "in": "query", "name": "rating", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "state", "type": "array"}, {"in": "query", "name": "accredited", "type": "boolean"}, {"in": "query", "name": "get_quote", "type": "boolean"}, {"in": "query", "name": "service_area", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "bbb-local-bbb": {"id": "bbb-local-bbb", "method": "GET", "params": [{"description": "Canonical BBB chapter URL from bbb-local-bbbs or a business record's local_bbb_url", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/local-bbb/bbb-serving-the-heart-of-texas"}], "path": "/bbb/local-bbb", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-local-bbbs": {"id": "bbb-local-bbbs", "method": "GET", "params": [{"description": "Country code from bbb-regions", "enum": ["us", "ca"], "in": "query", "name": "country", "required": true, "type": "string", "x-example": "us"}, {"description": "Two-letter region code from bbb-regions", "in": "query", "name": "region", "required": true, "type": "string", "x-example": "tx"}], "path": "/bbb/local-bbbs", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["us", "ca"], "in": "query", "name": "country", "required": true, "type": "string"}, {"in": "query", "name": "region", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-news": {"id": "bbb-news", "method": "GET", "params": [{"description": "Canonical BBB newsroom or topic page URL; include page=N for pagination", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/news/scams?page=2"}], "path": "/bbb/news", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-news-topics": {"id": "bbb-news-topics", "method": "GET", "params": [{"description": "Canonical BBB newsroom page URL", "in": "query", "name": "url", "required": true, "type": "string", "x-example": "https://www.bbb.org/us/news"}], "path": "/bbb/news/topics", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "url", "required": true, "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-regions": {"id": "bbb-regions", "method": "GET", "params": [], "path": "/bbb/regions", "pathParams": [], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-detail": {"id": "bbb-scamtracker-detail", "method": "GET", "params": [{"description": "BBB Scam Tracker report id, from a bbb-scamtracker-search result's id or url", "in": "path", "name": "id", "required": true, "type": "string", "x-example": "1397968"}], "path": "/bbb/scamtracker/{id}", "pathParams": ["id"], "produces": ["application/json"], "queryParams": [], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-search": {"id": "bbb-scamtracker-search", "method": "GET", "params": [{"description": "Free-text search (phone number, website, email, business name, scam ID, description). Omit to browse the most-recent feed", "in": "query", "name": "query", "type": "string", "x-example": "amazon"}, {"description": "Scam category filter", "enum": ["Advance Fee Loan", "Bank/Credit Card Company Imposter", "Business Email Compromise", "Charity", "Counterfeit Product", "COVID-19", "Credit Cards", "Credit Repair/Debt Relief", "CryptoCurrency", "Debt Collections", "Employment", "Fake Check/Money Order", "Fake Invoice/Supplier Bill", "Family/Friend Emergency", "Foreign Money Exchange", "Government Agency Imposter", "Government Grant", "Healthcare/Medicaid/Medicare", "Home Improvement", "Identity Theft", "Investment", "Moving", "Online Purchase", "Other", "Phishing", "Rental", "Retail Business", "Romance", "Scholarship", "Sweepstakes/Lottery/Prizes", "Tax Collection", "Tech Support", "Travel/Vacation/Timeshare", "Utility", "Vanity Award", "Worthless Problem-solving Service", "Yellow Pages/Directories"], "in": "query", "name": "scam_type", "type": "string"}, {"description": "Optional 2-letter targeted-victim state/province code (US state or Canadian province)", "in": "query", "name": "state", "type": "string", "x-example": "TX"}, {"description": "Optional 2-letter reported-scammer state/province code (US state or Canadian province) -- where the scammer is reported to be, not the victim", "in": "query", "name": "scammer_state", "type": "string", "x-example": "NY"}, {"description": "Optional report-date range start (YYYY-MM-DD), inclusive. Must be set together with date_to", "in": "query", "name": "date_from", "type": "string", "x-example": "2026-01-01"}, {"description": "Optional report-date range end (YYYY-MM-DD), inclusive. Must be set together with date_from", "in": "query", "name": "date_to", "type": "string", "x-example": "2026-01-31"}, {"description": "Optional minimum reported dollar loss. Must be set together with max_dollars_lost", "in": "query", "name": "min_dollars_lost", "type": "integer", "x-example": 500000}, {"description": "Optional maximum reported dollar loss. Must be set together with min_dollars_lost", "in": "query", "name": "max_dollars_lost", "type": "integer", "x-example": 1000000}, {"description": "Result page (10 per page), default 1", "in": "query", "name": "page", "type": "integer"}], "path": "/bbb/scamtracker/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "query", "type": "string"}, {"enum": ["Advance Fee Loan", "Bank/Credit Card Company Imposter", "Business Email Compromise", "Charity", "Counterfeit Product", "COVID-19", "Credit Cards", "Credit Repair/Debt Relief", "CryptoCurrency", "Debt Collections", "Employment", "Fake Check/Money Order", "Fake Invoice/Supplier Bill", "Family/Friend Emergency", "Foreign Money Exchange", "Government Agency Imposter", "Government Grant", "Healthcare/Medicaid/Medicare", "Home Improvement", "Identity Theft", "Investment", "Moving", "Online Purchase", "Other", "Phishing", "Rental", "Retail Business", "Romance", "Scholarship", "Sweepstakes/Lottery/Prizes", "Tax Collection", "Tech Support", "Travel/Vacation/Timeshare", "Utility", "Vanity Award", "Worthless Problem-solving Service", "Yellow Pages/Directories"], "in": "query", "name": "scam_type", "type": "string"}, {"in": "query", "name": "state", "type": "string"}, {"in": "query", "name": "scammer_state", "type": "string"}, {"in": "query", "name": "date_from", "type": "string"}, {"in": "query", "name": "date_to", "type": "string"}, {"in": "query", "name": "min_dollars_lost", "type": "integer"}, {"in": "query", "name": "max_dollars_lost", "type": "integer"}, {"in": "query", "name": "page", "type": "integer"}], "security": ["ApiKeyAuth"]}, "bbb-scamtracker-state-stats": {"id": "bbb-scamtracker-state-stats", "method": "GET", "params": [{"description": "Aggregation window, default 90", "enum": ["30", "90", "365", "all"], "in": "query", "name": "period", "type": "string"}], "path": "/bbb/scamtracker/state-stats", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["30", "90", "365", "all"], "in": "query", "name": "period", "type": "string"}], "security": ["ApiKeyAuth"]}, "bbb-search": {"id": "bbb-search", "method": "GET", "params": [{"description": "Business name or category/service keyword", "in": "query", "name": "query", "required": true, "type": "string", "x-example": "plumber"}, {"description": "City and state (e.g. 'Austin, TX') or a ZIP code", "in": "query", "name": "location", "required": true, "type": "string", "x-example": "Austin, TX"}, {"description": "Result page, default 1", "in": "query", "name": "page", "type": "integer"}, {"default": "USA", "description": "BBB country code", "enum": ["USA", "CAN"], "in": "query", "name": "country", "type": "string"}, {"description": "Sort order", "enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"description": "Maximum distance in miles; omit for all distances", "enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "description": "One or more BBB rating buckets", "in": "query", "items": {"enum": ["A", "B", "C", "D", "F"], "type": "string"}, "name": "rating", "type": "array"}, {"collectionFormat": "multi", "description": "Query-scoped category ID from bbb-search-filters", "in": "query", "items": {"type": "string"}, "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "description": "Query-scoped state or province code from bbb-search-filters", "in": "query", "items": {"type": "string"}, "name": "state", "type": "array"}, {"description": "Only BBB-accredited businesses", "in": "query", "name": "accredited", "type": "boolean"}, {"description": "Only businesses offering quote requests", "in": "query", "name": "get_quote", "type": "boolean"}, {"description": "Only businesses serving the searched area", "in": "query", "name": "service_area", "type": "boolean"}], "path": "/bbb/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "query", "required": true, "type": "string"}, {"in": "query", "name": "location", "required": true, "type": "string"}, {"in": "query", "name": "page", "type": "integer"}, {"enum": ["USA", "CAN"], "in": "query", "name": "country", "type": "string"}, {"enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "enum": ["A", "B", "C", "D", "F"], "in": "query", "name": "rating", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "state", "type": "array"}, {"in": "query", "name": "accredited", "type": "boolean"}, {"in": "query", "name": "get_quote", "type": "boolean"}, {"in": "query", "name": "service_area", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "bbb-search-filters": {"id": "bbb-search-filters", "method": "GET", "params": [{"description": "Business name or category/service keyword; use with location when category_url is omitted", "in": "query", "name": "query", "type": "string", "x-example": "plumber"}, {"description": "City and state/province or ZIP code; use with query when category_url is omitted", "in": "query", "name": "location", "type": "string", "x-example": "Austin, TX"}, {"description": "BBB category browse URL; use instead of query and location", "in": "query", "name": "category_url", "type": "string", "x-example": "https://www.bbb.org/us/tx/austin/category/plumber"}, {"default": "USA", "description": "BBB country code", "enum": ["USA", "CAN"], "in": "query", "name": "country", "type": "string"}, {"description": "Result page, default 1", "in": "query", "name": "page", "type": "integer"}, {"description": "Sort order", "enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"description": "Maximum distance in miles; omit for all distances", "enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "description": "Selected rating values", "in": "query", "items": {"enum": ["A", "B", "C", "D", "F"], "type": "string"}, "name": "rating", "type": "array"}, {"collectionFormat": "multi", "description": "Selected category IDs previously returned for this search context", "in": "query", "items": {"type": "string"}, "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "description": "Selected state/province codes previously returned for this search context", "in": "query", "items": {"type": "string"}, "name": "state", "type": "array"}, {"description": "Only BBB-accredited businesses", "in": "query", "name": "accredited", "type": "boolean"}, {"description": "Only businesses offering quote requests", "in": "query", "name": "get_quote", "type": "boolean"}, {"description": "Only businesses serving the searched area", "in": "query", "name": "service_area", "type": "boolean"}], "path": "/bbb/search/filters", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "query", "type": "string"}, {"in": "query", "name": "location", "type": "string"}, {"in": "query", "name": "category_url", "type": "string"}, {"enum": ["USA", "CAN"], "in": "query", "name": "country", "type": "string"}, {"in": "query", "name": "page", "type": "integer"}, {"enum": ["Relevance", "Distance", "Rating", "AToZ", "ZToA"], "in": "query", "name": "sort", "type": "string"}, {"enum": ["5", "10", "25", "50", "100"], "in": "query", "name": "distance", "type": "string"}, {"collectionFormat": "multi", "enum": ["A", "B", "C", "D", "F"], "in": "query", "name": "rating", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "category_id", "type": "array"}, {"collectionFormat": "multi", "in": "query", "name": "state", "type": "array"}, {"in": "query", "name": "accredited", "type": "boolean"}, {"in": "query", "name": "get_quote", "type": "boolean"}, {"in": "query", "name": "service_area", "type": "boolean"}], "security": ["ApiKeyAuth"]}}
|
|
23
23
|
JSON
|
|
24
24
|
OPERATION_IDS = JSON.parse(<<~'JSON').freeze
|
|
25
|
-
["bbb-business", "bbb-business-complaints", "bbb-business-more-info", "bbb-business-reviews", "bbb-category", "bbb-scamtracker-detail", "bbb-scamtracker-search", "bbb-scamtracker-state-stats", "bbb-search"]
|
|
25
|
+
["bbb-article", "bbb-business", "bbb-business-complaints", "bbb-business-more-info", "bbb-business-reviews", "bbb-category", "bbb-local-bbb", "bbb-local-bbbs", "bbb-news", "bbb-news-topics", "bbb-regions", "bbb-scamtracker-detail", "bbb-scamtracker-search", "bbb-scamtracker-state-stats", "bbb-search", "bbb-search-filters"]
|
|
26
26
|
JSON
|
|
27
27
|
OPERATION_COUNT = OPERATION_IDS.length
|
|
28
28
|
|
|
29
29
|
class Client
|
|
30
30
|
attr_reader :base_url
|
|
31
31
|
|
|
32
|
-
def initialize(api_key: ENV["CRAWLORA_API_KEY"], base_url: "https://api.crawlora.net/api/v1", timeout: 30, user_agent: "crawlora-bbb-ruby/0.
|
|
32
|
+
def initialize(api_key: ENV["CRAWLORA_API_KEY"], base_url: "https://api.crawlora.net/api/v1", timeout: 30, user_agent: "crawlora-bbb-ruby/0.2.0", transport: nil)
|
|
33
33
|
@api_key = api_key
|
|
34
34
|
@base_url = base_url.to_s.sub(%r{/+$}, "")
|
|
35
35
|
@timeout = Float(timeout)
|
|
@@ -105,7 +105,11 @@ module Crawlora
|
|
|
105
105
|
OPERATIONS
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
-
define_method('
|
|
108
|
+
define_method('article') do |**params|
|
|
109
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
110
|
+
request('bbb-article', params, response_type: response_type)
|
|
111
|
+
end
|
|
112
|
+
define_method('business') do |**params|
|
|
109
113
|
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
110
114
|
request('bbb-business', params, response_type: response_type)
|
|
111
115
|
end
|
|
@@ -125,6 +129,26 @@ module Crawlora
|
|
|
125
129
|
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
126
130
|
request('bbb-category', params, response_type: response_type)
|
|
127
131
|
end
|
|
132
|
+
define_method('local_bbb') do |**params|
|
|
133
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
134
|
+
request('bbb-local-bbb', params, response_type: response_type)
|
|
135
|
+
end
|
|
136
|
+
define_method('local_bbbs') do |**params|
|
|
137
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
138
|
+
request('bbb-local-bbbs', params, response_type: response_type)
|
|
139
|
+
end
|
|
140
|
+
define_method('news') do |**params|
|
|
141
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
142
|
+
request('bbb-news', params, response_type: response_type)
|
|
143
|
+
end
|
|
144
|
+
define_method('news_topics') do |**params|
|
|
145
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
146
|
+
request('bbb-news-topics', params, response_type: response_type)
|
|
147
|
+
end
|
|
148
|
+
define_method('regions') do |**params|
|
|
149
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
150
|
+
request('bbb-regions', params, response_type: response_type)
|
|
151
|
+
end
|
|
128
152
|
define_method('scamtracker_search') do |**params|
|
|
129
153
|
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
130
154
|
request('bbb-scamtracker-search', params, response_type: response_type)
|
|
@@ -141,6 +165,10 @@ module Crawlora
|
|
|
141
165
|
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
142
166
|
request('bbb-search', params, response_type: response_type)
|
|
143
167
|
end
|
|
168
|
+
define_method('search_filters') do |**params|
|
|
169
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
170
|
+
request('bbb-search-filters', params, response_type: response_type)
|
|
171
|
+
end
|
|
144
172
|
|
|
145
173
|
private
|
|
146
174
|
|
data/lib/crawlora/bbb/version.rb
CHANGED