codat 0.1.5 → 0.1.7

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
2
  SHA256:
3
- metadata.gz: d09022df4a8325e87d98203d4441da3bb0767abc37b654c2ed2b0901d0f45f4b
4
- data.tar.gz: f75d4d5a4e8ef1f66201e53d70ea8449d289e18ca0b7355dbd8484a112bb6a6b
3
+ metadata.gz: 16dc68b012222a1b8437c2c55dd2351218c03702f31923b1cde00642e6dc8bcb
4
+ data.tar.gz: 576c2812a166a51385ced7c111812d84bacb5c8bfce478266e070e4e10410fd8
5
5
  SHA512:
6
- metadata.gz: ee8f01dfbe68c0b176164b054e6191bf9bf2b68dc6c87740eaf6bab195c6dc9e8724b35dd3179612bb2778d12a69da7b20c9db5adbec0595c6330392504c85af
7
- data.tar.gz: f94df3242b171c2c63d5c130505484143c81697dce53b9d714817f53f28f329f3872c9b147376abcc57fe5664034e844b1a000c49f67ef00beb1fe0387b041be
6
+ metadata.gz: cc87539d13dbd2c15195f89fe68d2112b018a6218eb66c862868de909a2d31482784349b9a01ee32c05548471bf73a0d9998a3a27654c6216c6df888b4cfbdfd
7
+ data.tar.gz: b425e777bb969794ae73d028d031a1111c9cad724137616a608bcb0094576055374417c5db30f898a73b9483201c7eb7b51f8b38d5549041311402b6eaf64798
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  Gemfile.lock
11
+ .DS_Store
11
12
 
12
13
  # rspec failure tracking
13
14
  .rspec_status
data/.gitlab-ci.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  before_script:
2
2
  - ruby -v
3
3
  - which ruby
4
- - gem install bundler
4
+ - gem install bundler:2.2.33
5
5
  - bundle install --jobs $(nproc) "${FLAGS[@]}"
6
6
 
7
7
  rspec:
data/.rubocop.yml CHANGED
@@ -1,7 +1,15 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.5.1
4
+ TargetRubyVersion: 3.2.0
5
+ NewCops: enable
6
+ SuggestExtensions: false
7
+
8
+ Gemspec/RequiredRubyVersion:
9
+ Enabled: false
10
+
11
+ Gemspec/RequireMFA:
12
+ Enabled: false
5
13
 
6
14
  # Don't force top level comments in every class
7
15
  Style/Documentation:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.4
1
+ 3.2.0
data/bin/console CHANGED
@@ -8,7 +8,7 @@ require 'dotenv'
8
8
  Dotenv.load
9
9
 
10
10
  Codat.configure do |config|
11
- config.api_key = ENV['API_KEY']
11
+ config.api_key = ENV.fetch('API_KEY')
12
12
  end
13
13
 
14
14
  # To avoid having to namespace everything when inside the console.
data/codat.gemspec CHANGED
@@ -25,20 +25,22 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_dependency 'faraday', '~> 0.15'
29
- spec.add_dependency 'faraday_middleware', '~> 0.12'
28
+ spec.required_ruby_version = '>= 2.5'
29
+
30
+ spec.add_dependency 'faraday', '~> 1.10'
31
+ spec.add_dependency 'faraday_middleware', '~> 1.2'
30
32
  spec.add_dependency 'faraday_middleware-multi_json', '~> 0.0.6'
31
- spec.add_dependency 'multi_json', '~> 1.13'
32
- spec.add_dependency 'rainbow', '~> 3.0'
33
+ spec.add_dependency 'multi_json', '~> 1.15'
34
+ spec.add_dependency 'rainbow', '~> 3.1'
33
35
 
34
36
  spec.add_development_dependency 'bundler'
35
37
  spec.add_development_dependency 'dotenv', '~> 2.5'
36
38
  spec.add_development_dependency 'pry-byebug', '~> 3.6'
37
- spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_development_dependency 'rake'
38
40
  spec.add_development_dependency 'rspec', '~> 3.0'
39
- spec.add_development_dependency 'rubocop', '~> 0.58'
40
- spec.add_development_dependency 'rubocop-rspec', '~> 1.27'
41
+ spec.add_development_dependency 'rubocop', '~> 1.43'
42
+ spec.add_development_dependency 'rubocop-rspec'
41
43
  spec.add_development_dependency 'simplecov', '~> 0.16'
42
- spec.add_development_dependency 'vcr', '~> 4.0.0'
43
- spec.add_development_dependency 'webmock', '~> 3.7.2'
44
+ spec.add_development_dependency 'vcr', '~> 6.1.0'
45
+ spec.add_development_dependency 'webmock', '~> 3.18.1'
44
46
  end
@@ -6,7 +6,7 @@ module Codat
6
6
  def self.transform(underscore_string)
7
7
  parts = underscore_string.to_s.split('_')
8
8
 
9
- rest = parts[1..-1].map(&:capitalize)
9
+ rest = parts[1..].map(&:capitalize)
10
10
 
11
11
  rest.unshift(parts[0]).join.to_sym
12
12
  end
data/lib/codat/client.rb CHANGED
@@ -35,7 +35,7 @@ module Codat
35
35
  private
36
36
 
37
37
  def api_url
38
- BASE_URLS.dig(Codat.configuration.environment.to_sym)
38
+ BASE_URLS[Codat.configuration.environment.to_sym]
39
39
  end
40
40
  end
41
41
  end
@@ -7,6 +7,8 @@ require 'codat/errors'
7
7
  module Codat
8
8
  class FaradayCodatAuth < Faraday::Middleware
9
9
  def initialize(app, api_key = '', options = {})
10
+ super()
11
+
10
12
  @app = app
11
13
  @api_key = api_key
12
14
  @options = options
@@ -30,7 +30,7 @@ module Codat
30
30
 
31
31
  @records = records.map { |bank_statement| BankStatement.new(json: bank_statement) }
32
32
 
33
- @metadata = Metadata.new(json: json)
33
+ @metadata = Metadata.new(json:)
34
34
  end
35
35
  end
36
36
  end
@@ -24,7 +24,7 @@ module Codat
24
24
  end
25
25
 
26
26
  def self.find(company_id)
27
- url = format_url(ENDPOINTS[:single], company_id: company_id)
27
+ url = format_url(ENDPOINTS[:single], company_id:)
28
28
 
29
29
  result = get(url)
30
30
 
@@ -14,6 +14,8 @@ module Codat
14
14
  attr_reader :reports
15
15
 
16
16
  def self.inherited(other)
17
+ super
18
+
17
19
  other.attributes :currency, :most_recent_available_month, :earliest_available_month
18
20
  end
19
21
 
@@ -28,7 +30,7 @@ module Codat
28
30
  #
29
31
  # An ArgumentError is raised unless you provide a :company_id key in the params.
30
32
  def self.find(params = {})
31
- company_id = params.dig(:company_id)
33
+ company_id = params[:company_id]
32
34
 
33
35
  raise ArgumentError, 'please provide company_id' unless company_id
34
36
 
@@ -49,7 +51,7 @@ module Codat
49
51
  periodsToCompare: options.fetch(:periods_to_compare, DEFAULT_PERIODS_TO_COMPARE)
50
52
  }
51
53
 
52
- options = options.map { |key, value| [Camelizer.transform(key), value] }.to_h
54
+ options = options.transform_keys { |key| Camelizer.transform(key) }
53
55
 
54
56
  query.merge(options)
55
57
  end
@@ -69,8 +71,8 @@ module Codat
69
71
  def initialize(json: {})
70
72
  super
71
73
 
72
- @most_recent_available_month = Date.parse(json.dig(:mostRecentAvailableMonth))
73
- @earliest_available_month = Date.parse(json.dig(:earliestAvailableMonth))
74
+ @most_recent_available_month = Date.parse(json[:mostRecentAvailableMonth])
75
+ @earliest_available_month = Date.parse(json[:earliestAvailableMonth])
74
76
 
75
77
  reports_json = json.fetch(:reports, {})
76
78
  @reports = reports_json.map { |report| self.class.report_class.new(json: report) }
@@ -14,7 +14,7 @@ module Codat
14
14
 
15
15
  return [] unless successful_response?(result)
16
16
 
17
- result.body.map { |integration| new(json: integration) }
17
+ result.body.fetch(:results, []).map { |integration| new(json: integration) }
18
18
  end
19
19
  end
20
20
  end
data/lib/codat/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Codat
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.15'
19
+ version: '1.10'
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: '0.15'
26
+ version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.12'
33
+ version: '1.2'
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.12'
40
+ version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday_middleware-multi_json
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.13'
61
+ version: '1.15'
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: '1.13'
68
+ version: '1.15'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rainbow
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '3.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '3.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '10.0'
131
+ version: '0'
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: '10.0'
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +156,28 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0.58'
159
+ version: '1.43'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0.58'
166
+ version: '1.43'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop-rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: '1.27'
173
+ version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: '1.27'
180
+ version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,28 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 4.0.0
201
+ version: 6.1.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 4.0.0
208
+ version: 6.1.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: webmock
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 3.7.2
215
+ version: 3.18.1
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 3.7.2
222
+ version: 3.18.1
223
223
  description: Codat API wrapper in Ruby
224
224
  email:
225
225
  - oterosantos@gmail.com
@@ -264,7 +264,7 @@ homepage: https://gitlab.com/finpoint/codat
264
264
  licenses:
265
265
  - MIT
266
266
  metadata: {}
267
- post_install_message:
267
+ post_install_message:
268
268
  rdoc_options: []
269
269
  require_paths:
270
270
  - lib
@@ -272,15 +272,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
273
  - - ">="
274
274
  - !ruby/object:Gem::Version
275
- version: '0'
275
+ version: '2.5'
276
276
  required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
278
  - - ">="
279
279
  - !ruby/object:Gem::Version
280
280
  version: '0'
281
281
  requirements: []
282
- rubygems_version: 3.0.3
283
- signing_key:
282
+ rubygems_version: 3.4.1
283
+ signing_key:
284
284
  specification_version: 4
285
285
  summary: Codat API wrapper in Ruby
286
286
  test_files: []