Class: Killbill::Plugin::Api::CatalogUserApi

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

Instance Method Summary collapse

Constructor Details

#initialize(real_java_api) ⇒ CatalogUserApi

Returns a new instance of CatalogUserApi.



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

def initialize(real_java_api)
  @real_java_api = real_java_api
end

Instance Method Details

#add_simple_plan(planDescriptor, requestedDate, context) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 104

def add_simple_plan(planDescriptor, requestedDate, context)

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

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

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  @real_java_api.add_simple_plan(planDescriptor, requestedDate, context)
end

#create_default_empty_catalog(effectiveDate, callContext) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 90

def create_default_empty_catalog(effectiveDate, callContext)

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

  # conversion for callContext [type = org.killbill.billing.util.callcontext.CallContext]
  callContext = callContext.to_java unless callContext.nil?
  @real_java_api.create_default_empty_catalog(effectiveDate, callContext)
end

#delete_catalog(callContext) ⇒ Object



121
122
123
124
125
126
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 121

def delete_catalog(callContext)

  # conversion for callContext [type = org.killbill.billing.util.callcontext.CallContext]
  callContext = callContext.to_java unless callContext.nil?
  @real_java_api.delete_catalog(callContext)
end

#get_catalog(catalogName, context) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 43

def get_catalog(catalogName, context)

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

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.get_catalog(catalogName, context)
    # conversion for res [type = org.killbill.billing.catalog.api.Catalog]
    res = Killbill::Plugin::Model::Catalog.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.catalog.api.CatalogApiException => e
    raise Killbill::Plugin::Model::CatalogApiException.new.to_ruby(e)
  end
end

#get_current_catalog(catalogName, context) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 61

def get_current_catalog(catalogName, context)

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

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.get_current_catalog(catalogName, context)
    # conversion for res [type = org.killbill.billing.catalog.api.StaticCatalog]
    res = Killbill::Plugin::Model::StaticCatalog.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.catalog.api.CatalogApiException => e
    raise Killbill::Plugin::Model::CatalogApiException.new.to_ruby(e)
  end
end

#upload_catalog(catalogXML, context) ⇒ Object



79
80
81
82
83
84
85
86
87
# File 'lib/killbill/gen/api/catalog_user_api.rb', line 79

def upload_catalog(catalogXML, context)

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

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  @real_java_api.upload_catalog(catalogXML, context)
end