Class: Bond::MessagePreview

Inherits:
Preview
  • Object
show all
Defined in:
lib/bond/preview/message_preview.rb

Instance Attribute Summary collapse

Attributes inherited from Preview

#request_params

Instance Method Summary collapse

Methods inherited from Preview

#initialize

Constructor Details

This class inherits a constructor from Bond::Preview

Instance Attribute Details

#encoded_contentObject

Returns the value of attribute encoded_content.



6
7
8
# File 'lib/bond/preview/message_preview.rb', line 6

def encoded_content
  @encoded_content
end

#encoded_content_hashObject

Returns the value of attribute encoded_content_hash.



6
7
8
# File 'lib/bond/preview/message_preview.rb', line 6

def encoded_content_hash
  @encoded_content_hash
end

#encoded_content_timestampObject

Returns the value of attribute encoded_content_timestamp.



6
7
8
# File 'lib/bond/preview/message_preview.rb', line 6

def 
  
end

#imgObject

Returns the value of attribute img.



6
7
8
# File 'lib/bond/preview/message_preview.rb', line 6

def img
  @img
end

Instance Method Details

#request_previewHash

Returns attributes.

Returns:

  • (Hash)

    attributes



9
10
11
12
13
14
15
16
17
18
# File 'lib/bond/preview/message_preview.rb', line 9

def request_preview
  response = Bond::Connection.connection.post('/messages/preview/content', request_params)
  json = JSON.parse(response.body)

  Bond::BondError.handle_errors(json)

  attributes = json['data']
  attributes.each { |name, value| instance_variable_set("@#{name}", value) }
  attributes
end