Class: Killbill::Plugin::Model::Subscription

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSubscription

Returns a new instance of Subscription.



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

def initialize()
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#base_entitlement_idObject

Returns the value of attribute base_entitlement_id.



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

def base_entitlement_id
  @base_entitlement_id
end

#bill_cycle_day_localObject

Returns the value of attribute bill_cycle_day_local.



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

def bill_cycle_day_local
  @bill_cycle_day_local
end

#billing_end_dateObject

Returns the value of attribute billing_end_date.



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

def billing_end_date
  @billing_end_date
end

#billing_start_dateObject

Returns the value of attribute billing_start_date.



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

def billing_start_date
  @billing_start_date
end

#bundle_idObject

Returns the value of attribute bundle_id.



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

def bundle_id
  @bundle_id
end

#charged_through_dateObject

Returns the value of attribute charged_through_date.



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

def charged_through_date
  @charged_through_date
end

#created_dateObject

Returns the value of attribute created_date.



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

def created_date
  @created_date
end

#effective_end_dateObject

Returns the value of attribute effective_end_date.



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

def effective_end_date
  @effective_end_date
end

#effective_start_dateObject

Returns the value of attribute effective_start_date.



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

def effective_start_date
  @effective_start_date
end

#external_keyObject

Returns the value of attribute external_key.



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

def external_key
  @external_key
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#last_active_phaseObject

Returns the value of attribute last_active_phase.



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

def last_active_phase
  @last_active_phase
end

#last_active_planObject

Returns the value of attribute last_active_plan.



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

def last_active_plan
  @last_active_plan
end

#last_active_price_listObject

Returns the value of attribute last_active_price_list.



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

def last_active_price_list
  @last_active_price_list
end

#last_active_productObject

Returns the value of attribute last_active_product.



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

def last_active_product
  @last_active_product
end

#last_active_product_categoryObject

Returns the value of attribute last_active_product_category.



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

def last_active_product_category
  @last_active_product_category
end

#source_typeObject

Returns the value of attribute source_type.



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

def source_type
  @source_type
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#subscription_eventsObject

Returns the value of attribute subscription_events.



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

def subscription_events
  @subscription_events
end

#updated_dateObject

Returns the value of attribute updated_date.



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

def updated_date
  @updated_date
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
99
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
# File 'lib/killbill/gen/api/subscription.rb', line 42

def to_java()
  # conversion for base_entitlement_id [type = java.util.UUID]
  @base_entitlement_id = java.util.UUID.fromString(@base_entitlement_id.to_s) unless @base_entitlement_id.nil?

  # conversion for bundle_id [type = java.util.UUID]
  @bundle_id = java.util.UUID.fromString(@bundle_id.to_s) unless @bundle_id.nil?

  # conversion for account_id [type = java.util.UUID]
  @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?

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

  # conversion for state [type = org.killbill.billing.entitlement.api.EntitlementState]
  @state = Java::org.killbill.billing.entitlement.api.EntitlementState.value_of( @state.to_s ) unless @state.nil?

  # conversion for source_type [type = org.killbill.billing.entitlement.api.EntitlementSourceType]
  @source_type = Java::org.killbill.billing.entitlement.api.EntitlementSourceType.value_of( @source_type.to_s ) unless @source_type.nil?

  # conversion for effective_start_date [type = org.joda.time.LocalDate]
  if !@effective_start_date.nil?
    @effective_start_date = Java::org.joda.time.LocalDate.parse(@effective_start_date.to_s)
  end

  # conversion for effective_end_date [type = org.joda.time.LocalDate]
  if !@effective_end_date.nil?
    @effective_end_date = Java::org.joda.time.LocalDate.parse(@effective_end_date.to_s)
  end

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

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

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

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

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

  # conversion for bill_cycle_day_local [type = java.lang.Integer]
  @bill_cycle_day_local = @bill_cycle_day_local

  # conversion for id [type = java.util.UUID]
  @id = java.util.UUID.fromString(@id.to_s) unless @id.nil?

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

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

  # conversion for billing_start_date [type = org.joda.time.LocalDate]
  if !@billing_start_date.nil?
    @billing_start_date = Java::org.joda.time.LocalDate.parse(@billing_start_date.to_s)
  end

  # conversion for billing_end_date [type = org.joda.time.LocalDate]
  if !@billing_end_date.nil?
    @billing_end_date = Java::org.joda.time.LocalDate.parse(@billing_end_date.to_s)
  end

  # conversion for charged_through_date [type = org.joda.time.LocalDate]
  if !@charged_through_date.nil?
    @charged_through_date = Java::org.joda.time.LocalDate.parse(@charged_through_date.to_s)
  end

  # conversion for subscription_events [type = java.util.List]
  tmp = java.util.ArrayList.new
  (@subscription_events || []).each do |m|
    # conversion for m [type = org.killbill.billing.entitlement.api.SubscriptionEvent]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @subscription_events = tmp
  self
end

#to_ruby(j_obj) ⇒ Object



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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/killbill/gen/api/subscription.rb', line 130

def to_ruby(j_obj)
  # conversion for base_entitlement_id [type = java.util.UUID]
  @base_entitlement_id = j_obj.base_entitlement_id
  @base_entitlement_id = @base_entitlement_id.nil? ? nil : @base_entitlement_id.to_s

  # conversion for bundle_id [type = java.util.UUID]
  @bundle_id = j_obj.bundle_id
  @bundle_id = @bundle_id.nil? ? nil : @bundle_id.to_s

  # conversion for account_id [type = java.util.UUID]
  @account_id = j_obj.
  @account_id = @account_id.nil? ? nil : @account_id.to_s

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

  # conversion for state [type = org.killbill.billing.entitlement.api.EntitlementState]
  @state = j_obj.state
  @state = @state.to_s.to_sym unless @state.nil?

  # conversion for source_type [type = org.killbill.billing.entitlement.api.EntitlementSourceType]
  @source_type = j_obj.source_type
  @source_type = @source_type.to_s.to_sym unless @source_type.nil?

  # conversion for effective_start_date [type = org.joda.time.LocalDate]
  @effective_start_date = j_obj.effective_start_date
  if !@effective_start_date.nil?
    @effective_start_date = @effective_start_date.to_s
  end

  # conversion for effective_end_date [type = org.joda.time.LocalDate]
  @effective_end_date = j_obj.effective_end_date
  if !@effective_end_date.nil?
    @effective_end_date = @effective_end_date.to_s
  end

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

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

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

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

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

  # conversion for bill_cycle_day_local [type = java.lang.Integer]
  @bill_cycle_day_local = j_obj.bill_cycle_day_local

  # conversion for id [type = java.util.UUID]
  @id = j_obj.id
  @id = @id.nil? ? nil : @id.to_s

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

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

  # conversion for billing_start_date [type = org.joda.time.LocalDate]
  @billing_start_date = j_obj.billing_start_date
  if !@billing_start_date.nil?
    @billing_start_date = @billing_start_date.to_s
  end

  # conversion for billing_end_date [type = org.joda.time.LocalDate]
  @billing_end_date = j_obj.billing_end_date
  if !@billing_end_date.nil?
    @billing_end_date = @billing_end_date.to_s
  end

  # conversion for charged_through_date [type = org.joda.time.LocalDate]
  @charged_through_date = j_obj.charged_through_date
  if !@charged_through_date.nil?
    @charged_through_date = @charged_through_date.to_s
  end

  # conversion for subscription_events [type = java.util.List]
  @subscription_events = j_obj.subscription_events
  tmp = []
  (@subscription_events || []).each do |m|
    # conversion for m [type = org.killbill.billing.entitlement.api.SubscriptionEvent]
    m = Killbill::Plugin::Model::SubscriptionEvent.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @subscription_events = tmp
  self
end