Class: Veryfi::Api::W2Split
- Inherits:
-
Object
- Object
- Veryfi::Api::W2Split
- Includes:
- FilePayload
- Defined in:
- lib/veryfi/api/w2_split.rb
Overview
W-2 splitting endpoints (/partner/w2s-set/).
Use these when you have a single file containing multiple W-2 forms. Veryfi will split it and process each W-2 separately; you receive a collection that references the individual W2 ids it produced.
Constant Summary collapse
- ENDPOINT =
"/partner/w2s-set/"
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#all(params = {}) ⇒ Veryfi::Resource
List previously processed W-2 sets.
-
#get(id, params = {}) ⇒ Veryfi::Resource
Fetch a single W-2 set by id.
-
#initialize(request) ⇒ W2Split
constructor
A new instance of W2Split.
-
#process(raw_params) ⇒ Veryfi::Resource
Upload a multi-W-2 file and split-and-process it.
-
#process_url(raw_params) ⇒ Veryfi::Resource
URL variant of #process.
Constructor Details
#initialize(request) ⇒ W2Split
Returns a new instance of W2Split.
19 20 21 |
# File 'lib/veryfi/api/w2_split.rb', line 19 def initialize(request) @request = request end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
17 18 19 |
# File 'lib/veryfi/api/w2_split.rb', line 17 def request @request end |
Instance Method Details
#all(params = {}) ⇒ Veryfi::Resource
List previously processed W-2 sets.
27 28 29 |
# File 'lib/veryfi/api/w2_split.rb', line 27 def all(params = {}) request.get(ENDPOINT, params) end |
#get(id, params = {}) ⇒ Veryfi::Resource
Fetch a single W-2 set by id.
36 37 38 |
# File 'lib/veryfi/api/w2_split.rb', line 36 def get(id, params = {}) request.get("#{ENDPOINT}#{id}/", params) end |
#process(raw_params) ⇒ Veryfi::Resource
Upload a multi-W-2 file and split-and-process it.
46 47 48 49 50 51 52 53 54 |
# File 'lib/veryfi/api/w2_split.rb', line 46 def process(raw_params) params = raw_params.transform_keys(&:to_sym) file_path = params.delete(:file_path) file_name = params.delete(:file_name) payload = file_payload(file_path, file_name).merge(params) request.post(ENDPOINT, payload) end |
#process_url(raw_params) ⇒ Veryfi::Resource
URL variant of #process.
63 64 65 |
# File 'lib/veryfi/api/w2_split.rb', line 63 def process_url(raw_params) request.post(ENDPOINT, raw_params.transform_keys(&:to_sym)) end |