Class: PostProxy::PlatformParams

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from PostProxy::Model

Instance Attribute Details

#facebookObject

Returns the value of attribute facebook.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def facebook
  @facebook
end

#instagramObject

Returns the value of attribute instagram.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def instagram
  @instagram
end

#linkedinObject

Returns the value of attribute linkedin.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def linkedin
  @linkedin
end

#pinterestObject

Returns the value of attribute pinterest.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def pinterest
  @pinterest
end

#threadsObject

Returns the value of attribute threads.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def threads
  @threads
end

#tiktokObject

Returns the value of attribute tiktok.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def tiktok
  @tiktok
end

#twitterObject

Returns the value of attribute twitter.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def twitter
  @twitter
end

#youtubeObject

Returns the value of attribute youtube.



303
304
305
# File 'lib/postproxy/types.rb', line 303

def youtube
  @youtube
end

Instance Method Details

#to_hObject



306
307
308
309
310
311
312
313
314
315
316
# File 'lib/postproxy/types.rb', line 306

def to_h
  result = {}
  %i[facebook instagram tiktok linkedin youtube pinterest threads twitter].each do |platform|
    value = send(platform)
    next if value.nil?

    params = value.is_a?(Model) ? value.to_h : value
    result[platform] = params.reject { |_, v| v.nil? }
  end
  result
end