Sha256: 3fed87b1c54c1c861f8f841eae46e9da5739e0bb48b9373a59526b1749593659

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

class Post
  attr_accessor :id, :text, :user

  def initialize(attributes = {})
    self.id = attributes["id"].to_i
    self.text = attributes["text"].to_s
    self.user = User.new(attributes["user"])
  end

  def self.fetchGlobalTimelinePosts(&callback)
    AFMotion::Client.shared.get("stream/0/posts/stream/global") do |result|
      if result.success?
        posts = []
        result.object["data"].each do |attributes|
          posts << Post.new(attributes)
        end
        callback.call(posts, nil)
      else
        callback.call([], result.error)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
afmotion-0.0.1 examples/AppDotNet/app/post.rb