class Snapcat::Snap
Constants
- ALLOWED_FIELD_CONVERSIONS
Public Class Methods
new(data = {})
click to toggle source
# 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
Public Instance Methods
received?()
click to toggle source
# File lib/snapcat/snap.rb, line 27 def received? !sent? end
sent?()
click to toggle source
# File lib/snapcat/snap.rb, line 31 def sent? !!media_id end
Private Instance Methods
humanize_data(data)
click to toggle source
# File lib/snapcat/snap.rb, line 37 def humanize_data(data) ALLOWED_FIELD_CONVERSIONS.each do |api_field, human_field| instance_variable_set( "@#{human_field}", data[human_field] || data[api_field] ) end end