Class: PagSeguro::PreApproval

Inherits:
Object
  • Object
show all
Extended by:
ConvertFieldToDigit
Includes:
ActiveModel::Validations
Defined in:
lib/pag_seguro/pre_approval.rb

Constant Summary collapse

PERIOD_TYPES =
%w(weekly monthly bimonthly trimonthly semiannually yearly)
DAYS_OF_WEEK =
%w(monday tuesday wednesday thursday friday saturday sunday)
DATE_RANGE =
17856.hours

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConvertFieldToDigit

attr_reader_as_digit

Constructor Details

#initialize(options = {}) ⇒ PreApproval

Returns a new instance of PreApproval.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/pag_seguro/pre_approval.rb', line 27

def initialize(options = {})
  @name = options[:name]
  @details = options[:details]
  @amount_per_payment = options[:amount_per_payment]
  @period = options[:period]
  @day_of_week = options[:day_of_week]
  @day_of_month = options[:day_of_month]
  @day_of_year = options[:day_of_year]
  @initial_date = options[:initial_date]
  @final_date = options[:final_date]
  @max_amount_per_period = options[:max_amount_per_period]
  @max_total_amount = options[:max_total_amount]
  @review_URL = options[:review_URL]
end

Instance Attribute Details

#amount_per_paymentObject

Returns the value of attribute amount_per_payment.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def amount_per_payment
  @amount_per_payment
end

#day_of_monthObject

Returns the value of attribute day_of_month.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def day_of_month
  @day_of_month
end

#day_of_weekObject

Returns the value of attribute day_of_week.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def day_of_week
  @day_of_week
end

#day_of_yearObject

Returns the value of attribute day_of_year.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def day_of_year
  @day_of_year
end

#detailsObject

Returns the value of attribute details.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def details
  @details
end

#final_dateObject

Returns the value of attribute final_date.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def final_date
  @final_date
end

#initial_dateObject

Returns the value of attribute initial_date.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def initial_date
  @initial_date
end

#max_amount_per_periodObject

Returns the value of attribute max_amount_per_period.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def max_amount_per_period
  @max_amount_per_period
end

#max_total_amountObject

Returns the value of attribute max_total_amount.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def max_total_amount
  @max_total_amount
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def name
  @name
end

#periodObject

Returns the value of attribute period.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def period
  @period
end

#review_URLObject

Returns the value of attribute review_URL.



10
11
12
# File 'lib/pag_seguro/pre_approval.rb', line 10

def review_URL
  @review_URL
end

Instance Method Details

#monthly?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/pag_seguro/pre_approval.rb', line 66

def monthly?
  %w(monthly bimonthly trimonthly).include? period
end

#weekly?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/pag_seguro/pre_approval.rb', line 62

def weekly?
  period == 'weekly'
end

#yearly?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/pag_seguro/pre_approval.rb', line 70

def yearly?
  period == 'yearly'
end