class SgPostcode::ResponseBuilder::Config

Public Class Methods

add_key_path(key_name, *path) click to toggle source

add a custom key_path

# File lib/sg_postcode/response/config.rb, line 11
def add_key_path(key_name, *path)
  fields.merge!({ key_name => path })
end
default_fields() click to toggle source

default fields (key_paths)

# File lib/sg_postcode/response/config.rb, line 24
def default_fields
  {
    format_address: ['formatted_address'],
    lat: ['geometry', 'location', 'lat'],
    long: ['geometry', 'location', 'lng'],
  }
end
fields() click to toggle source

Get all response fields (key_paths)

# File lib/sg_postcode/response/config.rb, line 6
def fields
  @@fields ||= default_fields
end
remove_key_path(key_name) click to toggle source

remove a key_path

@return nothing if keypath doesn’t exist

# File lib/sg_postcode/response/config.rb, line 19
def remove_key_path(key_name)
  fields.delete(key_name)
end