Class: Killbill::Plugin::Model::StaticCatalog

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStaticCatalog

Returns a new instance of StaticCatalog.



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

def initialize()
end

Instance Attribute Details

#available_base_plan_listingsObject

Returns the value of attribute available_base_plan_listings.



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

def available_base_plan_listings
  @available_base_plan_listings
end

#catalog_nameObject

Returns the value of attribute catalog_name.



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

def catalog_name
  @catalog_name
end

#current_plansObject

Returns the value of attribute current_plans.



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

def current_plans
  @current_plans
end

#current_productsObject

Returns the value of attribute current_products.



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

def current_products
  @current_products
end

#current_supported_currenciesObject

Returns the value of attribute current_supported_currencies.



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

def current_supported_currencies
  @current_supported_currencies
end

#current_unitsObject

Returns the value of attribute current_units.



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

def current_units
  @current_units
end

#effective_dateObject

Returns the value of attribute effective_date.



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

def effective_date
  @effective_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
# File 'lib/killbill/gen/api/static_catalog.rb', line 42

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

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

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

  # conversion for current_products [type = java.util.Collection]
  tmp = java.util.ArrayList.new
  (@current_products || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.Product]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @current_products = tmp

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

  # conversion for current_plans [type = java.util.Collection]
  tmp = java.util.ArrayList.new
  (@current_plans || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.Plan]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @current_plans = tmp

  # conversion for available_base_plan_listings [type = java.util.List]
  tmp = java.util.ArrayList.new
  (@available_base_plan_listings || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.Listing]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @available_base_plan_listings = tmp
  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
# File 'lib/killbill/gen/api/static_catalog.rb', line 100

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

  # conversion for effective_date [type = java.util.Date]
  @effective_date = j_obj.effective_date
  if !@effective_date.nil?
    @effective_date = Java::org.joda.time.DateTime.new(@effective_date)
    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)
    @effective_date = DateTime.iso8601(str)
  end

  # conversion for current_supported_currencies [type = org.killbill.billing.catalog.api.Currency[]]
  @current_supported_currencies = j_obj.current_supported_currencies
  tmp = []
  (@current_supported_currencies || []).each do |m|
    # conversion for m [type = org.killbill.billing.catalog.api.Currency]
    m = m.to_s.to_sym unless m.nil?
    tmp << m
  end
  @current_supported_currencies = tmp

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

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

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

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