• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / lsp-data / 1c366247-bcf0-4673-8fe0-7083315c00e3

13 Dec 2024 08:19PM UTC coverage: 99.818% (-0.2%) from 100.0%
1c366247-bcf0-4673-8fe0-7083315c00e3

Pull #25

circleci

mzelesky
initial commit for invoice line and fund distribution classes
Pull Request #25: [WIP] initial commit for invoice line and fund distribution classes

61 of 62 new or added lines in 4 files covered. (98.39%)

547 of 548 relevant lines covered (99.82%)

5.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.67
/lib/lsp-data/api_invoice_line.rb
1
# frozen_string_literal: true
2

3
module LspData
1✔
4
  ### This class makes a model of an invoice line object
5
  ###   returned from Alma via API.
6
  class ApiInvoiceLine
1✔
7
    attr_reader :invoice_line
1✔
8

9
    def initialize(invoice_line:)
1✔
10
      @invoice_line = invoice_line
3✔
11
    end
12

13
    # Unique Alma invoice line identifier
14
    def pid
1✔
15
      @pid ||= invoice_line['id']
1✔
16
    end
17

18
    def type
1✔
19
      @type ||= invoice_line['type']['desc']
1✔
20
    end
21

22
    def number
1✔
23
      @number ||= invoice_line['number']
1✔
24
    end
25

26
    def status
1✔
27
      @status ||= invoice_line['status']['desc']
1✔
28
    end
29

30
    # The price is the price in the currency of the invoice
31
    def price
1✔
32
      @price ||= BigDecimal(invoice_line['price'].to_s)
1✔
33
    end
34

35
    def quantity
1✔
NEW
36
      @quantity ||= invoice_line['quantity']
×
37
    end
38

39
    def note
1✔
40
      @note ||= invoice_line['note']
1✔
41
    end
42

43
    def po_line
1✔
44
      @po_line ||= invoice_line['po_line']
1✔
45
    end
46

47
    def price_note
1✔
48
      @price_note ||= invoice_line['price_note']
1✔
49
    end
50

51
    # Price plus any overages and minus discounts
52
    def total_price
1✔
53
      @total_price ||= BigDecimal(invoice_line['total_price'].to_s)
1✔
54
    end
55

56
    def vat_note
1✔
57
      @vat_note ||= invoice_line['vat_note']
1✔
58
    end
59

60
    def check_subscription_date_overlap
1✔
61
      @check_subscription_date_overlap ||= invoice_line['check_subscription_date_overlap']
1✔
62
    end
63

64
    def fully_invoiced
1✔
65
      @fully_invoiced ||= invoice_line['fully_invoiced']
1✔
66
    end
67

68
    def additional_info
1✔
69
      @additional_info ||= invoice_line['additional_info']
1✔
70
    end
71

72
    def release_remaining_encumbrance
1✔
73
      @release_remaining_encumbrance ||= invoice_line['release_remaining_encumbrance']
1✔
74
    end
75

76
    def reporting_code
1✔
77
      @reporting_code ||= begin
2✔
78
        info = invoice_line['reporting_code']
1✔
79
        if info['value']
1✔
80
          { name: info['desc'], code: info['value'] }
1✔
81
        end
82
      end
83
    end
84

85
    def fund_distributions
1✔
86
      @fund_distributions ||= invoice_line['fund_distribution'].map do |distribution|
4✔
87
        ApiFundDistribution.new(fund_distribution: distribution)
3✔
88
      end
89
    end
90
  end
91
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc