Class: Pluggy::Services::MerchantService
- Inherits:
-
BaseService
- Object
- BaseService
- Pluggy::Services::MerchantService
- Defined in:
- lib/pluggy/services/other_services.rb
Instance Method Summary collapse
-
#retrieve(cnpj) ⇒ Object
Resolve a single CNPJ, or nil when it is unknown or invalid.
-
#search(cnpjs) ⇒ Object
GET /merchants.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Pluggy::Services::BaseService
Instance Method Details
#retrieve(cnpj) ⇒ Object
Resolve a single CNPJ, or nil when it is unknown or invalid.
188 189 190 |
# File 'lib/pluggy/services/other_services.rb', line 188 def retrieve(cnpj) search([cnpj]).found_merchants&.first end |
#search(cnpjs) ⇒ Object
GET /merchants. Returns three buckets (found, not found, invalid) rather than a list, so it maps to MerchantSearch rather than a list object.
181 182 183 184 185 |
# File 'lib/pluggy/services/other_services.rb', line 181 def search(cnpjs) list = Array(cnpjs) require_args!(cnpjs: list) object_request(:get, "/merchants", klass: Resources::MerchantSearch, cnpjs: list) end |