Class: Braspag::Billet

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model
Defined in:
lib/cbraspag/payment/billet.rb

Defined Under Namespace

Classes: DueDateValidator

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#due_date_onObject

Returns the value of attribute due_date_on.



31
32
33
# File 'lib/cbraspag/payment/billet.rb', line 31

def due_date_on
  @due_date_on
end

#idObject

Returns the value of attribute id.



31
32
33
# File 'lib/cbraspag/payment/billet.rb', line 31

def id
  @id
end

#instructionsObject

Returns the value of attribute instructions.



31
32
33
# File 'lib/cbraspag/payment/billet.rb', line 31

def instructions
  @instructions
end

#urlObject

Returns the value of attribute url.



31
32
33
# File 'lib/cbraspag/payment/billet.rb', line 31

def url
  @url
end

Instance Method Details

#convert_to(method) ⇒ Object



38
39
40
# File 'lib/cbraspag/payment/billet.rb', line 38

def convert_to(method)
  self.send("to_#{method}")
end

#populate!(method, response) ⇒ Object



50
51
52
# File 'lib/cbraspag/payment/billet.rb', line 50

def populate!(method, response)
  self.send("populate_#{method}!", response)
end

#populate_generate_billet!(response) ⇒ Object



54
55
56
# File 'lib/cbraspag/payment/billet.rb', line 54

def populate_generate_billet!(response)
  self.url = response[:url]
end

#to_generate_billetObject



42
43
44
45
46
47
48
# File 'lib/cbraspag/payment/billet.rb', line 42

def to_generate_billet
  {
    :number => self.id.to_s,
    :instructions => self.instructions.to_s,
    :expiration_date => self.due_date_on.strftime("%d/%m/%y")
  }
end