Class: Appwrite::Models::CountryList

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total:, countries:) ⇒ CountryList

Returns a new instance of CountryList.



9
10
11
12
13
14
15
# File 'lib/appwrite/models/country_list.rb', line 9

def initialize(
    total:,
    countries:
)
    @total = total
    @countries = countries
end

Instance Attribute Details

#countriesObject (readonly)

Returns the value of attribute countries.



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

def countries
  @countries
end

#totalObject (readonly)

Returns the value of attribute total.



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

def total
  @total
end

Class Method Details

.from(map:) ⇒ Object



17
18
19
20
21
22
# File 'lib/appwrite/models/country_list.rb', line 17

def self.from(map:)
    CountryList.new(
        total: map["total"],
        countries: map["countries"].map { |it| Country.from(map: it) }
    )
end

Instance Method Details

#to_mapObject



24
25
26
27
28
29
# File 'lib/appwrite/models/country_list.rb', line 24

def to_map
    {
        "total": @total,
        "countries": @countries.map { |it| it.to_map }
    }
end