Sha256: ef10bfc0b2ce8c7124a78f33bbec2206eb036f5b9f59079687a28e9c53ac74db

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

module Docusigner
  class User < Docusigner::Base
    belongs_to :account
    has_one :profile

    # DocuSign does not permit this endpoint
    def update
      raise "Not permitted"
    end

    # the create endpoint requires attributes to be nested under newUsers
    def as_json
      { "newUsers" => [super] }
    end

    protected

    def id_from_response(response)
      json = JSON.parse(response.body)
      json["newUsers"].first["userId"]
    end

    def load(attributes, remove_root = false)
      if attributes.is_a?(Array)
        attributes = attributes.first
      end
      super(attributes, remove_root)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
docusigner-0.0.6 lib/docusigner/user.rb
docusigner-0.0.5 lib/docusigner/user.rb
docusigner-0.0.4 lib/docusigner/user.rb
docusigner-0.0.3 lib/docusigner/user.rb
docusigner-0.0.2 lib/docusigner/user.rb