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.
5 6 7 8 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 5 def initialize(service, args) @service = service @args = args end |
Instance Attribute Details
#geocode ⇒ Object
Returns the value of attribute geocode.
3 4 5 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 3 def geocode @geocode end |
#lines ⇒ Object
Returns the value of attribute lines.
3 4 5 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 3 def lines @lines end |
#postcode ⇒ Object
Returns the value of attribute postcode.
3 4 5 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 3 def postcode @postcode end |
#response_format ⇒ Object
Returns the value of attribute response_format.
3 4 5 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 3 def response_format @response_format end |
#sort ⇒ Object
Returns the value of attribute sort.
3 4 5 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 3 def sort @sort end |
Class Method Details
.basic_address(*args) ⇒ Object
14 15 16 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 14 def self.basic_address(*args) new(:basicaddress, args).make_request end |
.full_address(*args) ⇒ Object
10 11 12 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 10 def self.full_address(*args) new(:rapidaddress, args).make_request end |
.geocode(postcodes: [], distance: {}, preserve_index: true) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 18 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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/crafty_clicks/postcode_lookup.rb', line 31 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 |