Sha256: 4bff78c34dcc45fccaede51371a9d617b1e53c0662249df0c0a1de731a76f9d0
Contents?: true
Size: 1.66 KB
Versions: 8
Compression:
Stored size: 1.66 KB
Contents
module EasyPayULatam module RApi class Plan < Request attr_reader :url attr_accessor :resource, :params # in order to take the correct url def initialize(id=nil) url @params = empty_object return if id.nil? load(id) end def update(params={}) @http_verb = 'Put' @url += id.to_s @params = params if !params.empty? http @resource = @response if @response end # override from request def id raise ArgumentError, 'plan is nil' if @resource.nil? @resource['planCode'] if @resource end def url @url = RApi.base_url + '/rest/v4.9/plans/' end private 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 end end end # {"id"=>"f7bad364-29f9-4cc2-b0c1-c92e271803a1", # "planCode"=>"Utopicko-plan01", # "description"=>"Suscripción Utopicko", # "accountId"=>"512321", # "intervalCount"=>1, # "interval"=>"MONTH", # "maxPaymentsAllowed"=>12, # "maxPaymentAttempts"=>0, # "paymentAttemptsDelay"=>1, # "maxPendingPayments"=>0, # # "trialDays"=>0, # "additionalValues"=>[{"name"=>"PLAN_VALUE", "value"=>20000, "currency"=>"COP"}]}
Version data entries
8 entries across 8 versions & 1 rubygems