Class: Zernio::BusinessAgentStatus

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/business_agent_status.rb

Overview

Where the merchant is in the Meta Business Agent setup for this number.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ BusinessAgentStatus

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 90

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::BusinessAgentStatus` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::BusinessAgentStatus`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'eligible')
    self.eligible = attributes[:'eligible']
  else
    self.eligible = nil
  end

  if attributes.key?(:'terms_accepted')
    self.terms_accepted = attributes[:'terms_accepted']
  else
    self.terms_accepted = nil
  end

  if attributes.key?(:'onboarded')
    self.onboarded = attributes[:'onboarded']
  else
    self.onboarded = nil
  end

  if attributes.key?(:'enabled')
    self.enabled = attributes[:'enabled']
  else
    self.enabled = nil
  end

  if attributes.key?(:'agent_id')
    self.agent_id = attributes[:'agent_id']
  else
    self.agent_id = nil
  end

  if attributes.key?(:'settings')
    self.settings = attributes[:'settings']
  else
    self.settings = nil
  end

  if attributes.key?(:'manual_steps')
    if (value = attributes[:'manual_steps']).is_a?(Array)
      self.manual_steps = value
    end
  else
    self.manual_steps = nil
  end

  if attributes.key?(:'unverified_steps')
    if (value = attributes[:'unverified_steps']).is_a?(Array)
      self.unverified_steps = value
    end
  else
    self.unverified_steps = nil
  end
end

Instance Attribute Details

#agent_idObject

Returns the value of attribute agent_id.



31
32
33
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 31

def agent_id
  @agent_id
end

#eligibleObject

Whether the number can run the agent; null when the terms are not accepted yet (Meta refuses the check).



20
21
22
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 20

def eligible
  @eligible
end

#enabledObject

The agent answers live conversations.



29
30
31
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 29

def enabled
  @enabled
end

#manual_stepsObject

Steps Meta keeps outside the API that Zernio can verify are still pending.



36
37
38
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 36

def manual_steps
  @manual_steps
end

#onboardedObject

An agent exists on the number (onboard was called).



26
27
28
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 26

def onboarded
  @onboarded
end

#settingsObject

Returns the value of attribute settings.



33
34
35
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 33

def settings
  @settings
end

#terms_acceptedObject

False when Meta rejects calls because the merchant has not accepted the terms in WhatsApp Manager.



23
24
25
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 23

def terms_accepted
  @terms_accepted
end

#unverified_stepsObject

Steps Meta keeps outside the API and exposes no state for, listed once an agent exists. Informational: Zernio cannot tell whether the merchant already did them.



39
40
41
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 39

def unverified_steps
  @unverified_steps
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



56
57
58
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 56

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



61
62
63
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 61

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 42

def self.attribute_map
  {
    :'eligible' => :'eligible',
    :'terms_accepted' => :'termsAccepted',
    :'onboarded' => :'onboarded',
    :'enabled' => :'enabled',
    :'agent_id' => :'agentId',
    :'settings' => :'settings',
    :'manual_steps' => :'manualSteps',
    :'unverified_steps' => :'unverifiedSteps'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 277

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_nullableObject

List of attributes with nullable: true



80
81
82
83
84
85
86
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 80

def self.openapi_nullable
  Set.new([
    :'eligible',
    :'agent_id',
    :'settings',
  ])
end

.openapi_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 66

def self.openapi_types
  {
    :'eligible' => :'Boolean',
    :'terms_accepted' => :'Boolean',
    :'onboarded' => :'Boolean',
    :'enabled' => :'Boolean',
    :'agent_id' => :'String',
    :'settings' => :'BusinessAgentSettings',
    :'manual_steps' => :'Array<BusinessAgentStatusManualStepsInner>',
    :'unverified_steps' => :'Array<BusinessAgentStatusUnverifiedStepsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 249

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      eligible == o.eligible &&
      terms_accepted == o.terms_accepted &&
      onboarded == o.onboarded &&
      enabled == o.enabled &&
      agent_id == o.agent_id &&
      settings == o.settings &&
      manual_steps == o.manual_steps &&
      unverified_steps == o.unverified_steps
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


264
265
266
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 264

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



270
271
272
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 270

def hash
  [eligible, terms_accepted, onboarded, enabled, agent_id, settings, manual_steps, unverified_steps].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 159

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @terms_accepted.nil?
    invalid_properties.push('invalid value for "terms_accepted", terms_accepted cannot be nil.')
  end

  if @onboarded.nil?
    invalid_properties.push('invalid value for "onboarded", onboarded cannot be nil.')
  end

  if @enabled.nil?
    invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
  end

  if @manual_steps.nil?
    invalid_properties.push('invalid value for "manual_steps", manual_steps cannot be nil.')
  end

  if @unverified_steps.nil?
    invalid_properties.push('invalid value for "unverified_steps", unverified_steps cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 299

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

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



187
188
189
190
191
192
193
194
195
# File 'lib/zernio-sdk/models/business_agent_status.rb', line 187

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @terms_accepted.nil?
  return false if @onboarded.nil?
  return false if @enabled.nil?
  return false if @manual_steps.nil?
  return false if @unverified_steps.nil?
  true
end