Class: PagSeguro::SubscriptionPaymentOrder

Inherits:
Object
  • Object
show all
Includes:
Extensions::EnsureType, Extensions::MassAssignment
Defined in:
lib/pagseguro/subscription_payment_order.rb,
lib/pagseguro/subscription_payment_order/response.rb,
lib/pagseguro/subscription_payment_order/response_serializer.rb

Defined Under Namespace

Classes: Response, ResponseSerializer

Constant Summary collapse

STATUSES =
{
  scheduled: 1,
  processing: 2,
  not_processed: 3,
  suspended: 4,
  paid: 5,
  not_paid: 6
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extensions::EnsureType

#ensure_type

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



19
20
21
# File 'lib/pagseguro/subscription_payment_order.rb', line 19

def amount
  @amount
end

#codeObject

Returns the value of attribute code.



17
18
19
# File 'lib/pagseguro/subscription_payment_order.rb', line 17

def code
  @code
end

#discountObject

Returns the value of attribute discount.



23
24
25
# File 'lib/pagseguro/subscription_payment_order.rb', line 23

def discount
  @discount
end

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

#gross_amountObject

Returns the value of attribute gross_amount.



20
21
22
# File 'lib/pagseguro/subscription_payment_order.rb', line 20

def gross_amount
  @gross_amount
end

#last_event_dateObject

Returns the value of attribute last_event_date.



21
22
23
# File 'lib/pagseguro/subscription_payment_order.rb', line 21

def last_event_date
  @last_event_date
end

#scheduling_dateObject

Returns the value of attribute scheduling_date.



22
23
24
# File 'lib/pagseguro/subscription_payment_order.rb', line 22

def scheduling_date
  @scheduling_date
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

Class Method Details

.load_from_xml(xml) ⇒ Object



47
48
49
# File 'lib/pagseguro/subscription_payment_order.rb', line 47

def self.load_from_xml(xml)
  new ResponseSerializer.new(xml).serialize
end

Instance Method Details

#status_codeObject



39
40
41
# File 'lib/pagseguro/subscription_payment_order.rb', line 39

def status_code
  STATUSES[@status.to_sym]
end

#transactionsObject



29
30
31
# File 'lib/pagseguro/subscription_payment_order.rb', line 29

def transactions
  @transactions ||= SubscriptionTransactions.new
end

#transactions=(attrs) ⇒ Object



33
34
35
36
37
# File 'lib/pagseguro/subscription_payment_order.rb', line 33

def transactions=(attrs)
  attrs.each do |params|
    transactions << SubscriptionTransaction.new(params)
  end
end

#update_attributes(attrs) ⇒ Object



43
44
45
# File 'lib/pagseguro/subscription_payment_order.rb', line 43

def update_attributes(attrs)
  attrs.each {|name, value| send("#{name}=", value)  }
end