Class: Valvat::Lookup::Base
- Inherits:
-
Object
- Object
- Valvat::Lookup::Base
- Defined in:
- lib/valvat/lookup/base.rb
Instance Method Summary collapse
-
#initialize(vat, options = {}) ⇒ Base
constructor
A new instance of Base.
- #perform ⇒ Object
Constructor Details
#initialize(vat, options = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 |
# File 'lib/valvat/lookup/base.rb', line 9 def initialize(vat, = {}) @vat = Valvat(vat) = Valvat::Options() @requester = [:requester] && Valvat([:requester]) @rate_limit = [:rate_limit] end |
Instance Method Details
#perform ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/valvat/lookup/base.rb', line 16 def perform response = fetch(endpoint_uri) case response when Net::HTTPSuccess parse(response.body) else { error: Valvat::HTTPError.new(response.code, self.class) } end end |