Class: Etsy::Country

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/etsy/country.rb

Class Method Summary collapse

Methods included from Model

included, #initialize, #result, #secret, #token

Class Method Details

.find(id) ⇒ Object



13
14
15
# File 'lib/etsy/country.rb', line 13

def self.find(id)
  get("/countries/#{id}")
end

.find_allObject



9
10
11
# File 'lib/etsy/country.rb', line 9

def self.find_all
  get("/countries")
end

.find_by_alpha2(alpha2) ⇒ Object



17
18
19
20
# File 'lib/etsy/country.rb', line 17

def self.find_by_alpha2(alpha2)
  alpha2 = alpha2.upcase
  find_all.detect { |country| country.iso_country_code == alpha2}
end

.find_by_world_bank_country_code(world_bank_country_code) ⇒ Object



22
23
24
25
# File 'lib/etsy/country.rb', line 22

def self.find_by_world_bank_country_code(world_bank_country_code)
  world_bank_country_code = world_bank_country_code.upcase
  find_all.detect { |country| country.world_bank_country_code == world_bank_country_code}
end