Class: PagSeguro::SubscriptionDiscount

Inherits:
Object
  • Object
show all
Includes:
Extensions::Credentiable, Extensions::MassAssignment
Defined in:
lib/pagseguro/subscription_discount.rb,
lib/pagseguro/subscription_discount/response.rb,
lib/pagseguro/subscription_discount/request_serializer.rb

Defined Under Namespace

Classes: RequestSerializer, Response

Constant Summary collapse

API_VERSION =
:v2

Instance Attribute Summary collapse

Attributes included from Extensions::Credentiable

#credentials

Instance Method Summary collapse

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#codeObject

The code of subscription, not the plan



15
16
17
# File 'lib/pagseguro/subscription_discount.rb', line 15

def code
  @code
end

#typeObject

Type of discount, it can be DISCOUNT_PERCENT or DISCOUNT_AMOUNT.



9
10
11
# File 'lib/pagseguro/subscription_discount.rb', line 9

def type
  @type
end

#valueObject

Value of discount



12
13
14
# File 'lib/pagseguro/subscription_discount.rb', line 12

def value
  @value
end

Instance Method Details

#createObject

The server returns only with a 200 response in case of success.



23
24
25
26
27
28
29
# File 'lib/pagseguro/subscription_discount.rb', line 23

def create
  request = Request.put_xml("pre-approvals/#{code}/discount", credentials, xml_params)

  Response.new(request, self).serialize

  self
end

#errorsObject

Set errors



18
19
20
# File 'lib/pagseguro/subscription_discount.rb', line 18

def errors
  @errors ||= Errors.new
end