class Pipl::API::Response::Location

Attributes

code[R]
country[R]
estimation[R]
state[R]

Public Class Methods

new(location) click to toggle source
# File lib/pipl/api/response/location.rb, line 8
def initialize(location)
  @code = location["country"]
  if location["display"] && location["display"].include?(",")
    @state = location["display"].split(", ").first
    @country = location["display"].split(", ").last
  else
    @country = location["display"]
  end
  @estimation = location["estimated_percent"].to_f / 100
end

Public Instance Methods

to_h()
Alias for: to_hash
to_hash() click to toggle source
# File lib/pipl/api/response/location.rb, line 19
def to_hash
  {
    code: code,
    state: state,
    country: country,
    estimation: estimation
  }
end
Also aliased as: to_h