Class: Pagseguro::Charge::Boleto
- Inherits:
-
Object
- Object
- Pagseguro::Charge::Boleto
- Defined in:
- lib/pagseguro/charge/boleto.rb
Overview
Credit card data
Instance Attribute Summary collapse
-
#barcode ⇒ Object
Returns the value of attribute barcode.
-
#brand ⇒ String
Credit card brand.
-
#due_date ⇒ Object
Returns the value of attribute due_date.
-
#exp_month ⇒ integer
Credit card expiration month.
-
#exp_year ⇒ Integer
Credit card expiration year.
-
#formatted_barcode ⇒ Object
Returns the value of attribute formatted_barcode.
-
#holder ⇒ Object
Returns the value of attribute holder.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instruction_lines ⇒ Object
Returns the value of attribute instruction_lines.
-
#number ⇒ Long
Credit card number.
-
#security_code ⇒ String
Credit card security_code.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(args = {}) ⇒ Boleto
constructor
A new instance of Boleto.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Boleto
Returns a new instance of Boleto.
19 20 21 22 23 |
# File 'lib/pagseguro/charge/boleto.rb', line 19 def initialize(args = {}) @due_date = args[:due_date] @instruction_lines = args[:instruction_lines] @holder = args[:holder] end |
Instance Attribute Details
#barcode ⇒ Object
Returns the value of attribute barcode.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def end |
#brand ⇒ String
Credit card brand
10 11 12 |
# File 'lib/pagseguro/charge/boleto.rb', line 10 def brand @brand end |
#due_date ⇒ Object
Returns the value of attribute due_date.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def due_date @due_date end |
#exp_month ⇒ integer
Credit card expiration month
10 11 12 |
# File 'lib/pagseguro/charge/boleto.rb', line 10 def exp_month @exp_month end |
#exp_year ⇒ Integer
Credit card expiration year
10 11 12 |
# File 'lib/pagseguro/charge/boleto.rb', line 10 def exp_year @exp_year end |
#formatted_barcode ⇒ Object
Returns the value of attribute formatted_barcode.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def end |
#holder ⇒ Object
Returns the value of attribute holder.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def holder @holder end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def id @id end |
#instruction_lines ⇒ Object
Returns the value of attribute instruction_lines.
11 12 13 |
# File 'lib/pagseguro/charge/boleto.rb', line 11 def instruction_lines @instruction_lines end |
#number ⇒ Long
Credit card number
10 11 12 |
# File 'lib/pagseguro/charge/boleto.rb', line 10 def number @number end |
#security_code ⇒ String
Credit card security_code
10 11 12 |
# File 'lib/pagseguro/charge/boleto.rb', line 10 def security_code @security_code end |
Class Method Details
.fill_from_json(data) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pagseguro/charge/boleto.rb', line 31 def self.fill_from_json(data) return if data.nil? boleto = new boleto.due_date = data["due_date"] boleto.instruction_lines = InstructionLines.fill_from_json(data["instruction_lines"]) boleto.holder = Holder.fill_from_json(data["holder"]) boleto. = data["barcode"] boleto.id = data["id"] boleto. = data["formatted_barcode"] boleto end |
Instance Method Details
#as_json(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pagseguro/charge/boleto.rb', line 44 def as_json(={}) { id: @id, due_date: @due_date, instruction_lines: @instruction_lines, barcode: , formatted_barcode: , holder: @holder } end |
#to_json(*options) ⇒ Object
25 26 27 28 29 |
# File 'lib/pagseguro/charge/boleto.rb', line 25 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |