Class: ConnectWise::ExpenseEntry
- Inherits:
-
Object
- Object
- ConnectWise::ExpenseEntry
- Defined in:
- lib/connect_wise/models/expense_entry.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Returns the value of attribute _info.
-
#agreement ⇒ Object
Returns the value of attribute agreement.
-
#agreement_amount ⇒ Object
Returns the value of attribute agreement_amount.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#bill_amount ⇒ Object
Returns the value of attribute bill_amount.
-
#billable_option ⇒ Object
Returns the value of attribute billable_option.
-
#business_unit_id ⇒ Object
Returns the value of attribute business_unit_id.
-
#charge_to_id ⇒ Object
Returns the value of attribute charge_to_id.
-
#charge_to_type ⇒ Object
Company or chargeToType is required.
-
#classification ⇒ Object
Returns the value of attribute classification.
-
#company ⇒ Object
Returns the value of attribute company.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
-
#date ⇒ Object
Returns the value of attribute date.
-
#expense_report ⇒ Object
Returns the value of attribute expense_report.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invoice ⇒ Object
Returns the value of attribute invoice.
-
#invoice_amount ⇒ Object
Returns the value of attribute invoice_amount.
-
#location_id ⇒ Object
Returns the value of attribute location_id.
-
#member ⇒ Object
Returns the value of attribute member.
-
#mobile_guid ⇒ Object
Returns the value of attribute mobile_guid.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#odometer_end ⇒ Object
Returns the value of attribute odometer_end.
-
#odometer_start ⇒ Object
Returns the value of attribute odometer_start.
-
#payment_method ⇒ Object
Returns the value of attribute payment_method.
-
#phase ⇒ Object
Returns the value of attribute phase.
-
#project ⇒ Object
Returns the value of attribute project.
-
#status ⇒ Object
Returns the value of attribute status.
-
#taxes ⇒ Object
Returns the value of attribute taxes.
-
#ticket ⇒ Object
Returns the value of attribute ticket.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ExpenseEntry
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ExpenseEntry
Initializes the object
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 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 |
# File 'lib/connect_wise/models/expense_entry.rb', line 142 def initialize(attributes = {}) raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::ExpenseEntry` initialize method' unless attributes.is_a?(Hash) # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| raise ArgumentError, "`#{k}` is not a valid attribute in `ConnectWise::ExpenseEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym) h[k.to_sym] = v end self.amount = attributes[:amount] if attributes.key?(:amount) self.date = attributes[:date] if attributes.key?(:date) self.id = attributes[:id] if attributes.key?(:id) self.expense_report = attributes[:expense_report] if attributes.key?(:expense_report) self.company = attributes[:company] if attributes.key?(:company) self.charge_to_id = attributes[:charge_to_id] if attributes.key?(:charge_to_id) self.charge_to_type = attributes[:charge_to_type] if attributes.key?(:charge_to_type) self.type = attributes[:type] if attributes.key?(:type) self.member = attributes[:member] if attributes.key?(:member) self.payment_method = attributes[:payment_method] if attributes.key?(:payment_method) self.classification = attributes[:classification] if attributes.key?(:classification) self.billable_option = attributes[:billable_option] if attributes.key?(:billable_option) self.location_id = attributes[:location_id] if attributes.key?(:location_id) self.business_unit_id = attributes[:business_unit_id] if attributes.key?(:business_unit_id) self.notes = attributes[:notes] if attributes.key?(:notes) self.agreement = attributes[:agreement] if attributes.key?(:agreement) self.invoice_amount = attributes[:invoice_amount] if attributes.key?(:invoice_amount) self.mobile_guid = attributes[:mobile_guid] if attributes.key?(:mobile_guid) if attributes.key?(:taxes) && (value = attributes[:taxes]).is_a?(Array) self.taxes = value end self.invoice = attributes[:invoice] if attributes.key?(:invoice) self.currency = attributes[:currency] if attributes.key?(:currency) self.status = attributes[:status] if attributes.key?(:status) self.bill_amount = attributes[:bill_amount] if attributes.key?(:bill_amount) self.agreement_amount = attributes[:agreement_amount] if attributes.key?(:agreement_amount) self.odometer_start = attributes[:odometer_start] if attributes.key?(:odometer_start) self.odometer_end = attributes[:odometer_end] if attributes.key?(:odometer_end) self.ticket = attributes[:ticket] if attributes.key?(:ticket) self.project = attributes[:project] if attributes.key?(:project) self.phase = attributes[:phase] if attributes.key?(:phase) if attributes.key?(:_info) && (value = attributes[:_info]).is_a?(Hash) self._info = value end return unless attributes.key?(:custom_fields) return unless (value = attributes[:custom_fields]).is_a?(Array) self.custom_fields = value end |
Instance Attribute Details
#_info ⇒ Object
Returns the value of attribute _info.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def _info @_info end |
#agreement ⇒ Object
Returns the value of attribute agreement.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def agreement @agreement end |
#agreement_amount ⇒ Object
Returns the value of attribute agreement_amount.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def agreement_amount @agreement_amount end |
#amount ⇒ Object
Returns the value of attribute amount.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def amount @amount end |
#bill_amount ⇒ Object
Returns the value of attribute bill_amount.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def bill_amount @bill_amount end |
#billable_option ⇒ Object
Returns the value of attribute billable_option.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def billable_option @billable_option end |
#business_unit_id ⇒ Object
Returns the value of attribute business_unit_id.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def business_unit_id @business_unit_id end |
#charge_to_id ⇒ Object
Returns the value of attribute charge_to_id.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def charge_to_id @charge_to_id end |
#charge_to_type ⇒ Object
Company or chargeToType is required
19 20 21 |
# File 'lib/connect_wise/models/expense_entry.rb', line 19 def charge_to_type @charge_to_type end |
#classification ⇒ Object
Returns the value of attribute classification.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def classification @classification end |
#company ⇒ Object
Returns the value of attribute company.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def company @company end |
#currency ⇒ Object
Returns the value of attribute currency.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def currency @currency end |
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def custom_fields @custom_fields end |
#date ⇒ Object
Returns the value of attribute date.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def date @date end |
#expense_report ⇒ Object
Returns the value of attribute expense_report.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def expense_report @expense_report end |
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def id @id end |
#invoice ⇒ Object
Returns the value of attribute invoice.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def invoice @invoice end |
#invoice_amount ⇒ Object
Returns the value of attribute invoice_amount.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def invoice_amount @invoice_amount end |
#location_id ⇒ Object
Returns the value of attribute location_id.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def location_id @location_id end |
#member ⇒ Object
Returns the value of attribute member.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def member @member end |
#mobile_guid ⇒ Object
Returns the value of attribute mobile_guid.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def mobile_guid @mobile_guid end |
#notes ⇒ Object
Returns the value of attribute notes.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def notes @notes end |
#odometer_end ⇒ Object
Returns the value of attribute odometer_end.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def odometer_end @odometer_end end |
#odometer_start ⇒ Object
Returns the value of attribute odometer_start.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def odometer_start @odometer_start end |
#payment_method ⇒ Object
Returns the value of attribute payment_method.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def payment_method @payment_method end |
#phase ⇒ Object
Returns the value of attribute phase.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def phase @phase end |
#project ⇒ Object
Returns the value of attribute project.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def project @project end |
#status ⇒ Object
Returns the value of attribute status.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def status @status end |
#taxes ⇒ Object
Returns the value of attribute taxes.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def taxes @taxes end |
#ticket ⇒ Object
Returns the value of attribute ticket.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def ticket @ticket end |
#type ⇒ Object
Returns the value of attribute type.
16 17 18 |
# File 'lib/connect_wise/models/expense_entry.rb', line 16 def type @type end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
80 81 82 |
# File 'lib/connect_wise/models/expense_entry.rb', line 80 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/connect_wise/models/expense_entry.rb', line 43 def self.attribute_map { amount: :amount, date: :date, id: :id, expense_report: :expenseReport, company: :company, charge_to_id: :chargeToId, charge_to_type: :chargeToType, type: :type, member: :member, payment_method: :paymentMethod, classification: :classification, billable_option: :billableOption, location_id: :locationId, business_unit_id: :businessUnitId, notes: :notes, agreement: :agreement, invoice_amount: :invoiceAmount, mobile_guid: :mobileGuid, taxes: :taxes, invoice: :invoice, currency: :currency, status: :status, bill_amount: :billAmount, agreement_amount: :agreementAmount, odometer_start: :odometerStart, odometer_end: :odometerEnd, ticket: :ticket, project: :project, phase: :phase, _info: :_info, custom_fields: :customFields } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
329 330 331 |
# File 'lib/connect_wise/models/expense_entry.rb', line 329 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/connect_wise/models/expense_entry.rb', line 122 def self.openapi_nullable Set.new(i[ amount charge_to_id charge_to_type billable_option location_id business_unit_id invoice_amount mobile_guid status bill_amount agreement_amount odometer_start odometer_end ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/connect_wise/models/expense_entry.rb', line 85 def self.openapi_types { amount: :Float, date: :Time, id: :Integer, expense_report: :ExpenseReportReference, company: :CompanyReference, charge_to_id: :Integer, charge_to_type: :String, type: :ExpenseTypeReference, member: :MemberReference, payment_method: :PaymentMethodReference, classification: :ClassificationReference, billable_option: :String, location_id: :Integer, business_unit_id: :Integer, notes: :String, agreement: :AgreementReference, invoice_amount: :Float, mobile_guid: :String, taxes: :'Array<ExpenseTax>', invoice: :InvoiceReference, currency: :CurrencyReference, status: :String, bill_amount: :Float, agreement_amount: :Float, odometer_start: :Float, odometer_end: :Float, ticket: :TicketReference, project: :ProjectReference, phase: :ProjectPhaseReference, _info: :'Hash<String, String>', custom_fields: :'Array<CustomFieldValue>' } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/connect_wise/models/expense_entry.rb', line 277 def ==(other) return true if equal?(other) self.class == other.class && amount == other.amount && date == other.date && id == other.id && expense_report == other.expense_report && company == other.company && charge_to_id == other.charge_to_id && charge_to_type == other.charge_to_type && type == other.type && member == other.member && payment_method == other.payment_method && classification == other.classification && billable_option == other.billable_option && location_id == other.location_id && business_unit_id == other.business_unit_id && notes == other.notes && agreement == other.agreement && invoice_amount == other.invoice_amount && mobile_guid == other.mobile_guid && taxes == other.taxes && invoice == other.invoice && currency == other.currency && status == other.status && bill_amount == other.bill_amount && agreement_amount == other.agreement_amount && odometer_start == other.odometer_start && odometer_end == other.odometer_end && ticket == other.ticket && project == other.project && phase == other.phase && _info == other._info && custom_fields == other.custom_fields end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/connect_wise/models/expense_entry.rb', line 359 def _deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = ConnectWise.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/connect_wise/models/expense_entry.rb', line 430 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
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/connect_wise/models/expense_entry.rb', line 336 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array) elsif !attributes[self.class.attribute_map[key]].nil? send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(other) ⇒ Boolean
316 317 318 |
# File 'lib/connect_wise/models/expense_entry.rb', line 316 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
322 323 324 |
# File 'lib/connect_wise/models/expense_entry.rb', line 322 def hash [amount, date, id, expense_report, company, charge_to_id, charge_to_type, type, member, payment_method, classification, billable_option, location_id, business_unit_id, notes, agreement, invoice_amount, mobile_guid, taxes, invoice, currency, status, bill_amount, agreement_amount, odometer_start, odometer_end, ticket, project, phase, _info, custom_fields].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
224 225 226 227 228 229 |
# File 'lib/connect_wise/models/expense_entry.rb', line 224 def list_invalid_properties invalid_properties = [] invalid_properties.push('invalid value for "date", date cannot be nil.') if @date.nil? invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
406 407 408 |
# File 'lib/connect_wise/models/expense_entry.rb', line 406 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/connect_wise/models/expense_entry.rb', line 412 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
400 401 402 |
# File 'lib/connect_wise/models/expense_entry.rb', line 400 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/connect_wise/models/expense_entry.rb', line 233 def valid? return false if @date.nil? charge_to_type_validator = EnumAttributeValidator.new('String', %w[ServiceTicket ProjectTicket ChargeCode Activity]) return false unless charge_to_type_validator.valid?(@charge_to_type) billable_option_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge NoDefault]) return false unless billable_option_validator.valid?(@billable_option) status_validator = EnumAttributeValidator.new('String', %w[Open Rejected PendingApproval ErrorsCorrected PendingProjectApproval ApprovedByTierOne RejectBySecondTier ApprovedByTierTwo ReadyToBill Billed WrittenOff BilledAgreement]) return false unless status_validator.valid?(@status) true end |