Class: ShellDataReportingApIs::CustomerContract

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/customer_contract.rb

Overview

CustomerContract Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(partner_id = SKIP, partner_name = SKIP) ⇒ CustomerContract

Returns a new instance of CustomerContract.



44
45
46
47
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 44

def initialize(partner_id = SKIP, partner_name = SKIP)
  @partner_id = partner_id unless partner_id == SKIP
  @partner_name = partner_name unless partner_name == SKIP
end

Instance Attribute Details

#partner_idString

Partner Id in e-TM system

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 14

def partner_id
  @partner_id
end

#partner_nameString

Partner Name in e-TM system

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 18

def partner_name
  @partner_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  partner_id = hash.key?('PartnerId') ? hash['PartnerId'] : SKIP
  partner_name = hash.key?('PartnerName') ? hash['PartnerName'] : SKIP

  # Create object from extracted values.
  CustomerContract.new(partner_id,
                       partner_name)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['partner_id'] = 'PartnerId'
  @_hash['partner_name'] = 'PartnerName'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
40
41
42
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 37

def self.nullables
  %w[
    partner_id
    partner_name
  ]
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/shell_data_reporting_ap_is/models/customer_contract.rb', line 29

def self.optionals
  %w[
    partner_id
    partner_name
  ]
end