Class: CzechPostB2bClient::ResponseParsers::GetStatsParser

Inherits:
BaseParser show all
Defined in:
lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb

Instance Attribute Summary

Attributes inherited from SteppedService::Base

#result

Instance Method Summary collapse

Methods inherited from BaseParser

#initialize, #steps

Methods inherited from SteppedService::Base

call, #call, #errors, #failure?, #finished?, #steps, #success?

Constructor Details

This class inherits a constructor from CzechPostB2bClient::ResponseParsers::BaseParser

Instance Method Details

#build_resultObject



6
7
8
9
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 6

def build_result
  super
  @result[:imports] = imports
end

#importsObject



11
12
13
14
15
16
17
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 11

def imports
  imports_hash = response_root_node
  { requested: imports_hash['importAll'].to_i,
    with_errors: imports_hash['importErr'].to_i,
    successful: imports_hash['importOk'].to_i,
    imported_parcels: imports_hash['parcels'].to_i }
end

#response_root_node_nameObject



19
20
21
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 19

def response_root_node_name
  'getStatsResponse'
end