Sha256: 8487f0ecbe6851d46b321fff6be5b3cecb59aa27080f93f9f1ed1d73dffb602d

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

module Docusigner
  class User < Docusigner::Base
    belongs_to :account
    has_one :profile
    has_one :settings, :class_name => "Docusigner::UserSettings"

    # 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

2 entries across 2 versions & 1 rubygems

Version Path
docusigner-0.0.9 lib/docusigner/user.rb
docusigner-0.0.8 lib/docusigner/user.rb