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.
25 26 27 28 |
# File 'lib/tanga_services/http.rb', line 25 def initialize(method, *args) @method = method @args = *args end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tanga_services/http.rb', line 30 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 |