Class: PostProxy::InstagramParams

Inherits:
Model
  • Object
show all
Defined in:
lib/postproxy/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ InstagramParams

Returns a new instance of InstagramParams.



679
680
681
682
683
684
685
# File 'lib/postproxy/types.rb', line 679

def initialize(**attrs)
  @user_tags = nil
  super
  @user_tags = @user_tags&.map do |t|
    t.is_a?(InstagramUserTag) ? t : InstagramUserTag.new(**t.transform_keys(&:to_sym))
  end
end

Instance Attribute Details

#audio_nameObject

Returns the value of attribute audio_name.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def audio_name
  @audio_name
end

#collaboratorsObject

Returns the value of attribute collaborators.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def collaborators
  @collaborators
end

#cover_urlObject

Returns the value of attribute cover_url.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def cover_url
  @cover_url
end

#first_commentObject

Returns the value of attribute first_comment.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def first_comment
  @first_comment
end

#formatObject

Returns the value of attribute format.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def format
  @format
end

#thumb_offsetObject

Returns the value of attribute thumb_offset.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def thumb_offset
  @thumb_offset
end

#trial_strategyObject

Returns the value of attribute trial_strategy.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def trial_strategy
  @trial_strategy
end

#user_tagsObject

Returns the value of attribute user_tags.



676
677
678
# File 'lib/postproxy/types.rb', line 676

def user_tags
  @user_tags
end

Instance Method Details

#to_hObject

User tags must reach the wire as plain hashes, with unset coordinates dropped rather than sent as nulls.



689
690
691
692
693
694
695
696
697
698
# File 'lib/postproxy/types.rb', line 689

def to_h
  result = super
  tags = result[:user_tags]
  return result if tags.nil?

  result[:user_tags] = tags.map do |t|
    (t.is_a?(Model) ? t.to_h : t).reject { |_, v| v.nil? }
  end
  result
end