Class: Pagseguro::Charge::InstructionLines
- Inherits:
-
Object
- Object
- Pagseguro::Charge::InstructionLines
- Defined in:
- lib/pagseguro/charge/instruction_lines.rb
Overview
Credit card data
Instance Attribute Summary collapse
-
#line_1 ⇒ Object
Returns the value of attribute line_1.
-
#line_2 ⇒ Object
Returns the value of attribute line_2.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(args = {}) ⇒ InstructionLines
constructor
A new instance of InstructionLines.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ InstructionLines
Returns a new instance of InstructionLines.
9 10 11 12 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 9 def initialize(args = {}) @line_1 = args[:line_1] @line_2 = args[:line_2] end |
Instance Attribute Details
#line_1 ⇒ Object
Returns the value of attribute line_1.
6 7 8 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 6 def line_1 @line_1 end |
#line_2 ⇒ Object
Returns the value of attribute line_2.
6 7 8 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 6 def line_2 @line_2 end |
Class Method Details
.fill_from_json(data) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 20 def self.fill_from_json(data) return if data.nil? instruction_line = new instruction_line.line_1 = data["line_1"] instruction_line.line_2 = data["line_2"] instruction_line end |
Instance Method Details
#as_json(options = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 29 def as_json(={}) { line_1: @line_1, line_2: @line_2 } end |
#to_json(*options) ⇒ Object
14 15 16 17 18 |
# File 'lib/pagseguro/charge/instruction_lines.rb', line 14 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |