Sha256: e03ee9f0e4d8fcd69fbfb8f51984ad1e1a97641ba02c87fc35dbf926139447d2

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

require_relative "./api_caller"

module Twitter
  class Tweet
    attr_accessor :created_at, :text
  end

  class User
    attr_accessor :screen_name, :profile_image_url
  end

  class Api < Dialers::Wrapper
    api_caller { ApiCaller.new }

    def get_user_timeline
      api_caller.get("statuses/user_timeline.json").transform_to_many(Tweet)
    end

    def get_user
      api_caller.get("account/verify_credentials.json").transform_to_one(User)
    end

    def search(query)
      api_caller.get("search/tweets.json", q: query).transform_to_many(Tweet, root: "statuses")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dialers-0.2.2 examples/twitter/api.rb
dialers-0.1.2 examples/twitter/api.rb
dialers-0.1.1 examples/twitter/api.rb
dialers-0.1.0 examples/twitter/api.rb