Sha256: 86937d4db1ca8a63126006a31e28a9b256f406c693b3fc729d6c0f712b7e5d59

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module PagSeguro
  class Plans
    include Restful

    def create(params)
      params[:amount_per_payment] = to_money params[:amount_per_payment]
      params = parameterize params

      post("/pre-approvals/request", preApproval: params)
    end

    def update(code, params)
      params[:amount_per_payment] = to_money params[:amount_per_payment]
      params = parameterize params

      put("/pre-approvals/request/#{code}/payment", params)
    end

    private
      def to_money(value)
        format "%.2f", value.to_f
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagseguro_next-1.0.1 lib/pagseguro/plans.rb