Class: CraftyClicks::PostcodeLookup
- Inherits:
-
Object
- Object
- CraftyClicks::PostcodeLookup
- Defined in:
- lib/crafty_clicks/postcode_lookup.rb
Instance Attribute Summary collapse
-
#geocode ⇒ Object
Returns the value of attribute geocode.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#postcode ⇒ Object
Returns the value of attribute postcode.
-
#response_format ⇒ Object
Returns the value of attribute response_format.
-
#sort ⇒ Object
Returns the value of attribute sort.
Class Method Summary collapse
- .basic_address(*args) ⇒ Object
- .full_address(*args) ⇒ Object
- .geocode(postcodes: [], distance: {}, preserve_index: true) ⇒ Object
Instance Method Summary collapse
-
#initialize(service, args) ⇒ PostcodeLookup
constructor
A new instance of PostcodeLookup.
- #make_request ⇒ Object
Constructor Details
#initialize(service, args) ⇒ PostcodeLookup
Returns a new instance of PostcodeLookup.
7 8 9 10 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 7 def initialize(service, args) @service = service @args = args end |
Instance Attribute Details
#geocode ⇒ Object
Returns the value of attribute geocode.
5 6 7 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def geocode @geocode end |
#lines ⇒ Object
Returns the value of attribute lines.
5 6 7 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def lines @lines end |
#postcode ⇒ Object
Returns the value of attribute postcode.
5 6 7 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def postcode @postcode end |
#response_format ⇒ Object
Returns the value of attribute response_format.
5 6 7 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def response_format @response_format end |
#sort ⇒ Object
Returns the value of attribute sort.
5 6 7 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def sort @sort end |
Class Method Details
.basic_address(*args) ⇒ Object
16 17 18 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 16 def self.basic_address(*args) new(:basicaddress, args).make_request end |
.full_address(*args) ⇒ Object
12 13 14 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 12 def self.full_address(*args) new(:rapidaddress, args).make_request end |
.geocode(postcodes: [], distance: {}, preserve_index: true) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 20 def self.geocode(postcodes: [], distance: {}, preserve_index: true) ApiBase.new( product: :postcode, service: :geocode, http_method: :post, params: { postcodes: postcodes, distance: distance, preserve_index: preserve_index }, ).perform_request end |
Instance Method Details
#make_request ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 33 def make_request postcode, geocode, sort, response_format, lines = *@args ApiBase.new( product: :postcode, service: @service, http_method: :post, params: { postcode: postcode, include_geocode: geocode, sort: sort, response: response_format, lines: lines, } ).perform_request end |