Class: TangaServices::HTTP
- Inherits:
-
Object
- Object
- TangaServices::HTTP
- Defined in:
- lib/tanga_services/http.rb
Defined Under Namespace
Classes: Exception
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(method, *args) ⇒ HTTP
constructor
A new instance of HTTP.
Constructor Details
#initialize(method, *args) ⇒ HTTP
Returns a new instance of HTTP.
19 20 21 22 |
# File 'lib/tanga_services/http.rb', line 19 def initialize(method, *args) @method = method @args = *args end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tanga_services/http.rb', line 24 def call begin Http::Exceptions.wrap_and_check do response = HTTParty.send(@method, *@args) response.parsed_response # See that the response can be accessed response end rescue Http::Exceptions::HttpException, JSON::ParserError fail TangaServices::HTTP::Exception end end |