Class: Ratis::Landmark

Inherits:
Object
  • Object
show all
Defined in:
lib/ratis/landmark.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#localityObject

Returns the value of attribute locality.



5
6
7
# File 'lib/ratis/landmark.rb', line 5

def locality
  @locality
end

#locationObject

Returns the value of attribute location.



5
6
7
# File 'lib/ratis/landmark.rb', line 5

def location
  @location
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/ratis/landmark.rb', line 5

def type
  @type
end

#verboseObject

Returns the value of attribute verbose.



5
6
7
# File 'lib/ratis/landmark.rb', line 5

def verbose
  @verbose
end

Class Method Details

.where(conditions) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ratis/landmark.rb', line 7

def self.where(conditions)

  type = conditions.delete(:type).to_s.upcase
  raise ArgumentError.new('You must provide a type') if type.blank?
  Ratis.all_conditions_used? conditions

  response = Request.get 'Getlandmarks', {'Type' => type}
  return [] unless response.success?

  response.to_array(:getlandmarks_response, :landmarks, :landmark).map do |landmark|
    atis_landmark = Landmark.new
    atis_landmark.type = landmark[:type]
    atis_landmark.verbose = landmark[:verbose]
    atis_landmark.location = landmark[:location]
    atis_landmark.locality = landmark[:locality]
    atis_landmark
  end

end