Class: ANAF::WebServices::BalanceSheet
- Inherits:
-
Object
- Object
- ANAF::WebServices::BalanceSheet
- Defined in:
- lib/anaf/web_services/balance_sheet.rb
Overview
:nodoc:
Constant Summary collapse
- BASE_URL =
'https://webservicesp.anaf.ro'
- PATH =
'/bilant'
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(cui, year) ⇒ BalanceSheet
constructor
A new instance of BalanceSheet.
Constructor Details
#initialize(cui, year) ⇒ BalanceSheet
Returns a new instance of BalanceSheet.
11 12 13 14 |
# File 'lib/anaf/web_services/balance_sheet.rb', line 11 def initialize(cui, year) @cui = cui @year = year end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/anaf/web_services/balance_sheet.rb', line 16 def call response = conn.get(PATH, { cui: @cui, an: @year }) return unless response.success? body = JSON.parse(response.body) return if body['deni'].nil? || body['deni'].strip.empty? body rescue Faraday::TimeoutError, Faraday::ConnectionFailed, JSON::ParserError nil end |