Class: Bag::Adres
Instance Attribute Summary collapse
-
#gemeente ⇒ Object
Returns the value of attribute gemeente.
-
#huisletter ⇒ Object
Returns the value of attribute huisletter.
-
#huisnummer ⇒ Object
Returns the value of attribute huisnummer.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#postcode ⇒ Object
Returns the value of attribute postcode.
-
#provincie ⇒ Object
Returns the value of attribute provincie.
-
#straatnaam ⇒ Object
Returns the value of attribute straatnaam.
-
#toevoeging ⇒ Object
Returns the value of attribute toevoeging.
-
#woonplaats ⇒ Object
Returns the value of attribute woonplaats.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(latitude, longitude, postcode, woonplaats, gemeente, provincie, straatnaam, huisnummer, huisletter, toevoeging) ⇒ Adres
constructor
A new instance of Adres.
Constructor Details
#initialize(latitude, longitude, postcode, woonplaats, gemeente, provincie, straatnaam, huisnummer, huisletter, toevoeging) ⇒ Adres
Returns a new instance of Adres.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bag/adres.rb', line 5 def initialize(latitude, longitude, postcode, woonplaats, gemeente, provincie, straatnaam, huisnummer, huisletter, toevoeging) self.latitude = latitude self.longitude = longitude self.straatnaam = straatnaam self.huisnummer = huisnummer self.huisletter = huisletter self.toevoeging = toevoeging self.postcode = postcode self.woonplaats = woonplaats self.gemeente = gemeente self.provincie = provincie end |
Instance Attribute Details
#gemeente ⇒ Object
Returns the value of attribute gemeente.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def gemeente @gemeente end |
#huisletter ⇒ Object
Returns the value of attribute huisletter.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def huisletter @huisletter end |
#huisnummer ⇒ Object
Returns the value of attribute huisnummer.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def huisnummer @huisnummer end |
#latitude ⇒ Object
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def longitude @longitude end |
#postcode ⇒ Object
Returns the value of attribute postcode.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def postcode @postcode end |
#provincie ⇒ Object
Returns the value of attribute provincie.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def provincie @provincie end |
#straatnaam ⇒ Object
Returns the value of attribute straatnaam.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def straatnaam @straatnaam end |
#toevoeging ⇒ Object
Returns the value of attribute toevoeging.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def toevoeging @toevoeging end |
#woonplaats ⇒ Object
Returns the value of attribute woonplaats.
3 4 5 |
# File 'lib/bag/adres.rb', line 3 def woonplaats @woonplaats end |
Class Method Details
.search(postcode, huisnummer = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bag/adres.rb', line 18 def self.search(postcode, huisnummer=nil) response = get("/postcodes/#{postcode}", query: huisnummer ? {huisnummer: huisnummer} : {}) result = [] if response.success? response.each do |obj| result << self.new(obj['latitude'], obj['longitude'], obj['postcode'], obj['woonplaats'], obj['gemeente'], obj['provincie'], obj['straatnaam'], obj['huisnummer'], obj['huisletter'], obj['toevoeging']) end elsif response.code == 404 return nil else raise response.parsed_response['error'] end result end |