Class: HappyCo::V1Report
- Inherits:
-
Object
- Object
- HappyCo::V1Report
- Defined in:
- lib/happyco_json/models/v1_report.rb
Overview
-
Reports are the end artifact of one or sometimes two inspections. They are generated from inspection(s) at a point in time but do not update if the underlying inspection updates. They are self contained once generated. They are intended to be similar to a printed pieice of paper in that they can’t be edited but they can be signed at any time.
Instance Attribute Summary collapse
-
#account_id ⇒ Object
-
Account ID that the report belongs to.
-
-
#asset_id ⇒ Object
-
Asset ID references the parent that inspection is attached to.
-
-
#data ⇒ Object
Returns the value of attribute data.
-
#finalized_at ⇒ Object
-
Finalized is the time (as reported by the mobile device) that the report was locked.
-
-
#folder_id ⇒ Object
-
FolderID references the folder that contains the inspections used to generate the report.
-
-
#generated_at ⇒ Object
-
Generated at is the time (as reported by the mobile device) that the report was generated at.
-
-
#id ⇒ Object
-
ID of report.
-
-
#inspection_ids ⇒ Object
-
Inspection IDs references one or more inspection(s) used to generate the report.
-
-
#inspector_id ⇒ Object
-
Inspector ID references the user who completed the most recent inspection used to generate the report.
-
-
#inspector_name ⇒ Object
-
Inspector name references the user who completed the most recent inspection used to generate the report.
-
-
#name ⇒ Object
-
Name of the asset that was inspected.
-
-
#public_url ⇒ Object
-
Public URL can be used to share the inspection.
-
-
#revision ⇒ Object
-
The revision of the report.
-
-
#signatories ⇒ Object
-
A map of signatories added to the report.
-
-
#title ⇒ Object
-
Title of the report.
-
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1Report
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 = {}) ⇒ V1Report
Initializes the object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 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 |
# File 'lib/happyco_json/models/v1_report.rb', line 118 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'public_url') self.public_url = attributes[:'public_url'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'revision') self.revision = attributes[:'revision'] end if attributes.has_key?(:'account_id') self.account_id = attributes[:'account_id'] end if attributes.has_key?(:'folder_id') self.folder_id = attributes[:'folder_id'] end if attributes.has_key?(:'asset_id') self.asset_id = attributes[:'asset_id'] end if attributes.has_key?(:'inspection_ids') if (value = attributes[:'inspection_ids']).is_a?(Array) self.inspection_ids = value end end if attributes.has_key?(:'generated_at') self.generated_at = attributes[:'generated_at'] end if attributes.has_key?(:'finalized_at') self.finalized_at = attributes[:'finalized_at'] end if attributes.has_key?(:'inspector_id') self.inspector_id = attributes[:'inspector_id'] end if attributes.has_key?(:'inspector_name') self.inspector_name = attributes[:'inspector_name'] end if attributes.has_key?(:'data') self.data = attributes[:'data'] end if attributes.has_key?(:'signatories') if (value = attributes[:'signatories']).is_a?(Array) self.signatories = value end end end |
Instance Attribute Details
#account_id ⇒ Object
-
Account ID that the report belongs to. For custom integrations (i.e. not integration partners) it may be omitted.
45 46 47 |
# File 'lib/happyco_json/models/v1_report.rb', line 45 def account_id @account_id end |
#asset_id ⇒ Object
-
Asset ID references the parent that inspection is attached to. This field must reference a non archived asset in the same folder as the template referenced below.
51 52 53 |
# File 'lib/happyco_json/models/v1_report.rb', line 51 def asset_id @asset_id end |
#data ⇒ Object
Returns the value of attribute data.
68 69 70 |
# File 'lib/happyco_json/models/v1_report.rb', line 68 def data @data end |
#finalized_at ⇒ Object
-
Finalized is the time (as reported by the mobile device) that the report was locked. Until the report is locked the display settings can be changed. Signing a report locks it immediately.
60 61 62 |
# File 'lib/happyco_json/models/v1_report.rb', line 60 def finalized_at @finalized_at end |
#folder_id ⇒ Object
-
FolderID references the folder that contains the inspections used to generate the report.
48 49 50 |
# File 'lib/happyco_json/models/v1_report.rb', line 48 def folder_id @folder_id end |
#generated_at ⇒ Object
-
Generated at is the time (as reported by the mobile device) that the report was generated at.
57 58 59 |
# File 'lib/happyco_json/models/v1_report.rb', line 57 def generated_at @generated_at end |
#id ⇒ Object
-
ID of report.
30 31 32 |
# File 'lib/happyco_json/models/v1_report.rb', line 30 def id @id end |
#inspection_ids ⇒ Object
-
Inspection IDs references one or more inspection(s) used to generate the report.
54 55 56 |
# File 'lib/happyco_json/models/v1_report.rb', line 54 def inspection_ids @inspection_ids end |
#inspector_id ⇒ Object
-
Inspector ID references the user who completed the most recent inspection used to generate the report.
63 64 65 |
# File 'lib/happyco_json/models/v1_report.rb', line 63 def inspector_id @inspector_id end |
#inspector_name ⇒ Object
-
Inspector name references the user who completed the most recent inspection used to generate the report.
66 67 68 |
# File 'lib/happyco_json/models/v1_report.rb', line 66 def inspector_name @inspector_name end |
#name ⇒ Object
-
Name of the asset that was inspected. This is typically the address of the unit or house that was inspected.
36 37 38 |
# File 'lib/happyco_json/models/v1_report.rb', line 36 def name @name end |
#public_url ⇒ Object
-
Public URL can be used to share the inspection. It contains a UUID to provide security.
33 34 35 |
# File 'lib/happyco_json/models/v1_report.rb', line 33 def public_url @public_url end |
#revision ⇒ Object
-
The revision of the report. This will increment when a change occurs. Reports are limited to changes being archive/unarchive operations or new signatures being added.
42 43 44 |
# File 'lib/happyco_json/models/v1_report.rb', line 42 def revision @revision end |
#signatories ⇒ Object
-
A map of signatories added to the report. Each key in the map only needs to be unique to this report.
71 72 73 |
# File 'lib/happyco_json/models/v1_report.rb', line 71 def signatories @signatories end |
#title ⇒ Object
-
Title of the report. This can be overriden by the user in the report settings but typically comes from the template name used to perform the inspection.
39 40 41 |
# File 'lib/happyco_json/models/v1_report.rb', line 39 def title @title end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/happyco_json/models/v1_report.rb', line 75 def self.attribute_map { :'id' => :'id', :'public_url' => :'public_url', :'name' => :'name', :'title' => :'title', :'revision' => :'revision', :'account_id' => :'account_id', :'folder_id' => :'folder_id', :'asset_id' => :'asset_id', :'inspection_ids' => :'inspection_ids', :'generated_at' => :'generated_at', :'finalized_at' => :'finalized_at', :'inspector_id' => :'inspector_id', :'inspector_name' => :'inspector_name', :'data' => :'data', :'signatories' => :'signatories' } end |
.swagger_types ⇒ Object
Attribute type mapping.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/happyco_json/models/v1_report.rb', line 96 def self.swagger_types { :'id' => :'V1IntegrationID', :'public_url' => :'String', :'name' => :'String', :'title' => :'String', :'revision' => :'Integer', :'account_id' => :'V1IntegrationID', :'folder_id' => :'V1IntegrationID', :'asset_id' => :'V1IntegrationID', :'inspection_ids' => :'Array<V1IntegrationID>', :'generated_at' => :'V1DateTime', :'finalized_at' => :'V1DateTime', :'inspector_id' => :'V1IntegrationID', :'inspector_name' => :'String', :'data' => :'String', :'signatories' => :'Hash<String, V1Signatory>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/happyco_json/models/v1_report.rb', line 205 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && public_url == o.public_url && name == o.name && title == o.title && revision == o.revision && account_id == o.account_id && folder_id == o.folder_id && asset_id == o.asset_id && inspection_ids == o.inspection_ids && generated_at == o.generated_at && finalized_at == o.finalized_at && inspector_id == o.inspector_id && inspector_name == o.inspector_name && data == o.data && signatories == o.signatories end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/happyco_json/models/v1_report.rb', line 261 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 =~ /^(true|t|yes|y|1)$/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 temp_model = HappyCo.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/happyco_json/models/v1_report.rb', line 327 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/happyco_json/models/v1_report.rb', line 240 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
227 228 229 |
# File 'lib/happyco_json/models/v1_report.rb', line 227 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
233 234 235 |
# File 'lib/happyco_json/models/v1_report.rb', line 233 def hash [id, public_url, name, title, revision, account_id, folder_id, asset_id, inspection_ids, generated_at, finalized_at, inspector_id, inspector_name, data, signatories].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
192 193 194 195 |
# File 'lib/happyco_json/models/v1_report.rb', line 192 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
307 308 309 |
# File 'lib/happyco_json/models/v1_report.rb', line 307 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
313 314 315 316 317 318 319 320 321 |
# File 'lib/happyco_json/models/v1_report.rb', line 313 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
301 302 303 |
# File 'lib/happyco_json/models/v1_report.rb', line 301 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
199 200 201 |
# File 'lib/happyco_json/models/v1_report.rb', line 199 def valid? return true end |