lib/ratis/landmark.rb in ratis-3.4.1 vs lib/ratis/landmark.rb in ratis-3.4.2
- old
+ new
@@ -2,12 +2,19 @@
class Landmark
attr_accessor :type, :verbose, :location, :locality
+ def initialize(landmark)
+ @type = landmark[:type]
+ @verbose = landmark[:verbose]
+ @location = landmark[:location]
+ @locality = landmark[:locality]
+ end
+
def self.where(conditions)
- app_id = conditions.delete(:app_id) || 'WEB'
+ app_id = conditions.delete(:app_id) || 'WEB'
type = conditions.delete(:type).to_s.upcase
zipcode = conditions.delete(:zipcode)
raise ArgumentError.new('You must provide a type') if type.blank?
Ratis.all_conditions_used? conditions
@@ -17,15 +24,10 @@
'Zipcode' => zipcode}
return [] unless response.success?
response.to_array(:getlandmarks_response, :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
+ Landmark.new(landmark)
end
end
end