Class: Binford::WebService
- Inherits:
-
Object
- Object
- Binford::WebService
- Defined in:
- lib/binford/web_service.rb
Direct Known Subclasses
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(base_url, serializer:) ⇒ WebService
constructor
A new instance of WebService.
Constructor Details
#initialize(base_url, serializer:) ⇒ WebService
Returns a new instance of WebService.
7 8 9 10 |
# File 'lib/binford/web_service.rb', line 7 def initialize(base_url, serializer:) @base_url = base_url @serializer = serializer end |
Instance Method Details
#get(path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/binford/web_service.rb', line 12 def get(path) response = conn.get(path) return unless response.success? serializer.call(response.body) end |