Class: Merge::Crm::FieldMappingApiInstanceResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account: OMIT, contact: OMIT, lead: OMIT, note: OMIT, opportunity: OMIT, stage: OMIT, user: OMIT, task: OMIT, engagement: OMIT, additional_properties: nil) ⇒ Merge::Crm::FieldMappingApiInstanceResponse

Parameters:



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
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 47

def initialize(account: OMIT, contact: OMIT, lead: OMIT, note: OMIT, opportunity: OMIT, stage: OMIT, user: OMIT,
               task: OMIT, engagement: OMIT, additional_properties: nil)
  @account =  if  != OMIT
  @contact = contact if contact != OMIT
  @lead = lead if lead != OMIT
  @note = note if note != OMIT
  @opportunity = opportunity if opportunity != OMIT
  @stage = stage if stage != OMIT
  @user = user if user != OMIT
  @task = task if task != OMIT
  @engagement = engagement if engagement != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "Account": ,
    "Contact": contact,
    "Lead": lead,
    "Note": note,
    "Opportunity": opportunity,
    "Stage": stage,
    "User": user,
    "Task": task,
    "Engagement": engagement
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accountArray<Merge::Crm::FieldMappingApiInstance> (readonly)



11
12
13
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 11

def 
  @account
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



29
30
31
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 29

def additional_properties
  @additional_properties
end

#contactArray<Merge::Crm::FieldMappingApiInstance> (readonly)



13
14
15
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 13

def contact
  @contact
end

#engagementArray<Merge::Crm::FieldMappingApiInstance> (readonly)



27
28
29
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 27

def engagement
  @engagement
end

#leadArray<Merge::Crm::FieldMappingApiInstance> (readonly)



15
16
17
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 15

def lead
  @lead
end

#noteArray<Merge::Crm::FieldMappingApiInstance> (readonly)



17
18
19
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 17

def note
  @note
end

#opportunityArray<Merge::Crm::FieldMappingApiInstance> (readonly)



19
20
21
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 19

def opportunity
  @opportunity
end

#stageArray<Merge::Crm::FieldMappingApiInstance> (readonly)



21
22
23
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 21

def stage
  @stage
end

#taskArray<Merge::Crm::FieldMappingApiInstance> (readonly)



25
26
27
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 25

def task
  @task
end

#userArray<Merge::Crm::FieldMappingApiInstance> (readonly)



23
24
25
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 23

def user
  @user
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Crm::FieldMappingApiInstanceResponse

Deserialize a JSON object to an instance of FieldMappingApiInstanceResponse

Parameters:

  • json_object (String)

Returns:



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
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 78

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
   = parsed_json["Account"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  contact = parsed_json["Contact"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  lead = parsed_json["Lead"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  note = parsed_json["Note"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  opportunity = parsed_json["Opportunity"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  stage = parsed_json["Stage"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  user = parsed_json["User"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  task = parsed_json["Task"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  engagement = parsed_json["Engagement"]&.map do |item|
    item = item.to_json
    Merge::Crm::FieldMappingApiInstance.from_json(json_object: item)
  end
  new(
    account: ,
    contact: contact,
    lead: lead,
    note: note,
    opportunity: opportunity,
    stage: stage,
    user: user,
    task: task,
    engagement: engagement,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


144
145
146
147
148
149
150
151
152
153
154
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 144

def self.validate_raw(obj:)
  obj.&.is_a?(Array) != false || raise("Passed value for field obj.account is not the expected type, validation failed.")
  obj.contact&.is_a?(Array) != false || raise("Passed value for field obj.contact is not the expected type, validation failed.")
  obj.lead&.is_a?(Array) != false || raise("Passed value for field obj.lead is not the expected type, validation failed.")
  obj.note&.is_a?(Array) != false || raise("Passed value for field obj.note is not the expected type, validation failed.")
  obj.opportunity&.is_a?(Array) != false || raise("Passed value for field obj.opportunity is not the expected type, validation failed.")
  obj.stage&.is_a?(Array) != false || raise("Passed value for field obj.stage is not the expected type, validation failed.")
  obj.user&.is_a?(Array) != false || raise("Passed value for field obj.user is not the expected type, validation failed.")
  obj.task&.is_a?(Array) != false || raise("Passed value for field obj.task is not the expected type, validation failed.")
  obj.engagement&.is_a?(Array) != false || raise("Passed value for field obj.engagement is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FieldMappingApiInstanceResponse to a JSON object

Returns:

  • (String)


134
135
136
# File 'lib/merge_ruby_client/crm/types/field_mapping_api_instance_response.rb', line 134

def to_json(*_args)
  @_field_set&.to_json
end