Class: Garbanzo::AST::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/garbanzo/ast/create.rb

Instance Attribute Summary

Attributes inherited from Base

#nodes

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Garbanzo::AST::Base

Instance Method Details

#build(amount, card, address, duration, interval) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/garbanzo/ast/create.rb', line 4

def build(amount, card, address, duration, interval)
  hash = {
    subscription: {
      payment_schedule: {
        interval: interval.to_h,
        start_date: duration.start_date,
        total_occurrences: duration.occurrences
      },
      amount: amount.to_i,
      payment: {
        credit_card: card.to_h
      },
      bill_to: address.to_h,
    }
  }

  set_nodes hash
end