Class: FdxV660Api::TaxStatement

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/tax_statement.rb

Overview

Tax statement containing one or more tax forms

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(tax_year: SKIP, corrected: SKIP, account_id: SKIP, tax_form_id: SKIP, tax_form_date: SKIP, additional_information: SKIP, tax_form_type: SKIP, issuer: SKIP, recipient: SKIP, attributes: SKIP, error: SKIP, links: SKIP, tax_statement_id: SKIP, tax_data_type: SKIP, forms: SKIP, pdf: SKIP, additional_properties: nil) ⇒ TaxStatement

Returns a new instance of TaxStatement.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 143

def initialize(tax_year: SKIP, corrected: SKIP, account_id: SKIP,
               tax_form_id: SKIP, tax_form_date: SKIP,
               additional_information: SKIP, tax_form_type: SKIP,
               issuer: SKIP, recipient: SKIP, attributes: SKIP, error: SKIP,
               links: SKIP, tax_statement_id: SKIP, tax_data_type: SKIP,
               forms: SKIP, pdf: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @tax_year = tax_year unless tax_year == SKIP
  @corrected = corrected unless corrected == SKIP
  @account_id =  unless  == SKIP
  @tax_form_id = tax_form_id unless tax_form_id == SKIP
  @tax_form_date = tax_form_date unless tax_form_date == SKIP
  @additional_information = additional_information unless additional_information == SKIP
  @tax_form_type = tax_form_type unless tax_form_type == SKIP
  @issuer = issuer unless issuer == SKIP
  @recipient = recipient unless recipient == SKIP
  @attributes = attributes unless attributes == SKIP
  @error = error unless error == SKIP
  @links = links unless links == SKIP
  @tax_statement_id = tax_statement_id unless tax_statement_id == SKIP
  @tax_data_type = tax_data_type unless tax_data_type == SKIP
  @forms = forms unless forms == SKIP
  @pdf = pdf unless pdf == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Long-term persistent identity of the source account. Not the account number

Returns:

  • (String)


23
24
25
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 23

def 
  @account_id
end

#additional_informationString

Additional explanation text or content about this tax form

Returns:

  • (String)


37
38
39
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 37

def additional_information
  @additional_information
end

#attributesArray[TaxFormAttribute]

Additional attributes for this tax form when defined fields are not available. Some specific additional attributes already defined by providers: Fields required by [IRS FIRE](https://www.irs.gov/e-file-providers/filing-information-returns-elec tronically-fire): Name Control, Type of Identification Number (EIN, SSN, ITIN, ATIN). (ATIN is tax ID number for pending adoptions.) Tax form provider field for taxpayer notification: Recipient Email Address.

Returns:



63
64
65
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 63

def attributes
  @attributes
end

#correctedTrueClass | FalseClass

True to indicate this is a corrected tax form

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 18

def corrected
  @corrected
end

#errorError2

Present if an error was encountered while retrieving this form

Returns:



67
68
69
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 67

def error
  @error
end

#formsArray[TaxData]

The list of data contents for all included tax forms, response should include one of forms or pdf

Returns:



87
88
89
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 87

def forms
  @forms
end

#issuerTaxParty8

Issuer's name, address, phone, and TIN. Issuer data need only be transmitted on enclosing TaxStatement, if it is the same on all its included tax forms.

Returns:



47
48
49
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 47

def issuer
  @issuer
end

Links to retrieve this form as data or image, or to invoke other APIs

Returns:



71
72
73
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 71

def links
  @links
end

#pdfBinary

PDF version of the tax statement containing all form pages, binary encoded as Base64, response should include one of pdf or forms

Returns:

  • (Binary)


92
93
94
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 92

def pdf
  @pdf
end

#recipientTaxParty1

Recipient's name, address, phone, and TIN. Recipient data need only be transmitted on enclosing TaxStatement, if it is the same on all its included tax forms.

Returns:



53
54
55
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 53

def recipient
  @recipient
end

#tax_data_typeTypeDataType2

Whether this application/json tax form response contains data in forms property (as 'JSON' format) or pdf property (as 'BASE64_PDF' format)

Returns:



82
83
84
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 82

def tax_data_type
  @tax_data_type
end

#tax_form_dateDate

Date of production or delivery of the tax form

Returns:

  • (Date)


33
34
35
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 33

def tax_form_date
  @tax_form_date
end

#tax_form_idString

Long-term persistent id for this tax form. Depending upon the data provider, this may be the same id as the enclosing tax statement id, or this may be a different id, or this id may be omitted.

Returns:

  • (String)


29
30
31
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 29

def tax_form_id
  @tax_form_id
end

#tax_form_typeTypeFormType1

Enumerated name of the tax form entity e.g. "TaxW2"

Returns:



41
42
43
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 41

def tax_form_type
  @tax_form_type
end

#tax_statement_idString

Long-term persistent id for the tax statement. Depending upon the data provider, this may be the same id as the id on the enclosed tax form(s), or this may be a different id

Returns:

  • (String)


77
78
79
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 77

def tax_statement_id
  @tax_statement_id
end

#tax_yearInteger

Year for which taxes are being paid

Returns:

  • (Integer)


14
15
16
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 14

def tax_year
  @tax_year
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 172

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tax_year = hash.key?('taxYear') ? hash['taxYear'] : SKIP
  corrected = hash.key?('corrected') ? hash['corrected'] : SKIP
   = hash.key?('accountId') ? hash['accountId'] : SKIP
  tax_form_id = hash.key?('taxFormId') ? hash['taxFormId'] : SKIP
  tax_form_date = hash.key?('taxFormDate') ? hash['taxFormDate'] : SKIP
  additional_information =
    hash.key?('additionalInformation') ? hash['additionalInformation'] : SKIP
  tax_form_type = hash.key?('taxFormType') ? hash['taxFormType'] : SKIP
  issuer = TaxParty8.from_hash(hash['issuer']) if hash['issuer']
  recipient = TaxParty1.from_hash(hash['recipient']) if hash['recipient']
  # Parameter is an array, so we need to iterate through it
  attributes = nil
  unless hash['attributes'].nil?
    attributes = []
    hash['attributes'].each do |structure|
      attributes << (TaxFormAttribute.from_hash(structure) if structure)
    end
  end

  attributes = SKIP unless hash.key?('attributes')
  error = Error2.from_hash(hash['error']) if hash['error']
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (HateoasLink.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')
  tax_statement_id =
    hash.key?('taxStatementId') ? hash['taxStatementId'] : SKIP
  tax_data_type = hash.key?('taxDataType') ? hash['taxDataType'] : SKIP
  # Parameter is an array, so we need to iterate through it
  forms = nil
  unless hash['forms'].nil?
    forms = []
    hash['forms'].each do |structure|
      forms << (TaxData.from_hash(structure) if structure)
    end
  end

  forms = SKIP unless hash.key?('forms')
  pdf = hash.key?('pdf') ? hash['pdf'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TaxStatement.new(tax_year: tax_year,
                   corrected: corrected,
                   account_id: ,
                   tax_form_id: tax_form_id,
                   tax_form_date: tax_form_date,
                   additional_information: additional_information,
                   tax_form_type: tax_form_type,
                   issuer: issuer,
                   recipient: recipient,
                   attributes: attributes,
                   error: error,
                   links: links,
                   tax_statement_id: tax_statement_id,
                   tax_data_type: tax_data_type,
                   forms: forms,
                   pdf: pdf,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 95

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tax_year'] = 'taxYear'
  @_hash['corrected'] = 'corrected'
  @_hash['account_id'] = 'accountId'
  @_hash['tax_form_id'] = 'taxFormId'
  @_hash['tax_form_date'] = 'taxFormDate'
  @_hash['additional_information'] = 'additionalInformation'
  @_hash['tax_form_type'] = 'taxFormType'
  @_hash['issuer'] = 'issuer'
  @_hash['recipient'] = 'recipient'
  @_hash['attributes'] = 'attributes'
  @_hash['error'] = 'error'
  @_hash['links'] = 'links'
  @_hash['tax_statement_id'] = 'taxStatementId'
  @_hash['tax_data_type'] = 'taxDataType'
  @_hash['forms'] = 'forms'
  @_hash['pdf'] = 'pdf'
  @_hash
end

.nullablesObject

An array for nullable fields



139
140
141
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 139

def self.nullables
  []
end

.optionalsObject

An array for optional fields



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 117

def self.optionals
  %w[
    tax_year
    corrected
    account_id
    tax_form_id
    tax_form_date
    additional_information
    tax_form_type
    issuer
    recipient
    attributes
    error
    links
    tax_statement_id
    tax_data_type
    forms
    pdf
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



262
263
264
265
266
267
268
269
270
271
272
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 262

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tax_year: #{@tax_year.inspect}, corrected: #{@corrected.inspect},"\
  " account_id: #{@account_id.inspect}, tax_form_id: #{@tax_form_id.inspect}, tax_form_date:"\
  " #{@tax_form_date.inspect}, additional_information: #{@additional_information.inspect},"\
  " tax_form_type: #{@tax_form_type.inspect}, issuer: #{@issuer.inspect}, recipient:"\
  " #{@recipient.inspect}, attributes: #{@attributes.inspect}, error: #{@error.inspect},"\
  " links: #{@links.inspect}, tax_statement_id: #{@tax_statement_id.inspect}, tax_data_type:"\
  " #{@tax_data_type.inspect}, forms: #{@forms.inspect}, pdf: #{@pdf.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



250
251
252
253
254
255
256
257
258
259
# File 'lib/fdx_v660_api/models/tax_statement.rb', line 250

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tax_year: #{@tax_year}, corrected: #{@corrected}, account_id:"\
  " #{@account_id}, tax_form_id: #{@tax_form_id}, tax_form_date: #{@tax_form_date},"\
  " additional_information: #{@additional_information}, tax_form_type: #{@tax_form_type},"\
  " issuer: #{@issuer}, recipient: #{@recipient}, attributes: #{@attributes}, error:"\
  " #{@error}, links: #{@links}, tax_statement_id: #{@tax_statement_id}, tax_data_type:"\
  " #{@tax_data_type}, forms: #{@forms}, pdf: #{@pdf}, additional_properties:"\
  " #{@additional_properties}>"
end