Sha256: 94f2a5c18e5198fd162fdbae2d728754b7df947d3719188ceefea9b9d01e11be

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require "omise/object"
require "omise/bank_account"
require "omise/search_scope"

module Omise
  class Transfer < OmiseObject
    self.endpoint = "/transfers"

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

    def self.schedule(attributes = {})
      Scheduler.new(:transfer, attributes)
    end

    def self.create(attributes = {})
      new resource(location, attributes).post(attributes)
    end

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

    def self.list(attributes = {})
      List.new resource(location, 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 destroy(attributes = {})
      assign_attributes resource(attributes).delete
    end

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

      expand_attribute Recipient, "recipient", options
    end

    def bank_account
      if !defined?(BankAccount)
        require "omise/bank_account"
      end

      expand_attribute BankAccount, "bank_account"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
omise-0.11.0 lib/omise/transfer.rb
omise-0.10.1 lib/omise/transfer.rb
omise-0.10.0 lib/omise/transfer.rb
omise-0.9.1 lib/omise/transfer.rb
omise-0.9.0 lib/omise/transfer.rb
omise-0.7.2 lib/omise/transfer.rb
omise-0.8.0 lib/omise/transfer.rb
omise-0.7.1 lib/omise/transfer.rb
omise-0.7.0 lib/omise/transfer.rb
omise-0.6.0 lib/omise/transfer.rb