Sha256: e5c8aab325d322eb2588481bb5cc6838a95760e741c8335cd22733cbf77d8d3b

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module MangoPay
  module HTTPCalls
    module Create
      module ClassMethods

        def create(*id, params)
          id = id.empty? ? nil : id[0]
          response = MangoPay.request(:post, url(id), params)
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end

    module Update
      module ClassMethods
        def update(id = nil, params = {})
          response = MangoPay.request(:put, url(id), params)
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end

    module Fetch
      module ClassMethods
        def fetch(id = nil, filters = {})
          response = MangoPay.request(:get, url(id), filters)
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end

    module Refund
      module ClassMethods
        def refund(id = nil, params = {})
          MangoPay.request(:post, url(id) + '/refunds', params)
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mangopay-3.0.1 lib/mangopay/http_calls.rb