Class: Appwrite::Models::DatabaseStatusReplica

Inherits:
Object
  • Object
show all
Defined in:
lib/appwrite/models/database_status_replica.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index:, role:, healthy:, replicating: nil, lag_seconds: nil) ⇒ DatabaseStatusReplica

Returns a new instance of DatabaseStatusReplica.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/appwrite/models/database_status_replica.rb', line 12

def initialize(
    index:,
    role:,
    healthy:,
    replicating: nil,
    lag_seconds: nil
)
    @index = index
    @role = role
    @healthy = healthy
    @replicating = replicating
    @lag_seconds = lag_seconds
end

Instance Attribute Details

#healthy ⇒ Object (readonly)

Returns the value of attribute healthy.



8
9
10
# File 'lib/appwrite/models/database_status_replica.rb', line 8

def healthy
  @healthy
end

#index ⇒ Object (readonly)

Returns the value of attribute index.



6
7
8
# File 'lib/appwrite/models/database_status_replica.rb', line 6

def index
  @index
end

#lag_seconds ⇒ Object (readonly)

Returns the value of attribute lag_seconds.



10
11
12
# File 'lib/appwrite/models/database_status_replica.rb', line 10

def lag_seconds
  @lag_seconds
end

#replicating ⇒ Object (readonly)

Returns the value of attribute replicating.



9
10
11
# File 'lib/appwrite/models/database_status_replica.rb', line 9

def replicating
  @replicating
end

#role ⇒ Object (readonly)

Returns the value of attribute role.



7
8
9
# File 'lib/appwrite/models/database_status_replica.rb', line 7

def role
  @role
end

Class Method Details

.from(map:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/appwrite/models/database_status_replica.rb', line 26

def self.from(map:)
    map = { "index" => 0, "role" => "unknown", "healthy" => false }.merge(map)
    DatabaseStatusReplica.new(
        index: map["index"],
        role: map["role"],
        healthy: map["healthy"],
        replicating: map["replicating"],
        lag_seconds: map["lagSeconds"]
    )
end

Instance Method Details

#to_map ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/appwrite/models/database_status_replica.rb', line 37

def to_map
    {
        "index": @index,
        "role": @role,
        "healthy": @healthy,
        "replicating": @replicating,
        "lagSeconds": @lag_seconds
    }
end