Class: Crisphive::TechnicianCreateRequest
- Inherits:
-
Object
- Object
- Crisphive::TechnicianCreateRequest
- Defined in:
- lib/crisphive/models/technician_create_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address ⇒ Object
Home address (the day-start point when start_location_type=home).
-
#assignment_tier ⇒ Object
Crew tier the matching engine assigns by: lead (can head a job), buddy (crew helper), float (excluded from auto crew-assign).
-
#buddy_ids ⇒ Object
Buddies of this technician (set when creating a lead).
-
#business_group_id ⇒ Object
Role group for the new member.
-
#email ⇒ Object
Email address.
-
#full_name ⇒ Object
The person's full display name.
-
#job_title ⇒ Object
Display title (e.g. "Senior HVAC Technician").
-
#join_date ⇒ Object
First working day (YYYY-MM-DD).
-
#lead_ids ⇒ Object
Leads this technician is a buddy of (set when creating a buddy; the technician is appended to each lead's buddy list).
-
#phone ⇒ Object
At least one of phone/email is required (identity resolution key).
-
#service_area_ids ⇒ Object
Service areas to assign the technician to.
-
#start_location_lat ⇒ Object
Explicit day-start latitude in decimal degrees (-90..90); when set it wins over the address geocode.
-
#start_location_long ⇒ Object
Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
-
#start_location_type ⇒ Object
Where the technician starts their day: home (their address) or office (the business location).
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ TechnicianCreateRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ TechnicianCreateRequest
Initializes the object
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 178 179 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 207 208 209 210 211 212 213 |
# File 'lib/crisphive/models/technician_create_request.rb', line 135 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::TechnicianCreateRequest` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::TechnicianCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'address') self.address = attributes[:'address'] end if attributes.key?(:'assignment_tier') self.assignment_tier = attributes[:'assignment_tier'] end if attributes.key?(:'buddy_ids') if (value = attributes[:'buddy_ids']).is_a?(Array) self.buddy_ids = value end end if attributes.key?(:'business_group_id') self.business_group_id = attributes[:'business_group_id'] else self.business_group_id = nil end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'full_name') self.full_name = attributes[:'full_name'] else self.full_name = nil end if attributes.key?(:'job_title') self.job_title = attributes[:'job_title'] end if attributes.key?(:'join_date') self.join_date = attributes[:'join_date'] end if attributes.key?(:'lead_ids') if (value = attributes[:'lead_ids']).is_a?(Array) self.lead_ids = value end end if attributes.key?(:'phone') self.phone = attributes[:'phone'] end if attributes.key?(:'service_area_ids') if (value = attributes[:'service_area_ids']).is_a?(Array) self.service_area_ids = value end end if attributes.key?(:'start_location_lat') self.start_location_lat = attributes[:'start_location_lat'] end if attributes.key?(:'start_location_long') self.start_location_long = attributes[:'start_location_long'] end if attributes.key?(:'start_location_type') self.start_location_type = attributes[:'start_location_type'] end end |
Instance Attribute Details
#address ⇒ Object
Home address (the day-start point when start_location_type=home).
19 20 21 |
# File 'lib/crisphive/models/technician_create_request.rb', line 19 def address @address end |
#assignment_tier ⇒ Object
Crew tier the matching engine assigns by: lead (can head a job), buddy (crew helper), float (excluded from auto crew-assign).
22 23 24 |
# File 'lib/crisphive/models/technician_create_request.rb', line 22 def assignment_tier @assignment_tier end |
#buddy_ids ⇒ Object
Buddies of this technician (set when creating a lead). Optional; max 50 technician ids.
25 26 27 |
# File 'lib/crisphive/models/technician_create_request.rb', line 25 def buddy_ids @buddy_ids end |
#business_group_id ⇒ Object
Role group for the new member. Discover IDs via GET /permission/groups (Owner/Administrator groups are rejected in sandbox mode).
28 29 30 |
# File 'lib/crisphive/models/technician_create_request.rb', line 28 def business_group_id @business_group_id end |
#email ⇒ Object
Email address. At least one of phone/email is required (identity resolution key).
31 32 33 |
# File 'lib/crisphive/models/technician_create_request.rb', line 31 def email @email end |
#full_name ⇒ Object
The person's full display name. Required; max 255 chars.
34 35 36 |
# File 'lib/crisphive/models/technician_create_request.rb', line 34 def full_name @full_name end |
#job_title ⇒ Object
Display title (e.g. "Senior HVAC Technician").
37 38 39 |
# File 'lib/crisphive/models/technician_create_request.rb', line 37 def job_title @job_title end |
#join_date ⇒ Object
First working day (YYYY-MM-DD).
40 41 42 |
# File 'lib/crisphive/models/technician_create_request.rb', line 40 def join_date @join_date end |
#lead_ids ⇒ Object
Leads this technician is a buddy of (set when creating a buddy; the technician is appended to each lead's buddy list). Optional; max 50 technician ids.
43 44 45 |
# File 'lib/crisphive/models/technician_create_request.rb', line 43 def lead_ids @lead_ids end |
#phone ⇒ Object
At least one of phone/email is required (identity resolution key).
46 47 48 |
# File 'lib/crisphive/models/technician_create_request.rb', line 46 def phone @phone end |
#service_area_ids ⇒ Object
Service areas to assign the technician to. Optional; max 50. Discover via GET /service-areas.
49 50 51 |
# File 'lib/crisphive/models/technician_create_request.rb', line 49 def service_area_ids @service_area_ids end |
#start_location_lat ⇒ Object
Explicit day-start latitude in decimal degrees (-90..90); when set it wins over the address geocode.
52 53 54 |
# File 'lib/crisphive/models/technician_create_request.rb', line 52 def start_location_lat @start_location_lat end |
#start_location_long ⇒ Object
Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
55 56 57 |
# File 'lib/crisphive/models/technician_create_request.rb', line 55 def start_location_long @start_location_long end |
#start_location_type ⇒ Object
Where the technician starts their day: home (their address) or office (the business location). Drives the engine's travel estimates.
58 59 60 |
# File 'lib/crisphive/models/technician_create_request.rb', line 58 def start_location_type @start_location_type end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/crisphive/models/technician_create_request.rb', line 513 def self._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 = Crisphive.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
103 104 105 |
# File 'lib/crisphive/models/technician_create_request.rb', line 103 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/crisphive/models/technician_create_request.rb', line 83 def self.attribute_map { :'address' => :'address', :'assignment_tier' => :'assignment_tier', :'buddy_ids' => :'buddy_ids', :'business_group_id' => :'business_group_id', :'email' => :'email', :'full_name' => :'full_name', :'job_title' => :'job_title', :'join_date' => :'join_date', :'lead_ids' => :'lead_ids', :'phone' => :'phone', :'service_area_ids' => :'service_area_ids', :'start_location_lat' => :'start_location_lat', :'start_location_long' => :'start_location_long', :'start_location_type' => :'start_location_type' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/crisphive/models/technician_create_request.rb', line 489 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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 if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
128 129 130 131 |
# File 'lib/crisphive/models/technician_create_request.rb', line 128 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/crisphive/models/technician_create_request.rb', line 108 def self.openapi_types { :'address' => :'TechnicianAddressInput', :'assignment_tier' => :'String', :'buddy_ids' => :'Array<String>', :'business_group_id' => :'String', :'email' => :'String', :'full_name' => :'String', :'job_title' => :'String', :'join_date' => :'Date', :'lead_ids' => :'Array<String>', :'phone' => :'String', :'service_area_ids' => :'Array<String>', :'start_location_lat' => :'Float', :'start_location_long' => :'Float', :'start_location_type' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/crisphive/models/technician_create_request.rb', line 455 def ==(o) return true if self.equal?(o) self.class == o.class && address == o.address && assignment_tier == o.assignment_tier && buddy_ids == o.buddy_ids && business_group_id == o.business_group_id && email == o.email && full_name == o.full_name && job_title == o.job_title && join_date == o.join_date && lead_ids == o.lead_ids && phone == o.phone && service_area_ids == o.service_area_ids && start_location_lat == o.start_location_lat && start_location_long == o.start_location_long && start_location_type == o.start_location_type end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'lib/crisphive/models/technician_create_request.rb', line 584 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 |
#eql?(o) ⇒ Boolean
476 477 478 |
# File 'lib/crisphive/models/technician_create_request.rb', line 476 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
482 483 484 |
# File 'lib/crisphive/models/technician_create_request.rb', line 482 def hash [address, assignment_tier, buddy_ids, business_group_id, email, full_name, job_title, join_date, lead_ids, phone, service_area_ids, start_location_lat, start_location_long, start_location_type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/crisphive/models/technician_create_request.rb', line 217 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@buddy_ids.nil? && @buddy_ids.length > 50 invalid_properties.push('invalid value for "buddy_ids", number of items must be less than or equal to 50.') end if @business_group_id.nil? invalid_properties.push('invalid value for "business_group_id", business_group_id cannot be nil.') end if !@email.nil? && @email.to_s.length > 255 invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 255.') end if @full_name.nil? invalid_properties.push('invalid value for "full_name", full_name cannot be nil.') end if @full_name.to_s.length > 255 invalid_properties.push('invalid value for "full_name", the character length must be smaller than or equal to 255.') end if !@job_title.nil? && @job_title.to_s.length > 255 invalid_properties.push('invalid value for "job_title", the character length must be smaller than or equal to 255.') end if !@lead_ids.nil? && @lead_ids.length > 50 invalid_properties.push('invalid value for "lead_ids", number of items must be less than or equal to 50.') end if !@phone.nil? && @phone.to_s.length > 50 invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 50.') end if !@service_area_ids.nil? && @service_area_ids.length > 50 invalid_properties.push('invalid value for "service_area_ids", number of items must be less than or equal to 50.') end if !@start_location_lat.nil? && @start_location_lat > 90 invalid_properties.push('invalid value for "start_location_lat", must be smaller than or equal to 90.') end if !@start_location_lat.nil? && @start_location_lat < -90 invalid_properties.push('invalid value for "start_location_lat", must be greater than or equal to -90.') end if !@start_location_long.nil? && @start_location_long > 180 invalid_properties.push('invalid value for "start_location_long", must be smaller than or equal to 180.') end if !@start_location_long.nil? && @start_location_long < -180 invalid_properties.push('invalid value for "start_location_long", must be greater than or equal to -180.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
560 561 562 |
# File 'lib/crisphive/models/technician_create_request.rb', line 560 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/crisphive/models/technician_create_request.rb', line 566 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.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_s ⇒ String
Returns the string representation of the object
554 555 556 |
# File 'lib/crisphive/models/technician_create_request.rb', line 554 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/crisphive/models/technician_create_request.rb', line 277 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' assignment_tier_validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"]) return false unless assignment_tier_validator.valid?(@assignment_tier) return false if !@buddy_ids.nil? && @buddy_ids.length > 50 return false if @business_group_id.nil? return false if !@email.nil? && @email.to_s.length > 255 return false if @full_name.nil? return false if @full_name.to_s.length > 255 return false if !@job_title.nil? && @job_title.to_s.length > 255 return false if !@lead_ids.nil? && @lead_ids.length > 50 return false if !@phone.nil? && @phone.to_s.length > 50 return false if !@service_area_ids.nil? && @service_area_ids.length > 50 return false if !@start_location_lat.nil? && @start_location_lat > 90 return false if !@start_location_lat.nil? && @start_location_lat < -90 return false if !@start_location_long.nil? && @start_location_long > 180 return false if !@start_location_long.nil? && @start_location_long < -180 start_location_type_validator = EnumAttributeValidator.new('String', ["home", "office"]) return false unless start_location_type_validator.valid?(@start_location_type) true end |