Class: CzechPostB2bClient::ResponseParsers::GetStatsParser
- Inherits:
-
BaseParser
show all
- Defined in:
- lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb
Instance Attribute Summary
#result
Instance Method Summary
collapse
Methods inherited from BaseParser
#initialize, #steps
call, #call, #errors, #failure?, #finished?, #steps, #success?
Instance Method Details
#build_result ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 6
def build_result
super
@result[:imports] = { requested: imports.all,
with_errors: imports.err,
successful: imports.ok,
imported_parcels: imports.parcels }
end
|
#imports ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 14
def imports
imports_hash = response_root_node
OpenStruct.new(all: imports_hash.dig('importAll').to_i,
err: imports_hash.dig('importErr').to_i,
ok: imports_hash.dig('importOk').to_i,
parcels: imports_hash.dig('parcels').to_i)
end
|
#response_root_node_name ⇒ Object
22
23
24
|
# File 'lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb', line 22
def response_root_node_name
'getStatsResponse'
end
|