paychex_api 0.0.15 → 0.0.16

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
  SHA1:
3
- metadata.gz: 77d818de2086e5708f1d5b9d511ec1fbeed494c6
4
- data.tar.gz: c2616c4c54d5ac1f81df80734599bcb05f204e3b
3
+ metadata.gz: 0f90a39d82ea7c5b867ce99d984bada68a79676f
4
+ data.tar.gz: 47bd99e8ea6e6d9c6032451f4ad38e97c57dcfbf
5
5
  SHA512:
6
- metadata.gz: 839c8e4c9b706ed250aa6cc93be2be1ef6fe2f24e5d037576cf9c994afb745b0973ef41f6b67f0c4392480f51a60386a47b96b1e3180e55cd06d513270b7f50e
7
- data.tar.gz: 28cc04d2524da910da1a08f816be735182afcfe3ce8632c01abe0b3354698c8bc7d36731d5575602f2d1efe664bea93865bb145c5007b18cfc4030a1b34cef15
6
+ metadata.gz: b4db4983d1b14004fe8734f3e1765b30a89622a8e18e471aee8955dfb364f0e9e0b022147a9727538b8e303ba8d48b2d633134d426acc39f4b2f4bc9bf099563
7
+ data.tar.gz: 7e65b57e9c8a8aade89b8b3a994833240def11acb726c9ee9d419b52a18db82040c3561000e9f1eed8fbcfe049b9311bc268feddb897a047eeeff3f2374e15c3
@@ -29,6 +29,7 @@ module PaychexAPI
29
29
  CHECKS_PATH = '/checks'.freeze
30
30
  OAUTH_TOKEN_PATH = '/auth/oauth/v2/token'.freeze
31
31
  USERS_PATH = '/users'.freeze
32
+ PURCHASES_PATH = '/purchases'.freeze
32
33
 
33
34
  attr_reader :authorization
34
35
 
@@ -0,0 +1,9 @@
1
+ module PaychexAPI
2
+ class Client
3
+ module Purchases
4
+ def send_purchase(company_id, params = {})
5
+ post("#{API_PATH}#{COMPANIES_PATH}/#{company_id}/#{PURCHASES_PATH}", params)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module PaychexAPI
2
- VERSION = '0.0.15'.freeze unless defined?(PaychexAPI::VERSION)
2
+ VERSION = '0.0.16'.freeze unless defined?(PaychexAPI::VERSION)
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+ describe PaychexAPI::Client::Users do
3
+ before do
4
+ @client = PaychexAPI::Client.new(
5
+ prefix: 'http://test.paychex.com', client_id: 'client_id', client_secret: 'client_secret'
6
+ )
7
+ end
8
+
9
+ it 'should submit a purchase' do
10
+ response = @client.send_purchase(1,
11
+ 'transactionId' => '353490c6a-2d27-11e8-5784',
12
+ 'type' => 'BRIDGE-SEAT-PURCHASE',
13
+ 'count' => '10',
14
+ 'price' => 9999.99)
15
+ expect(response.status).to eq(200)
16
+ end
17
+ end
@@ -3,25 +3,25 @@ require 'tilt'
3
3
 
4
4
  class FakePaychex < Sinatra::Base
5
5
  # auth
6
- post %r{/auth/oauth/v2/token} do
6
+ post %r{/auth/oauth/v2/token$} do
7
7
  get_json_data 200, 'auth.json'
8
8
  end
9
9
 
10
10
  # workers
11
- get %r{/companies/.*/workers.*} do
11
+ get %r{/companies/.*/workers.*$} do
12
12
  get_json_data 200, 'workers.json'
13
13
  end
14
14
 
15
15
  # workers
16
- get %r{/companies/.*/workers/\+d+} do
16
+ get %r{/companies/.*/workers/\+d+$} do
17
17
  get_json_data 200, 'workers.json'
18
18
  end
19
19
 
20
- get %r{/workers/\d+} do
20
+ get %r{/workers/\d+$} do
21
21
  get_json_data 200, 'workers.json'
22
22
  end
23
23
 
24
- get %r{/workers/\d+/users} do
24
+ get %r{/workers/\d+/users$} do
25
25
  case request.env['HTTP_ACCEPT']
26
26
  when "application/json;profile='http://api.paychex.com/profiles/users/v1'"
27
27
  get_json_data 200, 'users.json'
@@ -30,29 +30,29 @@ class FakePaychex < Sinatra::Base
30
30
  end
31
31
  end
32
32
 
33
- get %r{/workers/\d+/communications} do
33
+ get %r{/workers/\d+/communications$} do
34
34
  get_json_data 200, 'communications.json'
35
35
  end
36
36
 
37
- get %r{/workers/\d+/communications/\d+} do
37
+ get %r{/workers/\d+/communications/\d+$} do
38
38
  get_json_data 200, 'communications.json'
39
39
  end
40
40
 
41
- post %r{/workers/\d+/communications} do
41
+ post %r{/workers/\d+/communications$} do
42
42
  get_json_data 200, 'communications.json'
43
43
  end
44
44
 
45
- put %r{/workers/\d+/communications/\d+} do
45
+ put %r{/workers/\d+/communications/\d+$} do
46
46
  get_json_data 200, 'communications.json'
47
47
  end
48
48
 
49
- delete %r{/workers/\d+/communications/\d+} do
49
+ delete %r{/workers/\d+/communications/\d+$} do
50
50
  get_json_data 200, 'communications.json'
51
51
  end
52
52
 
53
53
  # companies
54
54
 
55
- get %r{/companies/[A-Za-z0-9]+} do
55
+ get %r{/companies/[A-Za-z0-9]+$} do
56
56
  case request.env['HTTP_ACCEPT']
57
57
  when "application/json;profile='http://api.paychex.com/profiles/company_associations/v1'"
58
58
  get_json_data 200, 'companies_associations.json'
@@ -61,31 +61,35 @@ class FakePaychex < Sinatra::Base
61
61
  end
62
62
  end
63
63
 
64
- get %r{/companies} do
64
+ get %r{/companies$} do
65
65
  get_json_data 200, 'companies.json'
66
66
  end
67
67
 
68
- get %r{/companies/[A-Za-z0-9]+/organizations+} do
68
+ get %r{/companies/[A-Za-z0-9]+/organizations+$} do
69
+ get_json_data 200, 'organizations.json'
70
+ end
71
+
72
+ post %r{/companies/[A-Za-z0-9]+/purchases+$} do
69
73
  get_json_data 200, 'organizations.json'
70
74
  end
71
75
 
72
76
  # Notifications
73
77
 
74
- post %r{/notifications/\S+} do
78
+ post %r{/notifications/\S+$} do
75
79
  get_json_data 200, 'communications.json'
76
80
  end
77
81
 
78
82
  # Messages
79
83
 
80
- post %r{/messages} do
84
+ post %r{/messages$} do
81
85
  get_json_data 201, 'messages.json'
82
86
  end
83
87
 
84
- get %r{/users.*} do
88
+ get %r{/users.*$} do
85
89
  get_json_data 200, 'users.json'
86
90
  end
87
91
 
88
- get %r{/users/\S/workers+} do
92
+ get %r{/users/\S/workers+$} do
89
93
  get_json_data 200, 'workers.json'
90
94
  end
91
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paychex_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-23 00:00:00.000000000 Z
11
+ date: 2018-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -241,6 +241,7 @@ files:
241
241
  - lib/paychex_api/client/companies.rb
242
242
  - lib/paychex_api/client/messages.rb
243
243
  - lib/paychex_api/client/notifications.rb
244
+ - lib/paychex_api/client/purchases.rb
244
245
  - lib/paychex_api/client/users.rb
245
246
  - lib/paychex_api/client/workers.rb
246
247
  - lib/paychex_api/version.rb
@@ -259,6 +260,7 @@ files:
259
260
  - spec/paychex_api/client/companies_spec.rb
260
261
  - spec/paychex_api/client/messages_spec.rb
261
262
  - spec/paychex_api/client/notifications_spec.rb
263
+ - spec/paychex_api/client/purchases_spec.rb
262
264
  - spec/paychex_api/client/users_spec.rb
263
265
  - spec/paychex_api/client/workers_spec.rb
264
266
  - spec/paychex_api/client_spec.rb
@@ -304,6 +306,7 @@ test_files:
304
306
  - spec/paychex_api/client/companies_spec.rb
305
307
  - spec/paychex_api/client/messages_spec.rb
306
308
  - spec/paychex_api/client/notifications_spec.rb
309
+ - spec/paychex_api/client/purchases_spec.rb
307
310
  - spec/paychex_api/client/users_spec.rb
308
311
  - spec/paychex_api/client/workers_spec.rb
309
312
  - spec/paychex_api/client_spec.rb