Sha256: 9b243f73bf449c45d1bb835085c8c59b05386d268f12b40c0863472be76fe63d

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

module Docusigner
  class Envelope < Docusigner::Base
    module Status
      CREATED   = "created"
      DELETED   = "deleted"
      SENT      = "sent"
      DELIVERED = "delivered"
      SIGNED    = "signed"
      COMPLETED = "completed"
      DECLINED  = "declined"
      VOIDED    = "voided"
      TIMED_OUT = "timedout"
      AUTHORITATIVE_COPY  = "authoritativecopy"
      TRANSFER_COMPLETED  = "transfercompleted"
      TEMPLATE  = "template"
      CORRECT   = "correct"
    end

    belongs_to :account

    has_many :documents
    has_many :recipients

    def id
      attributes["envelopeId"]
    end

    def send!
      update_attribute(:status, Docusigner::Envelope::Status::SENT)
    end

    def void!(reason)
      update_attributes({
        :status => Docusigner::Envelope::Status::VOIDED,
        :voidReason => reason
      })
    end

    def recipient_url(params = {})
      resp = post("views/recipient", prefix_options, params.to_json)
      self.class.format.decode(resp.body)
    end

    def sender_url(params = {})
      resp = post("views/sender", prefix_options, params.to_json)
      self.class.format.decode(resp.body)
    end

    def correct_url(params = {})
      resp = post("views/correct", prefix_options, params.to_json)
      self.class.format.decode(resp.body)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docusigner-0.0.2 lib/docusigner/envelope.rb
docusigner-0.0.1 lib/docusigner/envelope.rb