Class: Manateq::City

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/manateq/city.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Resource

included

Instance Attribute Details

#arabic_nameObject

Returns the value of attribute arabic_name.



10
11
12
# File 'lib/manateq/city.rb', line 10

def arabic_name
  @arabic_name
end

#english_nameObject

Returns the value of attribute english_name.



11
12
13
# File 'lib/manateq/city.rb', line 11

def english_name
  @english_name
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/manateq/city.rb', line 8

def id
  @id
end

#regionObject

Returns the value of attribute region.



9
10
11
# File 'lib/manateq/city.rb', line 9

def region
  @region
end

Class Method Details

.compare(resource, name) ⇒ Object



26
27
28
29
# File 'lib/manateq/city.rb', line 26

def self.compare resource, name
  resource.arabic_name.downcase.index(name.downcase) != nil or
      resource.english_name.downcase.index(name.downcase) != nil
end

.fill(data) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/manateq/city.rb', line 17

def self.fill data
  r_obj = self.new
  r_obj.id = data['city_id']
  r_obj.arabic_name = data['name']['ar']
  r_obj.english_name = data['name']['en']
  r_obj.region = Manateq::Region.get_by_id data['region_id']
  r_obj
end

.resource_nameObject



13
14
15
# File 'lib/manateq/city.rb', line 13

def self.resource_name
  'cities'
end