Sha256: e0f2d7ef7c2f0e57a1e5e1631c76336b559098afc004875b0caaf2909bf8ab78
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'gowalla' module Stratify module Gowalla class Query attr_reader :username, :password def initialize(username, password) @username = username @password = password end def activities raw_activities.map {|raw_activity| build_activity_from_raw_data(raw_activity)} end private def raw_activities gowalla = ::Gowalla::Client.new(:username => username, :password => password, :api_key => 'fa574894bddc43aa96c556eb457b4009') gowalla.user_events end def build_activity_from_raw_data(data) Stratify::Gowalla::Activity.new({ :checkin_id => extract_id_from_checkin_url(data.url), :spot_name => data.spot.name, :spot_city_state => data.spot.city_state, :spot_latitude => data.spot.lat, :spot_longitude => data.spot.lng, :created_at => data.created_at }) end def extract_id_from_checkin_url(url) return unless url url.slice(/\d*$/) # parse the checkin_id out of the url "/checkins/18805305" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stratify-gowalla-0.1.0 | lib/stratify-gowalla/query.rb |