Module: Fathom

Defined in:
lib/fathom.rb,
lib/fathom/client.rb,
lib/fathom/object.rb,
lib/fathom/version.rb,
lib/fathom/resource.rb,
lib/fathom/objects/list.rb,
lib/fathom/objects/site.rb,
lib/fathom/objects/event.rb,
lib/fathom/objects/account.rb,
lib/fathom/resources/sites.rb,
lib/fathom/resources/events.rb,
lib/fathom/resources/account.rb,
lib/fathom/resources/aggregations.rb,
lib/fathom/resources/current_visitors.rb

Defined Under Namespace

Classes: Account, AccountResource, AggregationsResource, Client, CurrentVisitorsResource, Error, Event, EventsResource, List, Object, Resource, Site, SitesResource

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.build_object(data) ⇒ Object



25
26
27
28
29
30
# File 'lib/fathom.rb', line 25

def self.build_object(data)
  return data unless data.is_a?(Hash)
  type = data.fetch("object", "object")
  class_name = type.split("_").map(&:capitalize).join
  Fathom.const_get(class_name).new(data)
end