Class: Ifns::Responses::Ticket

Inherits:
Base
  • Object
show all
Defined in:
lib/ifns/responses/ticket.rb

Instance Attribute Summary

Attributes inherited from Base

#cached, #id, #response

Instance Method Summary collapse

Methods inherited from Base

#accepted?, #gone?, #good?, #incorrect_fpd?, #incorrect_params?, #initialize, #internal_error?, #invalid?, #not_found?, #rate_limit_exceeded?, #retry?, #valid?

Constructor Details

This class inherits a constructor from Ifns::Responses::Base

Instance Method Details

#goodsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ifns/responses/ticket.rb', line 4

def goods
  @goods ||= begin
    return if items_blank?

    devider = 100.0
    items = body[:receipt][:items].map(&:dup)
    items.map do |good|
      good[:name] = good[:name].try(:squish)
      good[:price] = (good[:price].to_f / devider)
      good[:sum] = (good[:sum].to_f / devider)
      good
    end
  end
end

#innObject



19
20
21
# File 'lib/ifns/responses/ticket.rb', line 19

def inn
  body.try(:[], :receipt).try(:[], :userInn)
end

#ticketObject



23
24
25
# File 'lib/ifns/responses/ticket.rb', line 23

def ticket
  body[:receipt]
end