Sha256: 6dc821a5d55df5da63e660227a51e9ba6719c73e9db26af411c201a5b84bcd5a

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require "omise/object"
require "omise/list"
require "omise/document_list"
require "omise/search_scope"

module Omise
  class Dispute < OmiseObject
    self.endpoint = "/disputes"

    def self.search
      SearchScope.new(:dispute)
    end

    def self.list(attributes = {})
      status = attributes.delete(:status)
      List.new resource(location(status), attributes).get(attributes)
    end

    def self.retrieve(id = nil, attributes = {})
      new resource(location(id), attributes).get(attributes)
    end

    def reload(attributes = {})
      assign_attributes resource(attributes).get(attributes)
    end

    def update(attributes = {})
      assign_attributes resource(attributes).patch(attributes)
    end

    def accept(attributes = {})
      assign_attributes nested_resource("accept", attributes).patch(attributes)
    end

    def charge(options = {})
      if !defined?(Charge)
        require "omise/charge"
      end

      expand_attribute Charge, "charge", options
    end

    def documents(options = {})
      list_nested_resource DocumentList, "documents", options
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omise-0.11.0 lib/omise/dispute.rb
omise-0.10.1 lib/omise/dispute.rb
omise-0.10.0 lib/omise/dispute.rb