Class: Killbill::Plugin::Model::InvoiceItemFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInvoiceItemFormatter

Returns a new instance of InvoiceItemFormatter.



39
40
# File 'lib/killbill/gen/api/invoice_item_formatter.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/invoice_item_formatter.rb', line 37

def 
  @account_id
end

#amountObject

Returns the value of attribute amount.



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

def amount
  @amount
end

#bundle_idObject

Returns the value of attribute bundle_id.



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

def bundle_id
  @bundle_id
end

#child_account_idObject

Returns the value of attribute child_account_id.



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

def 
  @child_account_id
end

#created_dateObject

Returns the value of attribute created_date.



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

def created_date
  @created_date
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#end_dateObject

Returns the value of attribute end_date.



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

def end_date
  @end_date
end

#formatted_amountObject

Returns the value of attribute formatted_amount.



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

def formatted_amount
  @formatted_amount
end

#formatted_end_dateObject

Returns the value of attribute formatted_end_date.



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

def formatted_end_date
  @formatted_end_date
end

#formatted_start_dateObject

Returns the value of attribute formatted_start_date.



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

def formatted_start_date
  @formatted_start_date
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#invoice_idObject

Returns the value of attribute invoice_id.



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

def invoice_id
  @invoice_id
end

#invoice_item_typeObject

Returns the value of attribute invoice_item_type.



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

def invoice_item_type
  @invoice_item_type
end

#item_detailsObject

Returns the value of attribute item_details.



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

def item_details
  @item_details
end

#linked_item_idObject

Returns the value of attribute linked_item_id.



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

def linked_item_id
  @linked_item_id
end

#phase_nameObject

Returns the value of attribute phase_name.



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

def phase_name
  @phase_name
end

#plan_nameObject

Returns the value of attribute plan_name.



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

def plan_name
  @plan_name
end

#pretty_phase_nameObject

Returns the value of attribute pretty_phase_name.



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

def pretty_phase_name
  @pretty_phase_name
end

#pretty_plan_nameObject

Returns the value of attribute pretty_plan_name.



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

def pretty_plan_name
  @pretty_plan_name
end

#pretty_product_nameObject

Returns the value of attribute pretty_product_name.



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

def pretty_product_name
  @pretty_product_name
end

#pretty_usage_nameObject

Returns the value of attribute pretty_usage_name.



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

def pretty_usage_name
  @pretty_usage_name
end

#product_nameObject

Returns the value of attribute product_name.



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

def product_name
  @product_name
end

#quantityObject

Returns the value of attribute quantity.



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

def quantity
  @quantity
end

#rateObject

Returns the value of attribute rate.



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

def rate
  @rate
end

#start_dateObject

Returns the value of attribute start_date.



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

def start_date
  @start_date
end

#subscription_idObject

Returns the value of attribute subscription_id.



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

def subscription_id
  @subscription_id
end

#updated_dateObject

Returns the value of attribute updated_date.



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

def updated_date
  @updated_date
end

#usage_nameObject

Returns the value of attribute usage_name.



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

def usage_name
  @usage_name
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/killbill/gen/api/invoice_item_formatter.rb', line 42

def to_java()
  # conversion for invoice_item_type [type = org.killbill.billing.invoice.api.InvoiceItemType]
  @invoice_item_type = Java::org.killbill.billing.invoice.api.InvoiceItemType.value_of( @invoice_item_type.to_s ) unless @invoice_item_type.nil?

  # conversion for invoice_id [type = java.util.UUID]
  @invoice_id = java.util.UUID.fromString(@invoice_id.to_s) unless @invoice_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 child_account_id [type = java.util.UUID]
  @child_account_id = java.util.UUID.fromString(@child_account_id.to_s) unless @child_account_id.nil?

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

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

  # conversion for amount [type = java.math.BigDecimal]
  if @amount.nil?
    @amount = java.math.BigDecimal::ZERO
  else
    @amount = java.math.BigDecimal.new(@amount.to_s)
  end

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

  # conversion for description [type = java.lang.String]
  @description = @description.to_s unless @description.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 subscription_id [type = java.util.UUID]
  @subscription_id = java.util.UUID.fromString(@subscription_id.to_s) unless @subscription_id.nil?

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

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

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

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

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

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

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

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

  # conversion for rate [type = java.math.BigDecimal]
  if @rate.nil?
    @rate = java.math.BigDecimal::ZERO
  else
    @rate = java.math.BigDecimal.new(@rate.to_s)
  end

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

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

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

  # 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 formatted_start_date [type = java.lang.String]
  @formatted_start_date = @formatted_start_date.to_s unless @formatted_start_date.nil?

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

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

#to_ruby(j_obj) ⇒ Object



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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/killbill/gen/api/invoice_item_formatter.rb', line 150

def to_ruby(j_obj)
  # conversion for invoice_item_type [type = org.killbill.billing.invoice.api.InvoiceItemType]
  @invoice_item_type = j_obj.invoice_item_type
  @invoice_item_type = @invoice_item_type.to_s.to_sym unless @invoice_item_type.nil?

  # conversion for invoice_id [type = java.util.UUID]
  @invoice_id = j_obj.invoice_id
  @invoice_id = @invoice_id.nil? ? nil : @invoice_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 child_account_id [type = java.util.UUID]
  @child_account_id = j_obj.
  @child_account_id = @child_account_id.nil? ? nil : @child_account_id.to_s

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

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

  # conversion for amount [type = java.math.BigDecimal]
  @amount = j_obj.amount
  @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)

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

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

  # 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 subscription_id [type = java.util.UUID]
  @subscription_id = j_obj.subscription_id
  @subscription_id = @subscription_id.nil? ? nil : @subscription_id.to_s

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

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

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

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

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

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

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

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

  # conversion for rate [type = java.math.BigDecimal]
  @rate = j_obj.rate
  @rate = @rate.nil? ? 0 : BigDecimal.new(@rate.to_s)

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

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

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

  # 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 formatted_start_date [type = java.lang.String]
  @formatted_start_date = j_obj.formatted_start_date

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

  # conversion for formatted_amount [type = java.lang.String]
  @formatted_amount = j_obj.formatted_amount
  self
end