Class: Firmapi::Company
- Inherits:
-
Object
- Object
- Firmapi::Company
- Defined in:
- lib/firmapi/company.rb
Defined Under Namespace
Classes: NoCompanyFound
Class Method Summary collapse
Class Method Details
.find_by_siren!(siren) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/firmapi/company.rb', line 21 def self.find_by_siren!(siren) response = API.new.get '/company', { siren: siren } if response.status == 200 json = response.body self.new(json["result"]) elsif response.status == 404 raise NoCompanyFound, "No company was found with the siren '#{siren}'." end end |