Sha256: d4e9cd36060b5e75be7627b22ec4d1b44c3f129a9624cd3364c751ec851aa713

Contents?: true

Size: 811 Bytes

Versions: 7

Compression:

Stored size: 811 Bytes

Contents

require 'twitter/base'
require 'twitter/source_user'
require 'twitter/target_user'

module Twitter
  class Relationship < Twitter::Base

    # Initializes a new object
    #
    # @param attrs [Hash]
    # @return [Twitter::Relationship]
    def initialize(attrs={})
      @attrs = attrs[:relationship]
    end

    # @return [Twitter::SourceUser]
    def source
      @source ||= Twitter::SourceUser.fetch_or_new(@attrs[:source])
    end

    # @return [Twitter::TargetUser]
    def target
      @target ||= Twitter::TargetUser.fetch_or_new(@attrs[:target])
    end

    # Update the attributes of a Relationship
    #
    # @param attrs [Hash]
    # @return [Twitter::Relationship]
    def update(attrs)
      @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?
      self
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
twitter-4.4.0 lib/twitter/relationship.rb
twitter-4.3.0 lib/twitter/relationship.rb
twitter-4.2.0 lib/twitter/relationship.rb
twitter-4.1.2 lib/twitter/relationship.rb
twitter-4.1.1 lib/twitter/relationship.rb
twitter-4.1.0 lib/twitter/relationship.rb
twitter-4.0.0 lib/twitter/relationship.rb