class Upay::Plan
Public Class Methods
new(args = {})
click to toggle source
# File lib/upay/plan.rb, line 3 def initialize(args = {}) args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end
Public Instance Methods
accountId()
click to toggle source
# File lib/upay/plan.rb, line 9 def accountId; @accountId end
accountId=(accountId)
click to toggle source
# File lib/upay/plan.rb, line 10 def accountId=(accountId) @accountId = accountId end
additionalValues()
click to toggle source
# File lib/upay/plan.rb, line 54 def additionalValues; @additionalValues end
additionalValues=(additionalValues)
click to toggle source
# File lib/upay/plan.rb, line 55 def additionalValues=(additionalValues) @additionalValues = additionalValues end
create()
click to toggle source
Verb: POST Description: Returns: JSON
# File lib/upay/plan.rb, line 72 def create url = "rest/v4.3/plans" Requestor.new.post(url, self.to_hash) end
currency()
click to toggle source
# File lib/upay/plan.rb, line 34 def currency; @currency end
currency=(currency)
click to toggle source
# File lib/upay/plan.rb, line 35 def currency=(currency) @currency = currency end
delete()
click to toggle source
Verb: DELETE Description: Returns: JSON
# File lib/upay/plan.rb, line 107 def delete url = "rest/v4.3/plans/#{self.planCode}" Requestor.new.delete(url, self.to_hash) end
description()
click to toggle source
# File lib/upay/plan.rb, line 19 def description; @description end
description=(description)
click to toggle source
# File lib/upay/plan.rb, line 20 def description=(description) @description = description end
find_by_name(name)
click to toggle source
# File lib/upay/plan.rb, line 94 def find_by_name(name) url = "rest/v4.3/plans/" request = Requestor.new.get(url, {}) obtained_plan = {} request["subscriptionPlanList"].each do |plan| obtained_plan = plan if plan["planCode"] == name end obtained_plan end
interval()
click to toggle source
# File lib/upay/plan.rb, line 24 def interval; @interval end
interval=(interval)
click to toggle source
# File lib/upay/plan.rb, line 25 def interval=(interval) @interval = interval end
intervalCount()
click to toggle source
# File lib/upay/plan.rb, line 39 def intervalCount; @intervalCount end
intervalCount=(intervalCount)
click to toggle source
# File lib/upay/plan.rb, line 40 def intervalCount=(intervalCount) @intervalCount = intervalCount end
maxPaymentsAllowed()
click to toggle source
# File lib/upay/plan.rb, line 44 def maxPaymentsAllowed; @maxPaymentsAllowed end
maxPaymentsAllowed=(maxPaymentsAllowed)
click to toggle source
# File lib/upay/plan.rb, line 45 def maxPaymentsAllowed=(maxPaymentsAllowed) @maxPaymentsAllowed = maxPaymentsAllowed end
paymentAttempsDelay()
click to toggle source
# File lib/upay/plan.rb, line 49 def paymentAttempsDelay; @paymentAttempsDelay end
paymentAttempsDelay=(paymentAttempsDelay)
click to toggle source
# File lib/upay/plan.rb, line 50 def paymentAttempsDelay=(paymentAttempsDelay) @paymentAttempsDelay = paymentAttempsDelay end
planCode()
click to toggle source
# File lib/upay/plan.rb, line 14 def planCode; @planCode end
planCode=(planCode)
click to toggle source
# File lib/upay/plan.rb, line 15 def planCode=(planCode) @planCode = planCode end
show()
click to toggle source
Verb: POST Description: Returns: JSON
# File lib/upay/plan.rb, line 89 def show url = "rest/v4.3/plans/#{self.planCode}" Requestor.new.get(url, self.to_hash) end
to_hash()
click to toggle source
# File lib/upay/plan.rb, line 112 def to_hash { :accountId => self.accountId || nil, :planCode => self.planCode, :description => self.description, :interval => self.interval, :intervalCount => self.intervalCount, :maxPaymentsAllowed => self.maxPaymentsAllowed || nil, :paymentAttemptsDelay => "1", :additionalValues => [ { :name => "PLAN_VALUE", :value => self.value, :currency => "COP" } ] } end
trialDays()
click to toggle source
# File lib/upay/plan.rb, line 59 def trialDays; @trialDays end
trialDays=(trialDays)
click to toggle source
# File lib/upay/plan.rb, line 60 def trialDays=(trialDays) @trialDays = trialDays end
update()
click to toggle source
Verb: UPDATE Description: Returns: JSON
# File lib/upay/plan.rb, line 81 def update url = "rest/v4.3/plans/#{self.planCode}" Requestor.new.put(url, self.to_hash) end
valid?()
click to toggle source
# File lib/upay/plan.rb, line 64 def valid? validator = PlanValidator.new validator.valid?(self) end
value()
click to toggle source
# File lib/upay/plan.rb, line 29 def value; @value end
value=(value)
click to toggle source
# File lib/upay/plan.rb, line 30 def value=(value) @value = value end