merge_crm_client 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/docs/Contact.md +3 -3
- data/docs/ContactRequest.md +6 -0
- data/docs/OpportunitiesApi.md +154 -0
- data/docs/PatchedOpportunityEndpointRequest.md +18 -0
- data/docs/PatchedOpportunityRequest.md +40 -0
- data/docs/RemoteResponse.md +3 -1
- data/docs/ResponseTypeEnum.md +15 -0
- data/docs/SyncStatus.md +2 -2
- data/lib/merge_crm_client/api/opportunities_api.rb +148 -0
- data/lib/merge_crm_client/models/account_request.rb +2 -2
- data/lib/merge_crm_client/models/contact_request.rb +36 -3
- data/lib/merge_crm_client/models/data_passthrough_request.rb +1 -1
- data/lib/merge_crm_client/models/engagement_request.rb +2 -2
- data/lib/merge_crm_client/models/issue.rb +1 -1
- data/lib/merge_crm_client/models/issue_status_enum.rb +1 -1
- data/lib/merge_crm_client/models/lead_request.rb +2 -2
- data/lib/merge_crm_client/models/meta_response.rb +1 -1
- data/lib/merge_crm_client/models/note_request.rb +2 -2
- data/lib/merge_crm_client/models/opportunity_request.rb +2 -2
- data/lib/merge_crm_client/models/patched_opportunity_endpoint_request.rb +223 -0
- data/lib/merge_crm_client/models/patched_opportunity_request.rb +365 -0
- data/lib/merge_crm_client/models/remote_response.rb +14 -11
- data/lib/merge_crm_client/models/response_type_enum.rb +45 -0
- data/lib/merge_crm_client/models/sync_status.rb +0 -10
- data/lib/merge_crm_client/version.rb +1 -1
- data/lib/merge_crm_client.rb +3 -0
- data/spec/api/contacts_api_spec.rb +1 -13
- data/spec/api/opportunities_api_spec.rb +26 -0
- data/spec/models/contact_request_spec.rb +18 -0
- data/spec/models/issue_status_enum_spec.rb +0 -7
- data/spec/models/patched_opportunity_endpoint_request_spec.rb +34 -0
- data/spec/models/patched_opportunity_request_spec.rb +100 -0
- data/spec/models/remote_response_spec.rb +6 -0
- data/spec/models/response_type_enum_spec.rb +28 -0
- metadata +100 -88
@@ -53,7 +53,7 @@ module MergeCRMClient
|
|
53
53
|
:'id' => :'String',
|
54
54
|
:'status' => :'IssueStatusEnum',
|
55
55
|
:'error_description' => :'String',
|
56
|
-
:'end_user' => :'Hash<String,
|
56
|
+
:'end_user' => :'Hash<String, Object>',
|
57
57
|
:'first_incident_time' => :'Time',
|
58
58
|
:'last_incident_time' => :'Time',
|
59
59
|
:'is_muted' => :'Boolean'
|
@@ -28,7 +28,7 @@ module MergeCRMClient
|
|
28
28
|
# @return [String] The enum value
|
29
29
|
def build_from_hash(value)
|
30
30
|
@raw_value = value
|
31
|
-
if ["ONGOING", "RESOLVED"].include? value
|
31
|
+
if ["ONGOING", "RESOLVED", ].include? value
|
32
32
|
@value = value
|
33
33
|
else
|
34
34
|
@value = MERGE_NONSTANDARD_VALUE
|
@@ -93,8 +93,8 @@ module MergeCRMClient
|
|
93
93
|
:'converted_date' => :'Time',
|
94
94
|
:'converted_contact' => :'String',
|
95
95
|
:'converted_account' => :'String',
|
96
|
-
:'integration_params' => :'Hash<String,
|
97
|
-
:'linked_account_params' => :'Hash<String,
|
96
|
+
:'integration_params' => :'Hash<String, Object>',
|
97
|
+
:'linked_account_params' => :'Hash<String, Object>'
|
98
98
|
}
|
99
99
|
end
|
100
100
|
|
@@ -41,7 +41,7 @@ module MergeCRMClient
|
|
41
41
|
# Attribute type mapping.
|
42
42
|
def self.openapi_types
|
43
43
|
{
|
44
|
-
:'request_schema' => :'Hash<String,
|
44
|
+
:'request_schema' => :'Hash<String, Object>',
|
45
45
|
:'status' => :'LinkedAccountStatus',
|
46
46
|
:'has_conditional_params' => :'Boolean',
|
47
47
|
:'has_required_linked_account_params' => :'Boolean'
|
@@ -72,8 +72,8 @@ module MergeCRMClient
|
|
72
72
|
:'opportunity' => :'String',
|
73
73
|
:'remote_updated_at' => :'Time',
|
74
74
|
:'remote_created_at' => :'Time',
|
75
|
-
:'integration_params' => :'Hash<String,
|
76
|
-
:'linked_account_params' => :'Hash<String,
|
75
|
+
:'integration_params' => :'Hash<String, Object>',
|
76
|
+
:'linked_account_params' => :'Hash<String, Object>'
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
@@ -88,8 +88,8 @@ module MergeCRMClient
|
|
88
88
|
:'last_activity_at' => :'Time',
|
89
89
|
:'close_date' => :'Time',
|
90
90
|
:'remote_created_at' => :'Time',
|
91
|
-
:'integration_params' => :'Hash<String,
|
92
|
-
:'linked_account_params' => :'Hash<String,
|
91
|
+
:'integration_params' => :'Hash<String, Object>',
|
92
|
+
:'linked_account_params' => :'Hash<String, Object>'
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
@@ -0,0 +1,223 @@
|
|
1
|
+
=begin
|
2
|
+
#Merge CRM API
|
3
|
+
|
4
|
+
#The unified API for building rich integrations with multiple CRM platforms.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: hello@merge.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MergeCRMClient
|
17
|
+
class PatchedOpportunityEndpointRequest
|
18
|
+
attr_accessor :model
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'model' => :'model'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'model' => :'PatchedOpportunityRequest'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeCRMClient::PatchedOpportunityEndpointRequest` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeCRMClient::PatchedOpportunityEndpointRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'model')
|
61
|
+
self.model = attributes[:'model']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if @model.nil?
|
70
|
+
invalid_properties.push('invalid value for "model", model cannot be nil.')
|
71
|
+
end
|
72
|
+
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if @model.nil?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
model == o.model
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[model].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
+
self.send("#{key}=", nil)
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def _deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :Boolean
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
when :Object
|
155
|
+
# generic object (usually a Hash), return directly
|
156
|
+
value
|
157
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
+
inner_type = Regexp.last_match[:inner_type]
|
159
|
+
value.map { |v| _deserialize(inner_type, v) }
|
160
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
+
k_type = Regexp.last_match[:k_type]
|
162
|
+
v_type = Regexp.last_match[:v_type]
|
163
|
+
{}.tap do |hash|
|
164
|
+
value.each do |k, v|
|
165
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
else # model
|
169
|
+
# models (e.g. Pet) or oneOf
|
170
|
+
klass = MergeCRMClient.const_get(type)
|
171
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
if value.nil?
|
194
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
+
end
|
197
|
+
|
198
|
+
hash[param] = _to_hash(value)
|
199
|
+
end
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map { |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to? :to_hash
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -0,0 +1,365 @@
|
|
1
|
+
=begin
|
2
|
+
#Merge CRM API
|
3
|
+
|
4
|
+
#The unified API for building rich integrations with multiple CRM platforms.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: hello@merge.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MergeCRMClient
|
17
|
+
# # The Opportunity Object ### Description The `Opportunity` object is used to represent an opportunity in the remote system. ### Usage Example TODO
|
18
|
+
class PatchedOpportunityRequest
|
19
|
+
# The opportunity's name.
|
20
|
+
attr_accessor :name
|
21
|
+
|
22
|
+
# The opportunity's description.
|
23
|
+
attr_accessor :description
|
24
|
+
|
25
|
+
# The opportunity's amount.
|
26
|
+
attr_accessor :amount
|
27
|
+
|
28
|
+
attr_accessor :owner
|
29
|
+
|
30
|
+
attr_accessor :account
|
31
|
+
|
32
|
+
attr_accessor :stage
|
33
|
+
|
34
|
+
# The opportunity's status.
|
35
|
+
attr_accessor :status
|
36
|
+
|
37
|
+
# When the opportunity's last activity occurred.
|
38
|
+
attr_accessor :last_activity_at
|
39
|
+
|
40
|
+
# When the opportunity was closed.
|
41
|
+
attr_accessor :close_date
|
42
|
+
|
43
|
+
# When the third party's opportunity was created.
|
44
|
+
attr_accessor :remote_created_at
|
45
|
+
|
46
|
+
attr_accessor :integration_params
|
47
|
+
|
48
|
+
attr_accessor :linked_account_params
|
49
|
+
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
51
|
+
def self.attribute_map
|
52
|
+
{
|
53
|
+
:'name' => :'name',
|
54
|
+
:'description' => :'description',
|
55
|
+
:'amount' => :'amount',
|
56
|
+
:'owner' => :'owner',
|
57
|
+
:'account' => :'account',
|
58
|
+
:'stage' => :'stage',
|
59
|
+
:'status' => :'status',
|
60
|
+
:'last_activity_at' => :'last_activity_at',
|
61
|
+
:'close_date' => :'close_date',
|
62
|
+
:'remote_created_at' => :'remote_created_at',
|
63
|
+
:'integration_params' => :'integration_params',
|
64
|
+
:'linked_account_params' => :'linked_account_params'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns all the JSON keys this model knows about
|
69
|
+
def self.acceptable_attributes
|
70
|
+
attribute_map.values
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.openapi_types
|
75
|
+
{
|
76
|
+
:'name' => :'String',
|
77
|
+
:'description' => :'String',
|
78
|
+
:'amount' => :'Integer',
|
79
|
+
:'owner' => :'String',
|
80
|
+
:'account' => :'String',
|
81
|
+
:'stage' => :'String',
|
82
|
+
:'status' => :'OpportunityStatusEnum',
|
83
|
+
:'last_activity_at' => :'Time',
|
84
|
+
:'close_date' => :'Time',
|
85
|
+
:'remote_created_at' => :'Time',
|
86
|
+
:'integration_params' => :'Hash<String, Object>',
|
87
|
+
:'linked_account_params' => :'Hash<String, Object>'
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
# List of attributes with nullable: true
|
92
|
+
def self.openapi_nullable
|
93
|
+
Set.new([
|
94
|
+
:'name',
|
95
|
+
:'description',
|
96
|
+
:'amount',
|
97
|
+
:'owner',
|
98
|
+
:'account',
|
99
|
+
:'stage',
|
100
|
+
:'status',
|
101
|
+
:'last_activity_at',
|
102
|
+
:'close_date',
|
103
|
+
:'remote_created_at',
|
104
|
+
:'integration_params',
|
105
|
+
:'linked_account_params'
|
106
|
+
])
|
107
|
+
end
|
108
|
+
|
109
|
+
# Initializes the object
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
def initialize(attributes = {})
|
112
|
+
if (!attributes.is_a?(Hash))
|
113
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeCRMClient::PatchedOpportunityRequest` initialize method"
|
114
|
+
end
|
115
|
+
|
116
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
117
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
118
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
119
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeCRMClient::PatchedOpportunityRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
120
|
+
end
|
121
|
+
h[k.to_sym] = v
|
122
|
+
}
|
123
|
+
|
124
|
+
if attributes.key?(:'name')
|
125
|
+
self.name = attributes[:'name']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'description')
|
129
|
+
self.description = attributes[:'description']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'amount')
|
133
|
+
self.amount = attributes[:'amount']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'owner')
|
137
|
+
self.owner = attributes[:'owner']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'account')
|
141
|
+
self.account = attributes[:'account']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'stage')
|
145
|
+
self.stage = attributes[:'stage']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'status')
|
149
|
+
self.status = attributes[:'status']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'last_activity_at')
|
153
|
+
self.last_activity_at = attributes[:'last_activity_at']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'close_date')
|
157
|
+
self.close_date = attributes[:'close_date']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'remote_created_at')
|
161
|
+
self.remote_created_at = attributes[:'remote_created_at']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'integration_params')
|
165
|
+
if (value = attributes[:'integration_params']).is_a?(Hash)
|
166
|
+
self.integration_params = value
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'linked_account_params')
|
171
|
+
if (value = attributes[:'linked_account_params']).is_a?(Hash)
|
172
|
+
self.linked_account_params = value
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
178
|
+
# @return Array for valid properties with the reasons
|
179
|
+
def list_invalid_properties
|
180
|
+
invalid_properties = Array.new
|
181
|
+
if !@amount.nil? && @amount > 2147483647
|
182
|
+
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 2147483647.')
|
183
|
+
end
|
184
|
+
|
185
|
+
if !@amount.nil? && @amount < -2147483648
|
186
|
+
invalid_properties.push('invalid value for "amount", must be greater than or equal to -2147483648.')
|
187
|
+
end
|
188
|
+
|
189
|
+
invalid_properties
|
190
|
+
end
|
191
|
+
|
192
|
+
# Check to see if the all the properties in the model are valid
|
193
|
+
# @return true if the model is valid
|
194
|
+
def valid?
|
195
|
+
return false if !@amount.nil? && @amount > 2147483647
|
196
|
+
return false if !@amount.nil? && @amount < -2147483648
|
197
|
+
true
|
198
|
+
end
|
199
|
+
|
200
|
+
# Custom attribute writer method with validation
|
201
|
+
# @param [Object] amount Value to be assigned
|
202
|
+
def amount=(amount)
|
203
|
+
if !amount.nil? && amount > 2147483647
|
204
|
+
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 2147483647.'
|
205
|
+
end
|
206
|
+
|
207
|
+
if !amount.nil? && amount < -2147483648
|
208
|
+
fail ArgumentError, 'invalid value for "amount", must be greater than or equal to -2147483648.'
|
209
|
+
end
|
210
|
+
|
211
|
+
@amount = amount
|
212
|
+
end
|
213
|
+
|
214
|
+
# Checks equality by comparing each attribute.
|
215
|
+
# @param [Object] Object to be compared
|
216
|
+
def ==(o)
|
217
|
+
return true if self.equal?(o)
|
218
|
+
self.class == o.class &&
|
219
|
+
name == o.name &&
|
220
|
+
description == o.description &&
|
221
|
+
amount == o.amount &&
|
222
|
+
owner == o.owner &&
|
223
|
+
account == o.account &&
|
224
|
+
stage == o.stage &&
|
225
|
+
status == o.status &&
|
226
|
+
last_activity_at == o.last_activity_at &&
|
227
|
+
close_date == o.close_date &&
|
228
|
+
remote_created_at == o.remote_created_at &&
|
229
|
+
integration_params == o.integration_params &&
|
230
|
+
linked_account_params == o.linked_account_params
|
231
|
+
end
|
232
|
+
|
233
|
+
# @see the `==` method
|
234
|
+
# @param [Object] Object to be compared
|
235
|
+
def eql?(o)
|
236
|
+
self == o
|
237
|
+
end
|
238
|
+
|
239
|
+
# Calculates hash code according to all attributes.
|
240
|
+
# @return [Integer] Hash code
|
241
|
+
def hash
|
242
|
+
[name, description, amount, owner, account, stage, status, last_activity_at, close_date, remote_created_at, integration_params, linked_account_params].hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Builds the object from hash
|
246
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
247
|
+
# @return [Object] Returns the model itself
|
248
|
+
def self.build_from_hash(attributes)
|
249
|
+
new.build_from_hash(attributes)
|
250
|
+
end
|
251
|
+
|
252
|
+
# Builds the object from hash
|
253
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
254
|
+
# @return [Object] Returns the model itself
|
255
|
+
def build_from_hash(attributes)
|
256
|
+
return nil unless attributes.is_a?(Hash)
|
257
|
+
self.class.openapi_types.each_pair do |key, type|
|
258
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
259
|
+
self.send("#{key}=", nil)
|
260
|
+
elsif type =~ /\AArray<(.*)>/i
|
261
|
+
# check to ensure the input is an array given that the attribute
|
262
|
+
# is documented as an array but the input is not
|
263
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
264
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
265
|
+
end
|
266
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
267
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
self
|
272
|
+
end
|
273
|
+
|
274
|
+
# Deserializes the data based on type
|
275
|
+
# @param string type Data type
|
276
|
+
# @param string value Value to be deserialized
|
277
|
+
# @return [Object] Deserialized data
|
278
|
+
def _deserialize(type, value)
|
279
|
+
case type.to_sym
|
280
|
+
when :Time
|
281
|
+
Time.parse(value)
|
282
|
+
when :Date
|
283
|
+
Date.parse(value)
|
284
|
+
when :String
|
285
|
+
value
|
286
|
+
when :Integer
|
287
|
+
value.to_i
|
288
|
+
when :Float
|
289
|
+
value.to_f
|
290
|
+
when :Boolean
|
291
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
292
|
+
true
|
293
|
+
else
|
294
|
+
false
|
295
|
+
end
|
296
|
+
when :Object
|
297
|
+
# generic object (usually a Hash), return directly
|
298
|
+
value
|
299
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
300
|
+
inner_type = Regexp.last_match[:inner_type]
|
301
|
+
value.map { |v| _deserialize(inner_type, v) }
|
302
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
303
|
+
k_type = Regexp.last_match[:k_type]
|
304
|
+
v_type = Regexp.last_match[:v_type]
|
305
|
+
{}.tap do |hash|
|
306
|
+
value.each do |k, v|
|
307
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
else # model
|
311
|
+
# models (e.g. Pet) or oneOf
|
312
|
+
klass = MergeCRMClient.const_get(type)
|
313
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
# Returns the string representation of the object
|
318
|
+
# @return [String] String presentation of the object
|
319
|
+
def to_s
|
320
|
+
to_hash.to_s
|
321
|
+
end
|
322
|
+
|
323
|
+
# to_body is an alias to to_hash (backward compatibility)
|
324
|
+
# @return [Hash] Returns the object in the form of hash
|
325
|
+
def to_body
|
326
|
+
to_hash
|
327
|
+
end
|
328
|
+
|
329
|
+
# Returns the object in the form of hash
|
330
|
+
# @return [Hash] Returns the object in the form of hash
|
331
|
+
def to_hash
|
332
|
+
hash = {}
|
333
|
+
self.class.attribute_map.each_pair do |attr, param|
|
334
|
+
value = self.send(attr)
|
335
|
+
if value.nil?
|
336
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
337
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
338
|
+
end
|
339
|
+
|
340
|
+
hash[param] = _to_hash(value)
|
341
|
+
end
|
342
|
+
hash
|
343
|
+
end
|
344
|
+
|
345
|
+
# Outputs non-array value in the form of hash
|
346
|
+
# For object, use to_hash. Otherwise, just return the value
|
347
|
+
# @param [Object] value Any valid value
|
348
|
+
# @return [Hash] Returns the value in the form of hash
|
349
|
+
def _to_hash(value)
|
350
|
+
if value.is_a?(Array)
|
351
|
+
value.compact.map { |v| _to_hash(v) }
|
352
|
+
elsif value.is_a?(Hash)
|
353
|
+
{}.tap do |hash|
|
354
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
355
|
+
end
|
356
|
+
elsif value.respond_to? :to_hash
|
357
|
+
value.to_hash
|
358
|
+
else
|
359
|
+
value
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|