Class: ConnectWise::ProjectPhase

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/models/project_phase.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ProjectPhase

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
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
313
314
315
316
317
318
319
320
# File 'lib/connect_wise/models/project_phase.rb', line 210

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::ProjectPhase` 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::ProjectPhase`. 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.description = attributes[:description] if attributes.key?(:description)

  self.id = attributes[:id] if attributes.key?(:id)

  self.project_id = attributes[:project_id] if attributes.key?(:project_id)

  self.board = attributes[:board] if attributes.key?(:board)

  self.status = attributes[:status] if attributes.key?(:status)

  self.agreement = attributes[:agreement] if attributes.key?(:agreement)

  self.opportunity = attributes[:opportunity] if attributes.key?(:opportunity)

  self.parent_phase = attributes[:parent_phase] if attributes.key?(:parent_phase)

  self.wbs_code = attributes[:wbs_code] if attributes.key?(:wbs_code)

  self.bill_time = attributes[:bill_time] if attributes.key?(:bill_time)

  self.bill_expenses = attributes[:bill_expenses] if attributes.key?(:bill_expenses)

  self.bill_products = attributes[:bill_products] if attributes.key?(:bill_products)

  self.mark_as_milestone_flag = attributes[:mark_as_milestone_flag] if attributes.key?(:mark_as_milestone_flag)

  self.notes = attributes[:notes] if attributes.key?(:notes)

  self.deadline_date = attributes[:deadline_date] if attributes.key?(:deadline_date)

  self.bill_separately_flag = attributes[:bill_separately_flag] if attributes.key?(:bill_separately_flag)

  self.billing_method = attributes[:billing_method] if attributes.key?(:billing_method)

  self.scheduled_hours = attributes[:scheduled_hours] if attributes.key?(:scheduled_hours)

  self.scheduled_start = attributes[:scheduled_start] if attributes.key?(:scheduled_start)

  self.scheduled_end = attributes[:scheduled_end] if attributes.key?(:scheduled_end)

  self.actual_hours = attributes[:actual_hours] if attributes.key?(:actual_hours)

  self.actual_start = attributes[:actual_start] if attributes.key?(:actual_start)

  self.actual_end = attributes[:actual_end] if attributes.key?(:actual_end)

  self.budget_hours = attributes[:budget_hours] if attributes.key?(:budget_hours)

  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.hourly_rate = attributes[:hourly_rate] if attributes.key?(:hourly_rate)

  self.billing_start_date = attributes[:billing_start_date] if attributes.key?(:billing_start_date)

  self.bill_phase_closed_flag = attributes[:bill_phase_closed_flag] if attributes.key?(:bill_phase_closed_flag)

  self.bill_project_closed_flag = attributes[:bill_project_closed_flag] if attributes.key?(:bill_project_closed_flag)

  self.downpayment = attributes[:downpayment] if attributes.key?(:downpayment)

  self.po_number = attributes[:po_number] if attributes.key?(:po_number)

  self.po_amount = attributes[:po_amount] if attributes.key?(:po_amount)

  self.estimated_time_cost = attributes[:estimated_time_cost] if attributes.key?(:estimated_time_cost)

  self.estimated_expense_cost = attributes[:estimated_expense_cost] if attributes.key?(:estimated_expense_cost)

  self.estimated_product_cost = attributes[:estimated_product_cost] if attributes.key?(:estimated_product_cost)

  self.estimated_time_revenue = attributes[:estimated_time_revenue] if attributes.key?(:estimated_time_revenue)

  self.estimated_expense_revenue = attributes[:estimated_expense_revenue] if attributes.key?(:estimated_expense_revenue)

  self.estimated_product_revenue = attributes[:estimated_product_revenue] if attributes.key?(:estimated_product_revenue)

  self.currency = attributes[:currency] if attributes.key?(:currency)

  self.bill_to_company = attributes[:bill_to_company] if attributes.key?(:bill_to_company)

  self.bill_to_contact = attributes[:bill_to_contact] if attributes.key?(:bill_to_contact)

  self.bill_to_site = attributes[:bill_to_site] if attributes.key?(:bill_to_site)

  self.ship_to_company = attributes[:ship_to_company] if attributes.key?(:ship_to_company)

  self.ship_to_contact = attributes[:ship_to_contact] if attributes.key?(:ship_to_contact)

  self.ship_to_site = attributes[:ship_to_site] if attributes.key?(:ship_to_site)

  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

#_infoObject

Returns the value of attribute _info.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def _info
  @_info
end

#actual_endObject

Returns the value of attribute actual_end.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def actual_end
  @actual_end
end

#actual_hoursObject

Returns the value of attribute actual_hours.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def actual_hours
  @actual_hours
end

#actual_startObject

Returns the value of attribute actual_start.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def actual_start
  @actual_start
end

#agreementObject

Returns the value of attribute agreement.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def agreement
  @agreement
end

#bill_expensesObject

Required On Updates;



28
29
30
# File 'lib/connect_wise/models/project_phase.rb', line 28

def bill_expenses
  @bill_expenses
end

#bill_phase_closed_flagObject

This phase can only be billed after it has been closed



37
38
39
# File 'lib/connect_wise/models/project_phase.rb', line 37

def bill_phase_closed_flag
  @bill_phase_closed_flag
end

#bill_productsObject

Required On Updates;



31
32
33
# File 'lib/connect_wise/models/project_phase.rb', line 31

def bill_products
  @bill_products
end

#bill_project_closed_flagObject

This phase can only be billed after the project has been closed



40
41
42
# File 'lib/connect_wise/models/project_phase.rb', line 40

def bill_project_closed_flag
  @bill_project_closed_flag
end

#bill_separately_flagObject

Returns the value of attribute bill_separately_flag.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def bill_separately_flag
  @bill_separately_flag
end

#bill_timeObject

Required On Updates;



25
26
27
# File 'lib/connect_wise/models/project_phase.rb', line 25

def bill_time
  @bill_time
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def bill_to_company
  @bill_to_company
end

#bill_to_contactObject

Returns the value of attribute bill_to_contact.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def bill_to_contact
  @bill_to_contact
end

#bill_to_siteObject

Returns the value of attribute bill_to_site.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def bill_to_site
  @bill_to_site
end

#billing_methodObject

billingMethod is required if the phase billSeparatelyFlag is true



34
35
36
# File 'lib/connect_wise/models/project_phase.rb', line 34

def billing_method
  @billing_method
end

#billing_start_dateObject

Returns the value of attribute billing_start_date.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def billing_start_date
  @billing_start_date
end

#boardObject

Returns the value of attribute board.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def board
  @board
end

#budget_hoursObject

Returns the value of attribute budget_hours.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def budget_hours
  @budget_hours
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def business_unit_id
  @business_unit_id
end

#currencyObject

Returns the value of attribute currency.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def currency
  @currency
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def custom_fields
  @custom_fields
end

#deadline_dateObject

Returns the value of attribute deadline_date.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def deadline_date
  @deadline_date
end

#descriptionObject

Max length: 100;



17
18
19
# File 'lib/connect_wise/models/project_phase.rb', line 17

def description
  @description
end

#downpaymentObject

Returns the value of attribute downpayment.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def downpayment
  @downpayment
end

#estimated_expense_costObject

Returns the value of attribute estimated_expense_cost.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_expense_cost
  @estimated_expense_cost
end

#estimated_expense_revenueObject

Returns the value of attribute estimated_expense_revenue.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_expense_revenue
  @estimated_expense_revenue
end

#estimated_product_costObject

Returns the value of attribute estimated_product_cost.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_product_cost
  @estimated_product_cost
end

#estimated_product_revenueObject

Returns the value of attribute estimated_product_revenue.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_product_revenue
  @estimated_product_revenue
end

#estimated_time_costObject

Returns the value of attribute estimated_time_cost.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_time_cost
  @estimated_time_cost
end

#estimated_time_revenueObject

Returns the value of attribute estimated_time_revenue.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def estimated_time_revenue
  @estimated_time_revenue
end

#hourly_rateObject

Returns the value of attribute hourly_rate.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def hourly_rate
  @hourly_rate
end

#idObject

Returns the value of attribute id.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def id
  @id
end

#location_idObject

Returns the value of attribute location_id.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def location_id
  @location_id
end

#mark_as_milestone_flagObject

Returns the value of attribute mark_as_milestone_flag.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def mark_as_milestone_flag
  @mark_as_milestone_flag
end

#notesObject

Returns the value of attribute notes.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def notes
  @notes
end

#opportunityObject

Returns the value of attribute opportunity.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def opportunity
  @opportunity
end

#parent_phaseObject

Returns the value of attribute parent_phase.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def parent_phase
  @parent_phase
end

#po_amountObject

Returns the value of attribute po_amount.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def po_amount
  @po_amount
end

#po_numberObject

Max length: 25;



43
44
45
# File 'lib/connect_wise/models/project_phase.rb', line 43

def po_number
  @po_number
end

#project_idObject

Returns the value of attribute project_id.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def project_id
  @project_id
end

#scheduled_endObject

Returns the value of attribute scheduled_end.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def scheduled_end
  @scheduled_end
end

#scheduled_hoursObject

Returns the value of attribute scheduled_hours.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def scheduled_hours
  @scheduled_hours
end

#scheduled_startObject

Returns the value of attribute scheduled_start.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def scheduled_start
  @scheduled_start
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def ship_to_company
  @ship_to_company
end

#ship_to_contactObject

Returns the value of attribute ship_to_contact.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def ship_to_contact
  @ship_to_contact
end

#ship_to_siteObject

Returns the value of attribute ship_to_site.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def ship_to_site
  @ship_to_site
end

#statusObject

Returns the value of attribute status.



19
20
21
# File 'lib/connect_wise/models/project_phase.rb', line 19

def status
  @status
end

#wbs_codeObject

Max length: 50;



22
23
24
# File 'lib/connect_wise/models/project_phase.rb', line 22

def wbs_code
  @wbs_code
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



121
122
123
# File 'lib/connect_wise/models/project_phase.rb', line 121

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
# File 'lib/connect_wise/models/project_phase.rb', line 67

def self.attribute_map
  {
    description: :description,
    id: :id,
    project_id: :projectId,
    board: :board,
    status: :status,
    agreement: :agreement,
    opportunity: :opportunity,
    parent_phase: :parentPhase,
    wbs_code: :wbsCode,
    bill_time: :billTime,
    bill_expenses: :billExpenses,
    bill_products: :billProducts,
    mark_as_milestone_flag: :markAsMilestoneFlag,
    notes: :notes,
    deadline_date: :deadlineDate,
    bill_separately_flag: :billSeparatelyFlag,
    billing_method: :billingMethod,
    scheduled_hours: :scheduledHours,
    scheduled_start: :scheduledStart,
    scheduled_end: :scheduledEnd,
    actual_hours: :actualHours,
    actual_start: :actualStart,
    actual_end: :actualEnd,
    budget_hours: :budgetHours,
    location_id: :locationId,
    business_unit_id: :businessUnitId,
    hourly_rate: :hourlyRate,
    billing_start_date: :billingStartDate,
    bill_phase_closed_flag: :billPhaseClosedFlag,
    bill_project_closed_flag: :billProjectClosedFlag,
    downpayment: :downpayment,
    po_number: :poNumber,
    po_amount: :poAmount,
    estimated_time_cost: :estimatedTimeCost,
    estimated_expense_cost: :estimatedExpenseCost,
    estimated_product_cost: :estimatedProductCost,
    estimated_time_revenue: :estimatedTimeRevenue,
    estimated_expense_revenue: :estimatedExpenseRevenue,
    estimated_product_revenue: :estimatedProductRevenue,
    currency: :currency,
    bill_to_company: :billToCompany,
    bill_to_contact: :billToContact,
    bill_to_site: :billToSite,
    ship_to_company: :shipToCompany,
    ship_to_contact: :shipToContact,
    ship_to_site: :shipToSite,
    _info: :_info,
    custom_fields: :customFields
  }
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



458
459
460
# File 'lib/connect_wise/models/project_phase.rb', line 458

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



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
# File 'lib/connect_wise/models/project_phase.rb', line 180

def self.openapi_nullable
  Set.new(%i[
            project_id
            bill_time
            bill_expenses
            bill_products
            mark_as_milestone_flag
            bill_separately_flag
            billing_method
            scheduled_hours
            actual_hours
            budget_hours
            location_id
            business_unit_id
            hourly_rate
            bill_phase_closed_flag
            bill_project_closed_flag
            downpayment
            po_amount
            estimated_time_cost
            estimated_expense_cost
            estimated_product_cost
            estimated_time_revenue
            estimated_expense_revenue
            estimated_product_revenue
          ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/connect_wise/models/project_phase.rb', line 126

def self.openapi_types
  {
    description: :String,
    id: :Integer,
    project_id: :Integer,
    board: :ProjectBoardReference,
    status: :PhaseStatusReference,
    agreement: :AgreementReference,
    opportunity: :OpportunityReference,
    parent_phase: :ProjectPhaseReference,
    wbs_code: :String,
    bill_time: :String,
    bill_expenses: :String,
    bill_products: :String,
    mark_as_milestone_flag: :Boolean,
    notes: :String,
    deadline_date: :Time,
    bill_separately_flag: :Boolean,
    billing_method: :String,
    scheduled_hours: :Float,
    scheduled_start: :String,
    scheduled_end: :String,
    actual_hours: :Float,
    actual_start: :String,
    actual_end: :String,
    budget_hours: :Float,
    location_id: :Integer,
    business_unit_id: :Integer,
    hourly_rate: :Float,
    billing_start_date: :Time,
    bill_phase_closed_flag: :Boolean,
    bill_project_closed_flag: :Boolean,
    downpayment: :Float,
    po_number: :String,
    po_amount: :Float,
    estimated_time_cost: :Float,
    estimated_expense_cost: :Float,
    estimated_product_cost: :Float,
    estimated_time_revenue: :Float,
    estimated_expense_revenue: :Float,
    estimated_product_revenue: :Float,
    currency: :CurrencyReference,
    bill_to_company: :CompanyReference,
    bill_to_contact: :ContactReference,
    bill_to_site: :SiteReference,
    ship_to_company: :CompanyReference,
    ship_to_contact: :ContactReference,
    ship_to_site: :SiteReference,
    _info: :'Hash<String, String>',
    custom_fields: :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/connect_wise/models/project_phase.rb', line 389

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    description == other.description &&
    id == other.id &&
    project_id == other.project_id &&
    board == other.board &&
    status == other.status &&
    agreement == other.agreement &&
    opportunity == other.opportunity &&
    parent_phase == other.parent_phase &&
    wbs_code == other.wbs_code &&
    bill_time == other.bill_time &&
    bill_expenses == other.bill_expenses &&
    bill_products == other.bill_products &&
    mark_as_milestone_flag == other.mark_as_milestone_flag &&
    notes == other.notes &&
    deadline_date == other.deadline_date &&
    bill_separately_flag == other.bill_separately_flag &&
    billing_method == other.billing_method &&
    scheduled_hours == other.scheduled_hours &&
    scheduled_start == other.scheduled_start &&
    scheduled_end == other.scheduled_end &&
    actual_hours == other.actual_hours &&
    actual_start == other.actual_start &&
    actual_end == other.actual_end &&
    budget_hours == other.budget_hours &&
    location_id == other.location_id &&
    business_unit_id == other.business_unit_id &&
    hourly_rate == other.hourly_rate &&
    billing_start_date == other.billing_start_date &&
    bill_phase_closed_flag == other.bill_phase_closed_flag &&
    bill_project_closed_flag == other.bill_project_closed_flag &&
    downpayment == other.downpayment &&
    po_number == other.po_number &&
    po_amount == other.po_amount &&
    estimated_time_cost == other.estimated_time_cost &&
    estimated_expense_cost == other.estimated_expense_cost &&
    estimated_product_cost == other.estimated_product_cost &&
    estimated_time_revenue == other.estimated_time_revenue &&
    estimated_expense_revenue == other.estimated_expense_revenue &&
    estimated_product_revenue == other.estimated_product_revenue &&
    currency == other.currency &&
    bill_to_company == other.bill_to_company &&
    bill_to_contact == other.bill_to_contact &&
    bill_to_site == other.bill_to_site &&
    ship_to_company == other.ship_to_company &&
    ship_to_contact == other.ship_to_contact &&
    ship_to_site == other.ship_to_site &&
    _info == other._info &&
    custom_fields == other.custom_fields
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



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/connect_wise/models/project_phase.rb', line 488

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/connect_wise/models/project_phase.rb', line 559

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



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/connect_wise/models/project_phase.rb', line 465

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


445
446
447
# File 'lib/connect_wise/models/project_phase.rb', line 445

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



451
452
453
# File 'lib/connect_wise/models/project_phase.rb', line 451

def hash
  [description, id, project_id, board, status, agreement, opportunity, parent_phase, wbs_code, bill_time, bill_expenses, bill_products, mark_as_milestone_flag, notes, deadline_date, bill_separately_flag, billing_method, scheduled_hours, scheduled_start, scheduled_end, actual_hours, actual_start, actual_end, budget_hours, location_id, business_unit_id, hourly_rate, billing_start_date, bill_phase_closed_flag, bill_project_closed_flag, downpayment, po_number, po_amount, estimated_time_cost, estimated_expense_cost, estimated_product_cost, estimated_time_revenue, estimated_expense_revenue, estimated_product_revenue, currency, bill_to_company, bill_to_contact, bill_to_site, ship_to_company, ship_to_contact, ship_to_site, _info, custom_fields].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



324
325
326
327
328
329
# File 'lib/connect_wise/models/project_phase.rb', line 324

def list_invalid_properties
  invalid_properties = []
  invalid_properties.push('invalid value for "description", description cannot be nil.') if @description.nil?

  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



535
536
537
# File 'lib/connect_wise/models/project_phase.rb', line 535

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



541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/connect_wise/models/project_phase.rb', line 541

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



529
530
531
# File 'lib/connect_wise/models/project_phase.rb', line 529

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



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/connect_wise/models/project_phase.rb', line 333

def valid?
  return false if @description.nil?

  bill_time_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge NoDefault])
  return false unless bill_time_validator.valid?(@bill_time)

  bill_expenses_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge NoDefault])
  return false unless bill_expenses_validator.valid?(@bill_expenses)

  bill_products_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge NoDefault])
  return false unless bill_products_validator.valid?(@bill_products)

  billing_method_validator = EnumAttributeValidator.new('String', %w[ActualRates FixedFee NotToExceed OverrideRate])
  return false unless billing_method_validator.valid?(@billing_method)

  true
end