Class: Verizon::GeoFenceConfigurationUpdateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/geo_fence_configuration_update_request.rb

Overview

Request for /api/v1/application/configurations/geofence PUT endpoint. It requires at least one of vendorId, name, description, geofence, messages and isActive fields to be populated.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(name: SKIP, description: SKIP, geo_fence: SKIP, messages: SKIP, is_active: SKIP) ⇒ GeoFenceConfigurationUpdateRequest

Returns a new instance of GeoFenceConfigurationUpdateRequest.



69
70
71
72
73
74
75
76
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 69

def initialize(name: SKIP, description: SKIP, geo_fence: SKIP,
               messages: SKIP, is_active: SKIP)
  @name = name unless name == SKIP
  @description = description unless description == SKIP
  @geo_fence = geo_fence unless geo_fence == SKIP
  @messages = messages unless messages == SKIP
  @is_active = is_active unless is_active == SKIP
end

Instance Attribute Details

#descriptionString

Description of the configuration.

Returns:

  • (String)


20
21
22
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 20

def description
  @description
end

#geo_fenceEtxGeofence

The GeoJSON representation of geofence. Geofence supports the following geometry types: LineString, Polygon, MultiLineString, and MultiPolygon. The system only supports a single Feature in the FeatureCollection, so only one Line, Polygon, MultiLine or MultiPolygon can be defined within one Geofencing configuration.

Returns:



28
29
30
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 28

def geo_fence
  @geo_fence
end

#is_activeTrueClass | FalseClass

List of predefined messages that belongs to the geofence. These are the messages that are sent out by the system when the Trigger Condition for the message is met.

Returns:

  • (TrueClass | FalseClass)


40
41
42
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 40

def is_active
  @is_active
end

#messagesArray[Object]

List of predefined messages that belongs to the geofence. These are the messages that are sent out by the system when the Trigger Condition for the message is met.

Returns:

  • (Array[Object])


34
35
36
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 34

def messages
  @messages
end

#nameString

Name of the configuration.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 16

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  geo_fence = EtxGeofence.from_hash(hash['geoFence']) if hash['geoFence']
  messages = hash.key?('messages') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:Message32), hash['messages']
  ) : SKIP
  is_active = hash.key?('isActive') ? hash['isActive'] : SKIP

  # Create object from extracted values.
  GeoFenceConfigurationUpdateRequest.new(name: name,
                                         description: description,
                                         geo_fence: geo_fence,
                                         messages: messages,
                                         is_active: is_active)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['geo_fence'] = 'geoFence'
  @_hash['messages'] = 'messages'
  @_hash['is_active'] = 'isActive'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 54

def self.optionals
  %w[
    name
    description
    geo_fence
    messages
    is_active
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



101
102
103
104
105
106
107
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 101

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 117

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, geo_fence:"\
  " #{@geo_fence.inspect}, messages: #{@messages.inspect}, is_active: #{@is_active.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
# File 'lib/verizon/models/geo_fence_configuration_update_request.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, description: #{@description}, geo_fence: #{@geo_fence},"\
  " messages: #{@messages}, is_active: #{@is_active}>"
end