Sha256: b29ca73f1e2006b6b0dca662d129d6f47ecbe692e31250ed66734d83e8e36f98

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

module Zoop
  class Seller < Zoop::Model

    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

    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.1.0 lib/zoop/resources/seller.rb