class EasyPayULatam::RApi::Plan

Attributes

params[RW]
resource[RW]
url[R]

Public Class Methods

new(id=nil) click to toggle source

in order to take the correct url

# File lib/easy_pay_u_latam/r_api/plan.rb, line 8
def initialize(id=nil)
  url
  @params = empty_object
  return if id.nil?
  load(id)
end

Public Instance Methods

id() click to toggle source

override from request

# File lib/easy_pay_u_latam/r_api/plan.rb, line 25
def id
  raise ArgumentError, 'plan is nil' if @resource.nil?
  @resource['planCode'] if @resource
end
update(params={}) click to toggle source
# File lib/easy_pay_u_latam/r_api/plan.rb, line 15
def update(params={})
  @http_verb = 'Put'
  @url += id.to_s

  @params = params if !params.empty?
  http
  @resource = @response if @response
end

Private Instance Methods

empty_object() click to toggle source
# File lib/easy_pay_u_latam/r_api/plan.rb, line 36
def empty_object
  {
    "accountId": RApi.account_id,
    "planCode": "Utopicko-plan01",
    "description": "Suscripción Utopicko",
    "interval": "MONTH",#MONTH
    "intervalCount": "1",
    "maxPaymentsAllowed": "12",
    "paymentAttemptsDelay": "1",
    "trialDays": "0",
    "additionalValues": [
      {
        "name": "PLAN_VALUE",
        "value": "20000",
        "currency": "COP"
      }
    ]
  }
end