paychex 0.2.2 → 0.3.1

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: 7d0c032fc4c96109c738cae58a63339e0d5ae1618933dfb14aefd68ca727a9d7
4
- data.tar.gz: 729be74e60e104634db7472e63f2ad73e8023551aebae1ba5380eee59ed34405
3
+ metadata.gz: 9fc0194f79a338fc21c331c97403e75627a0520c870db6dc8d38f7193ed02286
4
+ data.tar.gz: be667edc8dd68c872cda8a5808e0a09e66621481698f92e8e754926e48f736f3
5
5
  SHA512:
6
- metadata.gz: cff9b272ba0e27e3c8f61477fd5a25079449f0e3ef7dfa0fd8561a9bdcd33011afd5acfc6f3e2a2749b17a77a5d57b5148be7ee43adc4b63f292007c4aacf6c2
7
- data.tar.gz: dec6d3f0f5d1ae7fe07186f03f584c271b406563e50f2ae29dd31360b61b70e113affa117aa1a031a6eadf6f14d613a745cc6a4c7604e9ffb3e33d6bbb3bc966
6
+ metadata.gz: 8ef7a55f0b851dc86e8b6572f9e52427e6325fe1a9d113a81d4bff735bcea1aa249b0ba20ed0f0d0d6efce264aeeb2f0e8f082b473d98627b5664bf30efd1438
7
+ data.tar.gz: d9f36f96d26cafb5a1ad2f4b405d33440a032c54c35dd265e5937964cdc8f84d3e30a67344f91a49809e46367e1ed417bc13ee686960214627f8181e7a3f995b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paychex (0.2.2)
4
+ paychex (0.3.1)
5
5
  addressable
6
6
  faraday
7
7
  faraday_middleware
@@ -2,6 +2,7 @@ module Paychex
2
2
  class Client
3
3
  module Companies
4
4
  # Get a list of all the linked companies
5
+ # This will be unavailable once we have 200+ linked companies
5
6
  def linked_companies
6
7
  get('companies')
7
8
  end
@@ -35,16 +36,21 @@ module Paychex
35
36
 
36
37
  def details_by_display_id(display_id)
37
38
  begin
38
- content = linked_companies.body.fetch('content')
39
- company = content.find { |company| company.fetch('displayId') == display_id }
39
+ content = get("companies?displayId=#{display_id}").body.fetch('content')
40
+ company = content[0]
40
41
  return {
41
42
  "company": company,
42
- "message": company.nil? ? 'not-found' : 'found'
43
+ "message": 'found'
44
+ }
45
+ rescue Paychex::NotFound => e
46
+ return {
47
+ "company": nil,
48
+ "message": 'not found'
43
49
  }
44
50
  rescue Paychex::NoAccess => e
45
51
  return {
46
52
  "company": nil,
47
- "message": 'unknown'
53
+ "message": 'not found'
48
54
  }
49
55
  rescue StandardError => e
50
56
  p 'Paychex Gem: Handle more errors'
@@ -59,9 +65,9 @@ module Paychex
59
65
  def details_by_display_ids(display_ids)
60
66
  ret = {}
61
67
  begin
62
- content = linked_companies.body.fetch('content')
63
68
  display_ids.each do |display_id|
64
- company = content.find { |company| company.fetch('displayId') == display_id }
69
+ content = details_by_display_id(display_id)
70
+ company = content[:company]
65
71
  ret[display_id.to_s] = {
66
72
  "company": company,
67
73
  "message": company.nil? ? 'not-found' : 'found'
@@ -1,3 +1,3 @@
1
1
  module Paychex
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paychex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mayank Dedhia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-28 00:00:00.000000000 Z
11
+ date: 2023-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler