Class: Merge::Crm::RemoteFieldApiResponse
- Inherits:
-
Object
- Object
- Merge::Crm::RemoteFieldApiResponse
- Defined in:
- lib/merge_ruby_client/crm/types/remote_field_api_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
- #account ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #contact ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #engagement ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #lead ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #note ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #opportunity ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #stage ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #task ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
- #user ⇒ Array<Merge::Crm::RemoteFieldApi> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::RemoteFieldApiResponse
Deserialize a JSON object to an instance of RemoteFieldApiResponse.
-
.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.
Instance Method Summary collapse
- #initialize(account: OMIT, contact: OMIT, lead: OMIT, note: OMIT, opportunity: OMIT, stage: OMIT, user: OMIT, task: OMIT, engagement: OMIT, additional_properties: nil) ⇒ Merge::Crm::RemoteFieldApiResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RemoteFieldApiResponse to a JSON object.
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::RemoteFieldApiResponse
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/remote_field_api_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 = account if account != 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": 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
#account ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 11 def account @account end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
29 30 31 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 29 def additional_properties @additional_properties end |
#contact ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 13 def contact @contact end |
#engagement ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 27 def engagement @engagement end |
#lead ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 15 def lead @lead end |
#note ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 17 def note @note end |
#opportunity ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
19 20 21 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 19 def opportunity @opportunity end |
#stage ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 21 def stage @stage end |
#task ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 25 def task @task end |
#user ⇒ Array<Merge::Crm::RemoteFieldApi> (readonly)
23 24 25 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 23 def user @user end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::RemoteFieldApiResponse
Deserialize a JSON object to an instance of RemoteFieldApiResponse
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/remote_field_api_response.rb', line 78 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) account = parsed_json["Account"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end contact = parsed_json["Contact"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end lead = parsed_json["Lead"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end note = parsed_json["Note"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end opportunity = parsed_json["Opportunity"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end stage = parsed_json["Stage"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end user = parsed_json["User"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end task = parsed_json["Task"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end engagement = parsed_json["Engagement"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldApi.from_json(json_object: item) end new( account: 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.
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 144 def self.validate_raw(obj:) obj.account&.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 RemoteFieldApiResponse to a JSON object
134 135 136 |
# File 'lib/merge_ruby_client/crm/types/remote_field_api_response.rb', line 134 def to_json(*_args) @_field_set&.to_json end |