Class: Vng::Zip
Overview
Provides methods to interact with Vonigo ZIP codes.
Constant Summary collapse
- PATH =
'/api/v1/resources/zips/'
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#zip ⇒ Object
readonly
Returns the value of attribute zip.
-
#zone_name ⇒ Object
readonly
Returns the value of attribute zone_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(zip:, state:, zone_name:) ⇒ Zip
constructor
A new instance of Zip.
Constructor Details
#initialize(zip:, state:, zone_name:) ⇒ Zip
Returns a new instance of Zip.
10 11 12 13 14 |
# File 'lib/vng/zip.rb', line 10 def initialize(zip:, state:, zone_name:) @zip = zip @state = state @zone_name = zone_name end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
8 9 10 |
# File 'lib/vng/zip.rb', line 8 def state @state end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
8 9 10 |
# File 'lib/vng/zip.rb', line 8 def zip @zip end |
#zone_name ⇒ Object (readonly)
Returns the value of attribute zone_name.
8 9 10 |
# File 'lib/vng/zip.rb', line 8 def zone_name @zone_name end |
Class Method Details
.all ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vng/zip.rb', line 16 def self.all data = request path: PATH data['Zips'].map do |body| zip = body['zip'] state = body['state'] zone_name = body['zoneName'] new zip: zip, state: state, zone_name: zone_name end end |