sunat_books 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 709258f206c12128dc3767eab4a1dad442905cd0
4
- data.tar.gz: 90aec2c66bad2f061d0a782d56dfbd787b50ad76
2
+ SHA256:
3
+ metadata.gz: 5bc9571ffaf425a6ba23d9ea43d3f1e2eb4e1acf6ba6a05d40d3c974390a9f19
4
+ data.tar.gz: 884a5edd838e6b36da06b98c956cacbf045bd80f33e7c3700df38e058f21e46a
5
5
  SHA512:
6
- metadata.gz: ddb4b6af254003a306535f3df550a052737ba443c38a8f25e594bb4d83969f6d49f5f473f52c182303409f507569d14e557e812df258df2f0e87c552b158bd0c
7
- data.tar.gz: 565b98f45c56f0fa74ef8b37e3316b969806ce869e0e17ff46f226fd19e4f6fd09dce33f5cb44705069422200f1d58bd64478648caf6387420c5242ae4c953c3
6
+ metadata.gz: 2d0df1c773487691fc4bc96b46898a3b186dba0500301e71b0e30e345aee646c3fd10fabcae5c95313264f0207381883591e904544a56f471cf38d55d17139fc
7
+ data.tar.gz: 2ab77e2a3986850ab3619015121b964b42d297ef57edcdddf9b44c89e3d4d19cec1f1139f4471b9550a8136393f3d79daaeb6ea9938de59462a0fae6f40bce64
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.6
3
3
  Style/Documentation:
4
4
  Enabled: false
5
5
  Style/StringLiterals:
@@ -13,3 +13,16 @@ Style/StringLiteralsInInterpolation:
13
13
  SupportedStyles:
14
14
  - single_quotes
15
15
  - double_quotes
16
+
17
+ Style/MixinUsage:
18
+ Exclude:
19
+ - 'test/**/*'
20
+
21
+ Style/HashEachMethods:
22
+ Enabled: true
23
+
24
+ Style/HashTransformKeys:
25
+ Enabled: true
26
+
27
+ Style/HashTransformValues:
28
+ Enabled: true
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm --create use 2.4.1@sunat_books
1
+ rvm --create use 2.6@sunat_books
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.5
4
- - 2.4.2
3
+ - 2.5
4
+ - 2.6
5
+ - 2.7
5
6
  script:
6
7
  - make test
data/README.mkd CHANGED
@@ -2,7 +2,6 @@
2
2
  [![Gem Version][rubygems-image]][rubygems-url]
3
3
  [![Build Status][travis-image]][travis-url]
4
4
  [![Code Climate][code-climate-image]][code-climate-url]
5
- [![Dependency Status][gemnasium-image]][gemnasium-url]
6
5
 
7
6
  > A ruby gem to get accounting books for [SUNAT](https://www.sunat.gob.pe)
8
7
 
@@ -41,5 +40,3 @@ ple = SunatBooks::Ple::Buys.new(ruc, tickets, month, year)
41
40
  [travis-url]: https://travis-ci.org/ccarruitero/sunat_books
42
41
  [code-climate-image]: https://codeclimate.com/github/ccarruitero/sunat_books/badges/gpa.svg
43
42
  [code-climate-url]: https://codeclimate.com/github/ccarruitero/sunat_books
44
- [gemnasium-image]: https://gemnasium.com/ccarruitero/sunat_books.png
45
- [gemnasium-url]: https://gemnasium.com/ccarruitero/sunat_books
@@ -18,6 +18,7 @@ module SunatBooks
18
18
  if options[:layout].nil?
19
19
  raise SunatBooks::Csv::OptionError, "Layout option is required"
20
20
  end
21
+
21
22
  filename = options[:filename] || "#{tmp_path}book.csv"
22
23
  fields = options[:layout]
23
24
  get_file(filename, fields, tickets)
@@ -54,6 +55,7 @@ module SunatBooks
54
55
 
55
56
  def append_to_csv(filename, data, mode)
56
57
  return if data.nil?
58
+
57
59
  CSV.open(filename, mode) do |csv|
58
60
  csv << data
59
61
  end
@@ -87,10 +87,10 @@ module SunatBooks
87
87
  tbody
88
88
  end
89
89
 
90
- def table_hash(f, ticket, tbody, widths, aligns)
90
+ def table_hash(field, ticket, tbody, widths, aligns)
91
91
  options = { cell_style: { borders: [], size: 5 } }
92
92
 
93
- f.each do |key, value|
93
+ field.each do |key, value|
94
94
  v = value.collect do |s|
95
95
  value = field_value(ticket, s)
96
96
  end
@@ -18,6 +18,7 @@ module DiaryEntries
18
18
  buys = tickets.where(operation_type: "compras")
19
19
  title = "COMPRAS DEL PERIODO"
20
20
  return unless buys.count.positive?
21
+
21
22
  buys_sum = get_row_sums(buys, counts, total_sums)
22
23
  data << [period_date, title, buys_sum].flatten
23
24
  end
@@ -26,6 +27,7 @@ module DiaryEntries
26
27
  sales = tickets.where(operation_type: "ventas")
27
28
  title = "VENTAS DEL PERIODO"
28
29
  return unless sales.count.positive?
30
+
29
31
  sales_sum = get_row_sums(sales, counts, total_sums)
30
32
  data << [period_date, title, sales_sum].flatten
31
33
  end
@@ -103,8 +105,8 @@ module DiaryEntries
103
105
  row_data
104
106
  end
105
107
 
106
- def increase_value(row_data, total_sums, i, value)
107
- total_sums[i].add value
108
+ def increase_value(row_data, total_sums, index, value)
109
+ total_sums[index].add value
108
110
  row_data << { content: formated_number(value), align: :right }
109
111
  end
110
112
  end
@@ -33,6 +33,7 @@ module SunatBooks
33
33
  def update_fields(fields = nil, source = nil)
34
34
  # update fields from a given source
35
35
  return if source.nil?
36
+
36
37
  fields&.each do |field|
37
38
  send("#{field}=", source.send(field)) if available?(field, source)
38
39
  end
@@ -24,6 +24,7 @@ module PagesUtils
24
24
 
25
25
  def setup_new_page(pages, last_page, length)
26
26
  return if last_page.page_number == pages.count
27
+
27
28
  new_page = pages[last_page.page_number + 1]
28
29
  fields = %w[bi_sum igv_sum total_sum non_taxable]
29
30
  new_page.update_fields(fields, last_page)
@@ -31,8 +32,8 @@ module PagesUtils
31
32
  new_page
32
33
  end
33
34
 
34
- def page_index(i, page_max)
35
- i.zero? ? 1 : (i / page_max.to_f).ceil
35
+ def page_index(index, page_max)
36
+ index.zero? ? 1 : (index / page_max.to_f).ceil
36
37
  end
37
38
 
38
39
  def not_moviment_page(data)
@@ -55,6 +55,7 @@ module SunatBooks
55
55
 
56
56
  def entries_data(tickets, counts, total_sums, data, period_date)
57
57
  return not_moviment_data(data) if tickets.empty?
58
+
58
59
  sales_entry(tickets, counts, total_sums, data, period_date)
59
60
  buys_entry(tickets, counts, total_sums, data, period_date)
60
61
  other_entry(tickets, counts, total_sums, data)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "sunat_books"
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
  s.summary = "A ruby gem to get accounting books for SUNAT"
7
7
  s.description = s.summary
8
8
  s.authors = ["César Carruitero"]
@@ -12,14 +12,14 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
 
15
+ s.add_runtime_dependency("activesupport", "> 4.1")
16
+ s.add_runtime_dependency("i18n", "~> 1.8")
15
17
  s.add_runtime_dependency("prawn", "~> 2.0")
16
18
  s.add_runtime_dependency("prawn-table", "~> 0.2")
17
- s.add_runtime_dependency("i18n", "~> 0.7")
18
- s.add_runtime_dependency("activesupport", "> 4.1")
19
19
 
20
20
  s.add_development_dependency("cutest", "~> 1.2")
21
+ s.add_development_dependency("faker", "~> 2.2")
22
+ s.add_development_dependency("pdf-inspector", "~> 1.3.0")
21
23
  s.add_development_dependency("pry", "~> 0.10")
22
24
  s.add_development_dependency("rubocop", "~> 0.48")
23
- s.add_development_dependency("pdf-inspector", "~> 1.2.0")
24
- s.add_development_dependency("faker", "~> 1.7")
25
25
  end
@@ -3,7 +3,8 @@
3
3
  require_relative "../helper"
4
4
 
5
5
  setup do
6
- @company = Company.new(ruc: Faker::Number.number(11), name: Faker::Name.name)
6
+ @company = Company.new(ruc: Faker::Number.number(digits: 11),
7
+ name: Faker::Name.name)
7
8
  end
8
9
 
9
10
  test "render pdf, have a parseable pdf" do
@@ -3,7 +3,8 @@
3
3
  require_relative "../helper"
4
4
 
5
5
  setup do
6
- @company = Company.new(ruc: Faker::Number.number(11), name: Faker::Name.name)
6
+ @company = Company.new(ruc: Faker::Number.number(digits: 11),
7
+ name: Faker::Name.name)
7
8
  end
8
9
 
9
10
  test "render pdf, have a parseable pdf" do
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunat_books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - César Carruitero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: prawn
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: prawn-table
28
+ name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.2'
33
+ version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.2'
40
+ version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
- name: i18n
42
+ name: prawn
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.7'
47
+ version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.7'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: activesupport
56
+ name: prawn-table
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">"
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.1'
61
+ version: '0.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">"
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.1'
68
+ version: '0.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cutest
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,61 +81,61 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.2'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
84
+ name: faker
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.10'
89
+ version: '2.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.10'
96
+ version: '2.2'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: pdf-inspector
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.48'
103
+ version: 1.3.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.48'
110
+ version: 1.3.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: pdf-inspector
112
+ name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2.0
117
+ version: '0.10'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.2.0
124
+ version: '0.10'
125
125
  - !ruby/object:Gem::Dependency
126
- name: faker
126
+ name: rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.7'
131
+ version: '0.48'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.7'
138
+ version: '0.48'
139
139
  description: A ruby gem to get accounting books for SUNAT
140
140
  email:
141
141
  - cesar@mozilla.pe
@@ -208,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubyforge_project:
212
- rubygems_version: 2.6.13
211
+ rubygems_version: 3.0.6
213
212
  signing_key:
214
213
  specification_version: 4
215
214
  summary: A ruby gem to get accounting books for SUNAT