Class: Twterm::Friendship

Inherits:
Object
  • Object
show all
Defined in:
lib/twterm/friendship.rb

Constant Summary collapse

STATUSES =
%i(
  blocking
  following
  following_requested
  muting
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, from, to) ⇒ Friendship

Returns a new instance of Friendship.



12
13
14
15
16
# File 'lib/twterm/friendship.rb', line 12

def initialize(status, from, to)
  fail ArgumentError, '`status` must be one of the following: :blocking, :follwing, :following_requested, or :muting' unless STATUSES.include? status

  @status, @from, @to = status, from, to
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



10
11
12
# File 'lib/twterm/friendship.rb', line 10

def from
  @from
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/twterm/friendship.rb', line 10

def status
  @status
end

#toObject (readonly)

Returns the value of attribute to.



10
11
12
# File 'lib/twterm/friendship.rb', line 10

def to
  @to
end

Instance Method Details

#blocking?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/twterm/friendship.rb', line 18

def blocking?
  status?(:blocking)
end

#following?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/twterm/friendship.rb', line 22

def following?
  status?(:following)
end

#following_requested?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/twterm/friendship.rb', line 26

def following_requested?
  status?(:following_requested)
end

#muting?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/twterm/friendship.rb', line 30

def muting?
  status?(:muting)
end