Class: Odnoklassniki::REST::Mediatopic::Content
- Inherits:
-
Object
- Object
- Odnoklassniki::REST::Mediatopic::Content
- Defined in:
- lib/odnoklassniki/rest/mediatopic/content.rb
Constant Summary collapse
- VIDEO_LINK_PATTERN =
/youtu\.?be|vimeo/.freeze
- AUDIO_LINK_PATTERN =
/soundcloud|snd\.cc/.freeze
- EMBEDABLE_LINK_PATTERN =
/#{VIDEO_LINK_PATTERN}|#{AUDIO_LINK_PATTERN}/.freeze
- TEXT_TYPE =
'text'.freeze
- LINK_TYPE =
'link'.freeze
- PHOTO_TYPE =
'photo'.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #images ⇒ Object
-
#initialize(options = {}) ⇒ Content
constructor
Options: text: string with message to OK (default: ”) images: Array of File (default: []) account_type: :group/:personal (default: :personal).
- #link ⇒ Object
- #message ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Content
Options: text: string with message to OK (default: ”) images: Array of File (default: []) account_type: :group/:personal (default: :personal)
18 19 20 |
# File 'lib/odnoklassniki/rest/mediatopic/content.rb', line 18 def initialize(={}) @options = Odnoklassniki::Utils._symbolize_kyes() end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'lib/odnoklassniki/rest/mediatopic/content.rb', line 12 def @options end |
Instance Method Details
#images ⇒ Object
34 35 36 |
# File 'lib/odnoklassniki/rest/mediatopic/content.rb', line 34 def images @images ||= [uploaded_images].compact end |
#link ⇒ Object
29 30 31 32 |
# File 'lib/odnoklassniki/rest/mediatopic/content.rb', line 29 def link @link ||= \ external_url.blank? ? nil : {type: LINK_TYPE, url: external_url} end |
#message ⇒ Object
22 23 24 25 26 27 |
# File 'lib/odnoklassniki/rest/mediatopic/content.rb', line 22 def @message ||= { type: TEXT_TYPE, text: (text || '') } end |