Class: Snapcat::Snap

Inherits:
Object
  • Object
show all
Defined in:
lib/snapcat/snap.rb

Defined Under Namespace

Classes: Status

Constant Summary collapse

ALLOWED_FIELD_CONVERSIONS =
{
  broadcast: :broadcast,
  broadcast_action_text: :broadcast_action_text,
  broadcast_hide_timer: :broadcast_hide_timer,
  broadcast_url: :broadcast_url,
  c: :screenshot_count,
  c_id: :media_id,
  id: :id,
  m: :media_type,
  rp: :recipient,
  sn: :sender,
  st: :status,
  sts: :sent,
  ts: :opened
}

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Snap

Returns a new instance of Snap.



21
22
23
24
25
# File 'lib/snapcat/snap.rb', line 21

def initialize(data = {})
  humanize_data(data)
  @status = Status.new(@status)
  @media_type = Media::Type.new(code: @media_type)
end

Instance Method Details

#received?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/snapcat/snap.rb', line 27

def received?
  !sent?
end

#sent?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/snapcat/snap.rb', line 31

def sent?
  !!media_id
end