Class: Killbill::Plugin::Model::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/killbill/gen/api/plan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlan

Returns a new instance of Plan.



39
40
# File 'lib/killbill/gen/api/plan.rb', line 39

def initialize()
end

Instance Attribute Details

#all_phasesObject

Returns the value of attribute all_phases.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def all_phases
  @all_phases
end

#catalogObject

Returns the value of attribute catalog.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def catalog
  @catalog
end

#effective_date_for_existing_subscriptionsObject

Returns the value of attribute effective_date_for_existing_subscriptions.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def effective_date_for_existing_subscriptions
  @effective_date_for_existing_subscriptions
end

#final_phaseObject

Returns the value of attribute final_phase.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def final_phase
  @final_phase
end

#initial_phase_iteratorObject

Returns the value of attribute initial_phase_iterator.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def initial_phase_iterator
  @initial_phase_iterator
end

#initial_phasesObject

Returns the value of attribute initial_phases.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def initial_phases
  @initial_phases
end

#nameObject

Returns the value of attribute name.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def name
  @name
end

#plans_allowed_in_bundleObject

Returns the value of attribute plans_allowed_in_bundle.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def plans_allowed_in_bundle
  @plans_allowed_in_bundle
end

#pretty_nameObject

Returns the value of attribute pretty_name.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def pretty_name
  @pretty_name
end

#price_list_nameObject

Returns the value of attribute price_list_name.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def price_list_name
  @price_list_name
end

#productObject

Returns the value of attribute product.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def product
  @product
end

#recurring_billing_modeObject

Returns the value of attribute recurring_billing_mode.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def recurring_billing_mode
  @recurring_billing_mode
end

#recurring_billing_periodObject

Returns the value of attribute recurring_billing_period.



37
38
39
# File 'lib/killbill/gen/api/plan.rb', line 37

def recurring_billing_period
  @recurring_billing_period
end

Instance Method Details

#to_javaObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/killbill/gen/api/plan.rb', line 42

def to_java()
  # conversion for name [type = java.lang.String]
  @name = @name.to_s unless @name.nil?

  # conversion for pretty_name [type = java.lang.String]
  @pretty_name = @pretty_name.to_s unless @pretty_name.nil?

  # conversion for catalog [type = org.killbill.billing.catalog.api.StaticCatalog]
  @catalog = @catalog.to_java unless @catalog.nil?

  # conversion for recurring_billing_mode [type = org.killbill.billing.catalog.api.BillingMode]
  @recurring_billing_mode = Java::org.killbill.billing.catalog.api.BillingMode.value_of( @recurring_billing_mode.to_s ) unless @recurring_billing_mode.nil?

  # conversion for initial_phases [type = org.killbill.billing.catalog.api.PlanPhase[]]
  tmp = []
  (@initial_phases || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.PlanPhase]
    m = m.to_java unless m.nil?
    tmp << m
  end
  @initial_phases = tmp.to_java Java::org.killbill.billing.catalog.api.PlanPhase

  # conversion for product [type = org.killbill.billing.catalog.api.Product]
  @product = @product.to_java unless @product.nil?

  # conversion for price_list_name [type = java.lang.String]
  @price_list_name = @price_list_name.to_s unless @price_list_name.nil?

  # conversion for initial_phase_iterator [type = java.util.Iterator]
  @initial_phase_iterator = Killbill::Plugin::Model::EnumeratorIterator.new(@initial_phase_iterator)

  # conversion for final_phase [type = org.killbill.billing.catalog.api.PlanPhase]
  @final_phase = @final_phase.to_java unless @final_phase.nil?

  # conversion for recurring_billing_period [type = org.killbill.billing.catalog.api.BillingPeriod]
  @recurring_billing_period = Java::org.killbill.billing.catalog.api.BillingPeriod.value_of( @recurring_billing_period.to_s ) unless @recurring_billing_period.nil?

  # conversion for plans_allowed_in_bundle [type = int]
  @plans_allowed_in_bundle = @plans_allowed_in_bundle

  # conversion for all_phases [type = org.killbill.billing.catalog.api.PlanPhase[]]
  tmp = []
  (@all_phases || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.PlanPhase]
    m = m.to_java unless m.nil?
    tmp << m
  end
  @all_phases = tmp.to_java Java::org.killbill.billing.catalog.api.PlanPhase

  # conversion for effective_date_for_existing_subscriptions [type = java.util.Date]
  if !@effective_date_for_existing_subscriptions.nil?
    @effective_date_for_existing_subscriptions =  (@effective_date_for_existing_subscriptions.kind_of? Time) ? DateTime.parse(@effective_date_for_existing_subscriptions.to_s) : @effective_date_for_existing_subscriptions
    @effective_date_for_existing_subscriptions = Java::org.joda.time.DateTime.new(@effective_date_for_existing_subscriptions.to_s, Java::org.joda.time.DateTimeZone::UTC)
    @effective_date_for_existing_subscriptions = @effective_date_for_existing_subscriptions.to_date
  end
  self
end

#to_ruby(j_obj) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/killbill/gen/api/plan.rb', line 100

def to_ruby(j_obj)
  # conversion for name [type = java.lang.String]
  @name = j_obj.name

  # conversion for pretty_name [type = java.lang.String]
  @pretty_name = j_obj.pretty_name

  # conversion for catalog [type = org.killbill.billing.catalog.api.StaticCatalog]
  @catalog = j_obj.catalog
  @catalog = Killbill::Plugin::Model::StaticCatalog.new.to_ruby(@catalog) unless @catalog.nil?

  # conversion for recurring_billing_mode [type = org.killbill.billing.catalog.api.BillingMode]
  @recurring_billing_mode = j_obj.recurring_billing_mode
  @recurring_billing_mode = @recurring_billing_mode.to_s.to_sym unless @recurring_billing_mode.nil?

  # conversion for initial_phases [type = org.killbill.billing.catalog.api.PlanPhase[]]
  @initial_phases = j_obj.initial_phases
  tmp = []
  (@initial_phases || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.PlanPhase]
    m = Killbill::Plugin::Model::PlanPhase.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @initial_phases = tmp

  # conversion for product [type = org.killbill.billing.catalog.api.Product]
  @product = j_obj.product
  @product = Killbill::Plugin::Model::Product.new.to_ruby(@product) unless @product.nil?

  # conversion for price_list_name [type = java.lang.String]
  @price_list_name = j_obj.price_list_name

  # conversion for initial_phase_iterator [type = java.util.Iterator]
  @initial_phase_iterator = j_obj.initial_phase_iterator

  # conversion for final_phase [type = org.killbill.billing.catalog.api.PlanPhase]
  @final_phase = j_obj.final_phase
  @final_phase = Killbill::Plugin::Model::PlanPhase.new.to_ruby(@final_phase) unless @final_phase.nil?

  # conversion for recurring_billing_period [type = org.killbill.billing.catalog.api.BillingPeriod]
  @recurring_billing_period = j_obj.recurring_billing_period
  @recurring_billing_period = @recurring_billing_period.to_s.to_sym unless @recurring_billing_period.nil?

  # conversion for plans_allowed_in_bundle [type = int]
  @plans_allowed_in_bundle = j_obj.plans_allowed_in_bundle

  # conversion for all_phases [type = org.killbill.billing.catalog.api.PlanPhase[]]
  @all_phases = j_obj.all_phases
  tmp = []
  (@all_phases || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.PlanPhase]
    m = Killbill::Plugin::Model::PlanPhase.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @all_phases = tmp

  # conversion for effective_date_for_existing_subscriptions [type = java.util.Date]
  @effective_date_for_existing_subscriptions = j_obj.effective_date_for_existing_subscriptions
  if !@effective_date_for_existing_subscriptions.nil?
    @effective_date_for_existing_subscriptions = Java::org.joda.time.DateTime.new(@effective_date_for_existing_subscriptions)
    fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
    str = fmt.print(@effective_date_for_existing_subscriptions)
    @effective_date_for_existing_subscriptions = DateTime.iso8601(str)
  end
  self
end