Class: TripletexApi::CustomerTripletexAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_api/models/customer_tripletex_account.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CustomerTripletexAccount

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 116

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'administrator')
    self.administrator = attributes[:'administrator']
  end

  if attributes.has_key?(:'customerId')
    self.customer_id = attributes[:'customerId']
  end

  if attributes.has_key?(:'accountType')
    self. = attributes[:'accountType']
  end

  if attributes.has_key?(:'modules')
    self.modules = attributes[:'modules']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'sendEmails')
    self.send_emails = attributes[:'sendEmails']
  else
    self.send_emails = false
  end

  if attributes.has_key?(:'autoValidateUserLogin')
    self. = attributes[:'autoValidateUserLogin']
  else
    self. = false
  end

  if attributes.has_key?(:'createApiToken')
    self.create_api_token = attributes[:'createApiToken']
  else
    self.create_api_token = false
  end

  if attributes.has_key?(:'sendInvoiceToCustomer')
    self.send_invoice_to_customer = attributes[:'sendInvoiceToCustomer']
  else
    self.send_invoice_to_customer = false
  end

  if attributes.has_key?(:'customerInvoiceEmail')
    self.customer_invoice_email = attributes[:'customerInvoiceEmail']
  end

  if attributes.has_key?(:'numberOfEmployees')
    self.number_of_employees = attributes[:'numberOfEmployees']
  end

  if attributes.has_key?(:'numberOfVouchers')
    self.number_of_vouchers = attributes[:'numberOfVouchers']
  end

  if attributes.has_key?(:'administratorPassword')
    self.administrator_password = attributes[:'administratorPassword']
  end

end

Instance Attribute Details

#account_typeObject

Returns the value of attribute account_type.



24
25
26
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 24

def 
  @account_type
end

#administratorObject

Administrator user to create in the new company. Leave empty if calling this enpoint as an auditor og accountant company



19
20
21
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 19

def administrator
  @administrator
end

#administrator_passwordObject

The password of the administrator user.



52
53
54
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 52

def administrator_password
  @administrator_password
end

#auto_validate_user_loginObject

Should the user be automatically validated?



34
35
36
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 34

def 
  @auto_validate_user_login
end

#create_api_tokenObject

Creates a token for the admin user. The accounting office could also use their tokens so you might not need this.



37
38
39
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 37

def create_api_token
  @create_api_token
end

#customer_idObject

The customer id to an already created customer to create a Tripletex account for.



22
23
24
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 22

def customer_id
  @customer_id
end

#customer_invoice_emailObject

The address to send the invoice to at the customer.



43
44
45
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 43

def customer_invoice_email
  @customer_invoice_email
end

#modulesObject

Returns the value of attribute modules.



26
27
28
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 26

def modules
  @modules
end

#number_of_employeesObject

The number of employees in the customer company. Is used for calculating prices and setting some default settings, i.e. approval settings for timesheet.



46
47
48
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 46

def number_of_employees
  @number_of_employees
end

#number_of_vouchersObject

Number of vouchers each year. Used to calculate prices.



49
50
51
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 49

def number_of_vouchers
  @number_of_vouchers
end

#send_emailsObject

Should the emails normally sent during creation be sent in this case?



31
32
33
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 31

def send_emails
  @send_emails
end

#send_invoice_to_customerObject

Should the invoices for this account be sent to the customer?



40
41
42
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 40

def send_invoice_to_customer
  @send_invoice_to_customer
end

#typeObject

Returns the value of attribute type.



28
29
30
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 28

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 77

def self.attribute_map
  {
    :'administrator' => :'administrator',
    :'customer_id' => :'customerId',
    :'account_type' => :'accountType',
    :'modules' => :'modules',
    :'type' => :'type',
    :'send_emails' => :'sendEmails',
    :'auto_validate_user_login' => :'autoValidateUserLogin',
    :'create_api_token' => :'createApiToken',
    :'send_invoice_to_customer' => :'sendInvoiceToCustomer',
    :'customer_invoice_email' => :'customerInvoiceEmail',
    :'number_of_employees' => :'numberOfEmployees',
    :'number_of_vouchers' => :'numberOfVouchers',
    :'administrator_password' => :'administratorPassword'
  }
end

.swagger_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 96

def self.swagger_types
  {
    :'administrator' => :'Employee',
    :'customer_id' => :'Integer',
    :'account_type' => :'String',
    :'modules' => :'Modules',
    :'type' => :'String',
    :'send_emails' => :'BOOLEAN',
    :'auto_validate_user_login' => :'BOOLEAN',
    :'create_api_token' => :'BOOLEAN',
    :'send_invoice_to_customer' => :'BOOLEAN',
    :'customer_invoice_email' => :'String',
    :'number_of_employees' => :'Integer',
    :'number_of_vouchers' => :'String',
    :'administrator_password' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 271

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      administrator == o.administrator &&
      customer_id == o.customer_id &&
       == o. &&
      modules == o.modules &&
      type == o.type &&
      send_emails == o.send_emails &&
       == o. &&
      create_api_token == o.create_api_token &&
      send_invoice_to_customer == o.send_invoice_to_customer &&
      customer_invoice_email == o.customer_invoice_email &&
      number_of_employees == o.number_of_employees &&
      number_of_vouchers == o.number_of_vouchers &&
      administrator_password == o.administrator_password
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 325

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = TripletexApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 391

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 304

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


291
292
293
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 291

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



297
298
299
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 297

def hash
  [administrator, customer_id, , modules, type, send_emails, , create_api_token, send_invoice_to_customer, customer_invoice_email, number_of_employees, number_of_vouchers, administrator_password].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 186

def list_invalid_properties
  invalid_properties = Array.new
  if !@customer_id.nil? && @customer_id < 1
    invalid_properties.push("invalid value for 'customer_id', must be greater than or equal to 1.")
  end

  if @account_type.nil?
    invalid_properties.push("invalid value for 'account_type', account_type cannot be nil.")
  end

  if @modules.nil?
    invalid_properties.push("invalid value for 'modules', modules cannot be nil.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  if @number_of_vouchers.nil?
    invalid_properties.push("invalid value for 'number_of_vouchers', number_of_vouchers cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



371
372
373
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 371

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



377
378
379
380
381
382
383
384
385
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 377

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



365
366
367
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 365

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/tripletex_api/models/customer_tripletex_account.rb', line 213

def valid?
  return false if !@customer_id.nil? && @customer_id < 1
  return false if @account_type.nil?
   = EnumAttributeValidator.new('String', ["TEST", "PAYING"])
  return false unless .valid?(@account_type)
  return false if @modules.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["NONE", "ENK", "AS", "NUF", "ANS", "DA", "PRE", "KS", "ASA", "BBL", "BRL", "GFS", "SPA", "SF", "IKS", "KF_FKF", "FCD", "EOFG", "BA", "STI", "ORG", "ESEK", "SA", "SAM", "BO", "VPFO", "OS", "Other"])
  return false unless type_validator.valid?(@type)
  return false if @number_of_vouchers.nil?
  number_of_vouchers_validator = EnumAttributeValidator.new('String', ["INTERVAL_0_100", "INTERVAL_101_500", "INTERVAL_0_500", "INTERVAL_501_1000", "INTERVAL_1001_2000", "INTERVAL_2001_3500", "INTERVAL_3501_5000", "INTERVAL_5001_10000", "INTERVAL_UNLIMITED"])
  return false unless number_of_vouchers_validator.valid?(@number_of_vouchers)
  return true
end