Sha256: a8013ca8eafe25583c4790f9d9b4511238c36e0ca5f48521a64cc2ef09059e3a
Contents?: true
Size: 969 Bytes
Versions: 10
Compression:
Stored size: 969 Bytes
Contents
# frozen_string_literal: true require_relative './base' module GetYourRep # Parses office location information from a Google response. class GoogleOffice < Base # These attributes are defined so they can be called even # if they are not defined during initialization. attr_accessor :line1, :line2 # Builds the hash to pass as constructor options for a new OfficeLocation. def build_hash office_hash = {} office_hash[:type] = determine_office_type office_hash[:line_1] = line1 office_hash[:line_2] = line2 office_hash[:city] = city.capitalize office_hash[:state] = state.upcase office_hash[:zip] = zip office_hash end private def determine_office_type if line1.downcase =~ /(state|house|senate|assembly|capitol|dirksen|reyburn|rayburn|legislative|legislature|government)+/ 'capitol' else 'district' end end end end
Version data entries
10 entries across 10 versions & 1 rubygems