perfect_audit 0.2.2 → 0.3.0

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: 8a7284c54d1804fee33ed75a695bf805a65a8dd3
4
- data.tar.gz: 391bc9117b7ed843a75315e47cb7738444d24ced
2
+ SHA256:
3
+ metadata.gz: 37964af9226a77b0adcbe2619adebdfcef92f0c6a41dee9163faf80ef75abb40
4
+ data.tar.gz: 58e3750c9076f75773370e56510e2c0fe5725880940c45fde356813dca8a6070
5
5
  SHA512:
6
- metadata.gz: 11061fc0b5b66c502a0ee1908837829de5877fa269cedb46d1a6f7eb1b7efd10979713ad524b73c647588186c38475dead3e1fb2e47fdd142c7d757636c85490
7
- data.tar.gz: 0cae16adbc72c32cfb752ddbaa346ea07d9dc463195b6f1fbdf8bc39b671bcf4dff514d5d2eacad1cbfad3c403802cc3beca6621e99bac8e6e9b3f16d6045a28
6
+ metadata.gz: d44df8fa1402e817ede0b6b7f280830a860020774d105a8811d56d12e20341b4aa6c6fdcffab9cbcb430752247d77abaf96fe48dba2d35e807fcb540d607379a
7
+ data.tar.gz: 8806f8b74208d3b5d14a70c71114e27f29ee5a998307b8e6b666bdd9d90b76ef73c2c1e65d9b5517e5723f6610a1a6e5ac46364a15b46a204533b0a8473ec2df
@@ -0,0 +1,21 @@
1
+ name: RuboCop
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ rubocop:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7
17
+ - name: Lint Ruby code with RuboCop
18
+ run: |
19
+ gem install bundler
20
+ bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
21
+ bundle exec --gemfile gemfiles/rubocop.gemfile rubocop
data/.irbrc CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'pry'
3
5
  Pry.start
data/.rubocop.yml ADDED
@@ -0,0 +1,7 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ inherit_gem:
4
+ jetrockets-standard: config/gems.yml
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.7
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,43 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-03-13 17:14:29 UTC using RuboCop version 1.44.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ Lint/IneffectiveAccessModifier:
11
+ Exclude:
12
+ - 'lib/perfect_audit.rb'
13
+
14
+ # Offense count: 2
15
+ RSpec/Be:
16
+ Exclude:
17
+ - 'spec/perfect_audit_spec.rb'
18
+
19
+ # Offense count: 1
20
+ # Configuration parameters: IgnoredMetadata.
21
+ RSpec/DescribeClass:
22
+ Exclude:
23
+ - 'spec/perfect_audit_spec.rb'
24
+
25
+ # Offense count: 3
26
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
27
+ # Include: **/*_spec*rb*, **/spec/**/*
28
+ RSpec/FilePath:
29
+ Exclude:
30
+ - 'spec/api/books_repository_spec.rb'
31
+ - 'spec/api/connection_spec.rb'
32
+ - 'spec/api/documents_repository_spec.rb'
33
+
34
+ # Offense count: 4
35
+ # Configuration parameters: .
36
+ # SupportedStyles: have_received, receive
37
+ RSpec/MessageSpies:
38
+ EnforcedStyle: receive
39
+
40
+ # Offense count: 1
41
+ RSpec/MultipleDescribes:
42
+ Exclude:
43
+ - 'spec/perfect_audit_spec.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.6
data/Gemfile CHANGED
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in perfect_audit.gemspec
4
6
  gemspec
7
+
8
+ eval_gemfile 'gemfiles/rubocop.gemfile'
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # PerfectAudit
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/perfect_audit.svg)](https://badge.fury.io/rb/perfect_audit)
4
- [![Build Status](https://travis-ci.org/igor-alexandrov/perfect_audit.svg?branch=master)](https://travis-ci.org/igor-alexandrov/perfect_audit)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/72f40b05552e16b9cd4f/maintainability)](https://codeclimate.com/github/igor-alexandrov/perfect_audit/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/72f40b05552e16b9cd4f/test_coverage)](https://codeclimate.com/github/igor-alexandrov/perfect_audit/test_coverage)
4
+ [![Build Status](https://travis-ci.org/jetrockets/perfect_audit.svg?branch=master)](https://travis-ci.org/jetrockets/perfect_audit)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/f416de8dc8074f1b1588/maintainability)](https://codeclimate.com/github/jetrockets/perfect_audit/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/f416de8dc8074f1b1588/test_coverage)](https://codeclimate.com/github/jetrockets/perfect_audit/test_coverage)
7
7
 
8
8
  Perfect Audit API wrapper.
9
9
 
10
- [https://www.perfectaudit.com/api_docs](https://www.perfectaudit.com/api_docs)
10
+ [https://ocrolus.com/api-docs/](https://ocrolus.com/api-docs/)
11
11
 
12
12
  ## Installation
13
13
 
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "perfect_audit"
4
+ require 'bundler/setup'
5
+ require 'perfect_audit'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "perfect_audit"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org' do
4
+ gem 'jetrockets-standard', '~> 1.0'
5
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'perfect_audit/api/period'
2
4
 
3
5
  module PerfectAudit
@@ -6,20 +8,22 @@ module PerfectAudit
6
8
 
7
9
  option :pk, as: :id
8
10
  option :book_pk, as: :book_id
9
- option :account_type#, optional: true
10
- option :account_holder#, optional: true
11
- option :account_number#, optional: true
12
- option :holder_zip#, optional: true
13
- option :holder_state#, optional: true
14
- option :holder_city#, optional: true
15
- option :holder_address_1#, optional: true
16
- option :holder_address_2#, optional: true
11
+ option :account_type # , optional: true
12
+ option :account_holder # , optional: true
13
+ option :account_number # , optional: true
14
+ option :holder_zip # , optional: true
15
+ option :holder_state # , optional: true
16
+ option :holder_city # , optional: true
17
+ option :holder_address_1 # , optional: true
18
+ option :holder_address_2 # , optional: true
17
19
  option :name
18
20
  option :periods, as: :_periods
19
21
 
20
22
  def periods
21
23
  _periods.map do |item|
22
- PerfectAudit::Period.new(item.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo})
24
+ PerfectAudit::Period.new(item.each_with_object({}) { |(k, v), memo|
25
+ memo[k.to_sym] = v
26
+ })
23
27
  end
24
28
  end
25
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'perfect_audit/api/bank_account'
2
4
  require 'perfect_audit/api/document'
3
5
 
@@ -18,13 +20,17 @@ module PerfectAudit
18
20
 
19
21
  def bank_accounts
20
22
  _bank_accounts.map do |id, params|
21
- PerfectAudit::BankAccount.new(params.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo})
23
+ PerfectAudit::BankAccount.new(params.each_with_object({}) { |(k, v), memo|
24
+ memo[k.to_sym] = v
25
+ })
22
26
  end
23
27
  end
24
28
 
25
29
  def documents
26
30
  _documents.map do |item|
27
- PerfectAudit::Document.new(item.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo})
31
+ PerfectAudit::Document.new(item.each_with_object({}) { |(k, v), memo|
32
+ memo[k.to_sym] = v
33
+ })
28
34
  end
29
35
  end
30
36
 
@@ -41,6 +47,3 @@ module PerfectAudit
41
47
  end
42
48
  end
43
49
  end
44
-
45
-
46
-
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PerfectAudit
2
4
  class Document
3
5
  extend Dry::Initializer
4
6
 
5
- STATUSES = %w(
7
+ STATUSES = %w[
6
8
  queued
7
9
  failed
8
10
  verifying
@@ -10,7 +12,7 @@ module PerfectAudit
10
12
  deleting
11
13
  deleted
12
14
  rejected
13
- )
15
+ ]
14
16
 
15
17
  option :pk, as: :id
16
18
  option :pages
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PerfectAudit
2
4
  class Period
3
5
  extend Dry::Initializer
@@ -11,6 +13,3 @@ module PerfectAudit
11
13
  option :secondary_recon_error_reason
12
14
  end
13
15
  end
14
-
15
-
16
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'perfect_audit/api/book'
2
4
  require 'http/form_data'
3
5
 
@@ -6,11 +8,11 @@ module PerfectAudit
6
8
  include PerfectAudit::AutoInject[:connection]
7
9
  include PerfectAudit::AutoInject[:response_parser]
8
10
 
9
- CREATE_PATH = 'book/add'.freeze
10
- ALL_PATH = 'books'.freeze
11
- FIND_PATH = 'book/info'.freeze
12
- DELETE_PATH = 'book/remove'.freeze
13
- EXCEL_EXPORT_PATH = 'book/export/xlsx/analytics'.freeze
11
+ CREATE_PATH = 'book/add'
12
+ ALL_PATH = 'books'
13
+ FIND_PATH = 'book/info'
14
+ DELETE_PATH = 'book/remove'
15
+ EXCEL_EXPORT_PATH = 'book/export/xlsx/analytics'
14
16
 
15
17
  # Create book in Perfect Audit
16
18
  #
@@ -23,8 +25,7 @@ module PerfectAudit
23
25
  json: {
24
26
  name: name.to_s,
25
27
  is_public: public.to_s
26
- }
27
- )
28
+ })
28
29
 
29
30
  PerfectAudit::Book.new(response_parser.parse(response.body.to_s))
30
31
  end
@@ -36,12 +37,11 @@ module PerfectAudit
36
37
  def all
37
38
  response = connection.get(ALL_PATH)
38
39
 
39
- response_parser.parse(response.body.to_s).map{ |item|
40
+ response_parser.parse(response.body.to_s).map { |item|
40
41
  PerfectAudit::Book.new(item)
41
42
  }
42
43
  end
43
44
 
44
-
45
45
  # Find book in Perfect Audit
46
46
  #
47
47
  # @param id [Integer] ID of book
@@ -51,8 +51,7 @@ module PerfectAudit
51
51
  response = connection.get(FIND_PATH,
52
52
  params: {
53
53
  pk: id.to_s
54
- }
55
- )
54
+ })
56
55
 
57
56
  PerfectAudit::Book.new(response_parser.parse(response.body.to_s))
58
57
  end
@@ -67,8 +66,7 @@ module PerfectAudit
67
66
  response = connection.post(DELETE_PATH,
68
67
  json: {
69
68
  book_id: id
70
- }
71
- )
69
+ })
72
70
 
73
71
  response_parser.parse(response.body.to_s)
74
72
 
@@ -80,8 +78,7 @@ module PerfectAudit
80
78
  response = connection.get(EXCEL_EXPORT_PATH,
81
79
  params: {
82
80
  pk: id.to_s
83
- }
84
- )
81
+ })
85
82
 
86
83
  response.body.to_s
87
84
  end
@@ -91,7 +88,7 @@ module PerfectAudit
91
88
  include PerfectAudit::AutoInject[:connection]
92
89
  include PerfectAudit::AutoInject[:response_parser]
93
90
 
94
- CREATE_PATH = 'book/upload'.freeze
91
+ CREATE_PATH = 'book/upload'
95
92
 
96
93
  def create(book_or_id, file)
97
94
  id = book_or_id.is_a?(PerfectAudit::Book) ? book_or_id.id.to_s : book_or_id.to_s
@@ -100,8 +97,7 @@ module PerfectAudit
100
97
  form: {
101
98
  pk: id,
102
99
  upload: HTTP::FormData::File.new(file)
103
- }
104
- )
100
+ })
105
101
 
106
102
  response_parser.parse(response.body.to_s)
107
103
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry-initializer'
2
4
  require 'http'
3
5
 
@@ -5,17 +7,17 @@ module PerfectAudit
5
7
  class Connection
6
8
  extend Dry::Initializer
7
9
 
8
- BASE_PATH = 'https://www.perfectaudit.com/api/v1/'.freeze
10
+ BASE_PATH = 'https://api.ocrolus.com/v1/'
9
11
 
10
12
  option :api_key
11
13
  option :api_secret
12
14
 
13
15
  def post(path, params = {})
14
- HTTP.basic_auth(:user => api_key, :pass => api_secret).post(url(path), params)
16
+ HTTP.basic_auth(user: api_key, pass: api_secret).post(url(path), params)
15
17
  end
16
18
 
17
19
  def get(path, params = {})
18
- HTTP.basic_auth(:user => api_key, :pass => api_secret).get(url(path), params)
20
+ HTTP.basic_auth(user: api_key, pass: api_secret).get(url(path), params)
19
21
  end
20
22
 
21
23
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PerfectAudit
2
4
  class Error < StandardError
3
5
  attr_reader :code
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ostruct'
2
4
  require 'perfect_audit/error'
3
5
 
@@ -10,10 +12,14 @@ module PerfectAudit
10
12
 
11
13
  case struct.response
12
14
  when Hash
13
- struct.response.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
15
+ struct.response.each_with_object({}) { |(k, v), memo|
16
+ memo[k.to_sym] = v
17
+ }
14
18
  when Array
15
19
  struct.response.map do |item|
16
- item.inject({}){ |memo,(k,v)| memo[k.to_sym] = v; memo }
20
+ item.each_with_object({}) { |(k, v), memo|
21
+ memo[k.to_sym] = v
22
+ }
17
23
  end
18
24
  else
19
25
  struct.response
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PerfectAudit
2
- VERSION = '0.2.2'.freeze
4
+ VERSION = '0.3.0'
3
5
  end
data/lib/perfect_audit.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry-container'
2
4
  require 'dry-auto_inject'
3
5
 
@@ -6,7 +8,6 @@ require 'perfect_audit/response_parser'
6
8
  require 'perfect_audit/version'
7
9
 
8
10
  module PerfectAudit
9
-
10
11
  class << self
11
12
  def configure
12
13
  yield configuration
@@ -1,25 +1,26 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'perfect_audit/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "perfect_audit"
8
- spec.version = PerfectAudit::VERSION
9
- spec.authors = ["Igor Alexandrov"]
10
- spec.email = ["igor.alexandrov@gmail.com"]
8
+ spec.name = 'perfect_audit'
9
+ spec.version = PerfectAudit::VERSION
10
+ spec.authors = ['Igor Alexandrov']
11
+ spec.email = ['igor.alexandrov@gmail.com']
11
12
 
12
- spec.summary = %q{Perfect Audit API wrapper.}
13
- spec.description = %q{Perfect Audit API wrapper. https://www.perfectaudit.com/api_docs}
14
- spec.homepage = "https://github.com/igor-alexandrov/perfect_audit"
15
- spec.license = "MIT"
13
+ spec.summary = 'Perfect Audit API wrapper.'
14
+ spec.description = 'Perfect Audit API wrapper. https://www.ocrolus.com/api-doc/'
15
+ spec.homepage = 'https://github.com/igor-alexandrov/perfect_audit'
16
+ spec.license = 'MIT'
16
17
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
21
22
 
22
- spec.required_ruby_version = '~> 2.3'
23
+ spec.required_ruby_version = '>= 2.7.0'
23
24
 
24
25
  # a b c d e f g h i j k l m n o p q r s t u v w x y z
25
26
  spec.add_dependency 'dry-auto_inject'
@@ -28,16 +29,15 @@ Gem::Specification.new do |spec|
28
29
  spec.add_dependency 'http'
29
30
  spec.add_dependency 'http-form_data'
30
31
 
31
-
32
- spec.add_development_dependency 'bundler', "~> 1.11"
32
+ spec.add_development_dependency 'bundler', '>= 1.11'
33
33
 
34
34
  spec.add_development_dependency 'factory_bot'
35
35
  spec.add_development_dependency 'faker'
36
36
 
37
37
  spec.add_development_dependency 'pry'
38
38
 
39
- spec.add_development_dependency 'rake', "~> 10.0"
40
- spec.add_development_dependency 'rspec', "~> 3.0"
39
+ spec.add_development_dependency 'rake', '~> 10.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.0'
41
41
  spec.add_development_dependency 'rspec-collection_matchers'
42
42
 
43
43
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfect_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Alexandrov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-auto_inject
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.11'
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
96
  version: '1.11'
97
97
  - !ruby/object:Gem::Dependency
@@ -220,16 +220,20 @@ dependencies:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
- description: Perfect Audit API wrapper. https://www.perfectaudit.com/api_docs
223
+ description: Perfect Audit API wrapper. https://www.ocrolus.com/api-doc/
224
224
  email:
225
225
  - igor.alexandrov@gmail.com
226
226
  executables: []
227
227
  extensions: []
228
228
  extra_rdoc_files: []
229
229
  files:
230
+ - ".github/workflows/rubocop.yml"
230
231
  - ".gitignore"
231
232
  - ".irbrc"
232
233
  - ".rspec"
234
+ - ".rubocop.yml"
235
+ - ".rubocop_todo.yml"
236
+ - ".ruby-version"
233
237
  - ".travis.yml"
234
238
  - Gemfile
235
239
  - LICENSE.txt
@@ -237,6 +241,7 @@ files:
237
241
  - Rakefile
238
242
  - bin/console
239
243
  - bin/setup
244
+ - gemfiles/rubocop.gemfile
240
245
  - lib/perfect_audit.rb
241
246
  - lib/perfect_audit/api/bank_account.rb
242
247
  - lib/perfect_audit/api/book.rb
@@ -258,17 +263,16 @@ require_paths:
258
263
  - lib
259
264
  required_ruby_version: !ruby/object:Gem::Requirement
260
265
  requirements:
261
- - - "~>"
266
+ - - ">="
262
267
  - !ruby/object:Gem::Version
263
- version: '2.3'
268
+ version: 2.7.0
264
269
  required_rubygems_version: !ruby/object:Gem::Requirement
265
270
  requirements:
266
271
  - - ">="
267
272
  - !ruby/object:Gem::Version
268
273
  version: '0'
269
274
  requirements: []
270
- rubyforge_project:
271
- rubygems_version: 2.6.13
275
+ rubygems_version: 3.1.6
272
276
  signing_key:
273
277
  specification_version: 4
274
278
  summary: Perfect Audit API wrapper.