Class: FaceGroups::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/facegroups/attachment.rb

Overview

Attached URL to Posting

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Attachment

Returns a new instance of Attachment.



8
9
10
11
12
13
14
15
# File 'lib/facegroups/attachment.rb', line 8

def initialize(data)
  return unless data
  attachment_data = data['data'].first
  @title = attachment_data['title']
  @description = attachment_data['description']
  @url = attachment_data['url']
  @media_url = attachment_data&.[]('media')&.[]('image')&.[]('src')
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/facegroups/attachment.rb', line 6

def description
  @description
end

#media_urlObject (readonly)

Returns the value of attribute media_url.



6
7
8
# File 'lib/facegroups/attachment.rb', line 6

def media_url
  @media_url
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/facegroups/attachment.rb', line 6

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/facegroups/attachment.rb', line 6

def url
  @url
end