Class: Zernio::ImessageSenderLifecycle

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

Overview

A provisioned iMessage sender order and its lifecycle. Activation is asynchronous: poll GET /v1/imessage/senders/senderId or subscribe to account.connected.

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ ImessageSenderLifecycle

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
189
190
191
192
193
194
195
196
197
198
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 133

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ImessageSenderLifecycle` 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::ImessageSenderLifecycle`. 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?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'kind')
    self.kind = attributes[:'kind']
  end

  if attributes.key?(:'region')
    self.region = attributes[:'region']
  end

  if attributes.key?(:'handle')
    self.handle = attributes[:'handle']
  end

  if attributes.key?(:'opt_in_link')
    self.opt_in_link = attributes[:'opt_in_link']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'price_cents')
    self.price_cents = attributes[:'price_cents']
  end

  if attributes.key?(:'provider')
    self.provider = attributes[:'provider']
  end

  if attributes.key?(:'profile_id')
    self.profile_id = attributes[:'profile_id']
  end

  if attributes.key?(:'display_name')
    self.display_name = attributes[:'display_name']
  end

  if attributes.key?(:'failure_reason')
    self.failure_reason = attributes[:'failure_reason']
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end
end

Instance Attribute Details

#account_id ⇒ Object

The messaging account created at activation



45
46
47
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 45

def 
  @account_id
end

#created_at ⇒ Object

Returns the value of attribute created_at.



47
48
49
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 47

def created_at
  @created_at
end

#display_name ⇒ Object

Returns the value of attribute display_name.



40
41
42
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 40

def display_name
  @display_name
end

#failure_reason ⇒ Object

Returns the value of attribute failure_reason.



42
43
44
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 42

def failure_reason
  @failure_reason
end

#handle ⇒ Object

The sender handle once activation assigns it



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

def handle
  @handle
end

#id ⇒ Object

Returns the value of attribute id.



19
20
21
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 19

def id
  @id
end

#kind ⇒ Object

Returns the value of attribute kind.



21
22
23
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 21

def kind
  @kind
end

imessage:// deep link that opens Messages on this sender with a prefilled text. Share it so contacts message you first (Apple only lets a sender reach contacts who wrote to it first); null until the handle is assigned.



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

def opt_in_link
  @opt_in_link
end

#price_cents ⇒ Object

Monthly price billed while the sender is active



34
35
36
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 34

def price_cents
  @price_cents
end

#profile_id ⇒ Object

Returns the value of attribute profile_id.



38
39
40
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 38

def profile_id
  @profile_id
end

#provider ⇒ Object

Returns the value of attribute provider.



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

def provider
  @provider
end

#region ⇒ Object

Returns the value of attribute region.



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

def region
  @region
end

#status ⇒ Object

Returns the value of attribute status.



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

def status
  @status
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



91
92
93
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 72

def self.attribute_map
  {
    :'id' => :'id',
    :'kind' => :'kind',
    :'region' => :'region',
    :'handle' => :'handle',
    :'opt_in_link' => :'optInLink',
    :'status' => :'status',
    :'price_cents' => :'priceCents',
    :'provider' => :'provider',
    :'profile_id' => :'profileId',
    :'display_name' => :'displayName',
    :'failure_reason' => :'failureReason',
    :'account_id' => :'accountId',
    :'created_at' => :'createdAt'
  }
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



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 286

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



120
121
122
123
124
125
126
127
128
129
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 120

def self.openapi_nullable
  Set.new([
    :'region',
    :'handle',
    :'opt_in_link',
    :'display_name',
    :'failure_reason',
    :'account_id',
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 101

def self.openapi_types
  {
    :'id' => :'String',
    :'kind' => :'String',
    :'region' => :'String',
    :'handle' => :'String',
    :'opt_in_link' => :'String',
    :'status' => :'String',
    :'price_cents' => :'Integer',
    :'provider' => :'String',
    :'profile_id' => :'String',
    :'display_name' => :'String',
    :'failure_reason' => :'String',
    :'account_id' => :'String',
    :'created_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 253

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      kind == o.kind &&
      region == o.region &&
      handle == o.handle &&
      opt_in_link == o.opt_in_link &&
      status == o.status &&
      price_cents == o.price_cents &&
      provider == o.provider &&
      profile_id == o.profile_id &&
      display_name == o.display_name &&
      failure_reason == o.failure_reason &&
       == o. &&
      created_at == o.created_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


273
274
275
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 273

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



279
280
281
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 279

def hash
  [id, kind, region, handle, opt_in_link, status, price_cents, provider, profile_id, display_name, failure_reason, , created_at].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



202
203
204
205
206
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 202

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 308

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



210
211
212
213
214
215
216
217
218
219
# File 'lib/zernio-sdk/models/imessage_sender_lifecycle.rb', line 210

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  kind_validator = EnumAttributeValidator.new('String', ["phone", "email"])
  return false unless kind_validator.valid?(@kind)
  region_validator = EnumAttributeValidator.new('String', ["US", "GB"])
  return false unless region_validator.valid?(@region)
  status_validator = EnumAttributeValidator.new('String', ["ordering", "activating", "active", "suspended", "canceled", "failed"])
  return false unless status_validator.valid?(@status)
  true
end