Class: Svix::ApplicationOut

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/application_out.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ApplicationOut

Returns a new instance of ApplicationOut.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/svix/models/application_out.rb', line 24

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::ApplicationOut` new method")
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::ApplicationOut")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



17
18
19
# File 'lib/svix/models/application_out.rb', line 17

def created_at
  @created_at
end

#idObject

The Application's ID.



16
17
18
# File 'lib/svix/models/application_out.rb', line 16

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



19
20
21
# File 'lib/svix/models/application_out.rb', line 19

def 
  @metadata
end

#nameObject

Application name for human consumption.



10
11
12
# File 'lib/svix/models/application_out.rb', line 10

def name
  @name
end

#throttle_rateObject

Maximum messages per second to send to this application.

Outgoing messages will be throttled to this rate.



14
15
16
# File 'lib/svix/models/application_out.rb', line 14

def throttle_rate
  @throttle_rate
end

#uidObject

Optional unique identifier for the application.



8
9
10
# File 'lib/svix/models/application_out.rb', line 8

def uid
  @uid
end

#updated_atObject

Returns the value of attribute updated_at.



18
19
20
# File 'lib/svix/models/application_out.rb', line 18

def updated_at
  @updated_at
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/svix/models/application_out.rb', line 39

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["uid"] = attributes["uid"]
  attrs["name"] = attributes["name"]
  attrs["throttle_rate"] = attributes["throttleRate"]
  attrs["id"] = attributes["id"]
  attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
  attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
  attrs["metadata"] = attributes["metadata"]
  new(attrs)
end

Instance Method Details

#serializeObject



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/svix/models/application_out.rb', line 52

def serialize
  out = Hash.new
  out["uid"] = Svix::serialize_primitive(@uid) if @uid
  out["name"] = Svix::serialize_primitive(@name) if @name
  out["throttleRate"] = Svix::serialize_primitive(@throttle_rate) if @throttle_rate
  out["id"] = Svix::serialize_primitive(@id) if @id
  out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at
  out["updatedAt"] = Svix::serialize_primitive(@updated_at) if @updated_at
  out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



66
67
68
# File 'lib/svix/models/application_out.rb', line 66

def to_json
  JSON.dump(serialize)
end