Sha256: 2a170a01a9875a44d57989b3f8fa75fd434b29dcde502179a8b2c3968efd9d36

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

require "omise/object"
require "omise/charge_list"

module Omise
  class Link < OmiseObject
    self.endpoint = "/links"

    def self.search
      SearchScope.new(:link)
    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 self.create(attributes = {})
      new resource(location, attributes).post(attributes)
    end

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

    def charges(options = {})
      if options.empty?
        list_attribute ChargeList, "charges"
      else
        response = collection.resource(location("charges")).get(options)
        ChargeList.new(self, response)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omise-0.5.0 lib/omise/link.rb