class Braspag::RecurrentPayment

Constants

INTERVAL_ANNUAL
INTERVAL_BIMONTHLY
INTERVAL_MONTHLY
INTERVAL_QUARTERLY
INTERVAL_SEMIANNUAL

Attributes

authorize_now[RW]
end_date[RW]
interval[RW]
start_date[RW]

Public Class Methods

from_json(data) click to toggle source
# File lib/braspag/api/recurrent_payment.rb, line 24
def self.from_json(data)
    if (data != nil)
        recurrent_payment = RecurrentPayment.new(data["AuthorizeNow"] || false)

        recurrent_payment.start_date =data["StartDate"] || nil
        recurrent_payment.end_date =data["EndDate"] || nil
        recurrent_payment.interval =data["Interval"] || nil

        return recurrent_payment
    end
end
new(authorize_now=true) click to toggle source
# File lib/braspag/api/recurrent_payment.rb, line 14
def initialize(authorize_now=true)
    @authorize_now = authorize_now
end

Public Instance Methods

to_json(*options) click to toggle source
# File lib/braspag/api/recurrent_payment.rb, line 18
def to_json(*options)
    hash = as_json(*options)
    hash.reject! {|k,v| v.nil?}
    hash.to_json(*options)
end

Private Instance Methods

as_json(options={}) click to toggle source
# File lib/braspag/api/recurrent_payment.rb, line 37
def as_json(options={})
    {
        AuthorizeNow: @authorize_now,
        StartDate: @start_date,
        EndDate: @end_date,
        Interval: @interval
  }
end