Sha256: 34b48c902a44d0f34cde086b1f39f8f512484d60c7e6649d7a5b1fb4ff332cf6

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

require 'faraday'
require 'json'

module Bond
  class EnvelopePreview < Preview
    attr_accessor :encoded_envelope, :encoded_envelope_hash, :encoded_envelope_timestamp, :img

    # @return [Hash] attributes
    def request_preview
      response = Bond::Connection.connection.post('/messages/preview/envelope', 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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bond-ruby-0.2.0 lib/bond/preview/envelope_preview.rb
bond-ruby-0.1.0 lib/bond/preview/envelope_preview.rb