Sha256: 962db191653f3e9e302ec4ecb042c0659b32d2325472407ac4876efa23c1a754

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

module Lanyrd
  class Client
    def search(query)
      get "search/?q=#{query}"
    end

    def popular
      get "search/"
    end

    def event(slug, year = Time.now.year)
      get "#{year}/#{slug}/"
    end

    def speakers(slug, year = Time.now.year)
      get "#{year}/#{slug}/speakers/"
    end

    def attendees(slug, year = Time.now.year)
      get "#{year}/#{slug}/attendees/"
    end
    
    def schedule(slug, year = Time.now.year)
      get "#{year}/#{slug}/schedule/"
    end
    
    def profile(username)
      get "profile/#{username}/"
    end

    private

    def get(path)
      response = connection.get path
      decode response.body
    end

    def decode(data)
      JSON.parse(data)
    end

    def connection
      Faraday.new(:url => 'http://lanyrd.com/mobile/ios2/')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lanyrd-0.1.1 lib/lanyrd/client.rb