Sha256: 26a92ef25ead252c68130ffb88ed16dd70b3f96adda1ec72ef1c7ee68686f3c0

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Zoop
  class Seller < Zoop::CustomerCommon

    def create
      @custom_url = self.class.url(mount_url)
      super
    end

    def update(params={})
      raise RequestError.new('Invalid ID') unless id.present?
      @custom_url = self.class.url(mount_url, CGI.escape(id.to_s))
      super
    end

    def save
      raise RequestError.new('Invalid ID') unless id.present?
      @custom_url = self.class.url(mount_url, CGI.escape(id.to_s))
      super
    end

    def receiving_policy
      Zoop::Request.get(url 'receiving_policy').call
    end

    def update_receiving_policy(params={})
      Zoop::Request.post(url('receiving_policy'), params: params).call
    end

    def documents
      Zoop::Request.get( url 'documents' ).call
    end

    def upload_documents(params={})
      Zoop::Request.post(url('documents'), params: params).call
    end

    def bank_accounts
      Zoop::Request.get( url 'bank_accounts' ).call
    end

    def transactions
      Zoop::Request.get( url 'transactions' ).call
    end

    private

    def mount_url
      self.type == 'business' ? 'businesses' : 'individuals'
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zoop-0.3.2 lib/zoop/resources/seller.rb