Class: KillBillClient::Model::Catalog

Inherits:
CatalogAttributes show all
Defined in:
lib/killbill_client/models/catalog.rb

Constant Summary collapse

KILLBILL_API_CATALOG_PREFIX =
"#{KILLBILL_API_PREFIX}/catalog"

Constants inherited from Resource

Resource::KILLBILL_API_PAGINATION_PREFIX, Resource::KILLBILL_API_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#clazz, #etag, #response, #session_id, #uri

Class Method Summary collapse

Methods inherited from Resource

#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, #initialize, instantiate_record_from_json, post, put, #refresh, require_multi_tenant_options!, #to_hash, #to_json

Constructor Details

This class inherits a constructor from KillBillClient::Model::Resource

Class Method Details

.add_tenant_catalog_simple_plan(simple_plan, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/killbill_client/models/catalog.rb', line 68

def add_tenant_catalog_simple_plan(simple_plan, user = nil, reason = nil, comment = nil, options = {})

  require_multi_tenant_options!(options, "Uploading a catalog is only supported in multi-tenant mode")

  post "#{KILLBILL_API_CATALOG_PREFIX}/simplePlan",
       simple_plan.to_json,
       {
       },
       {
           :user => user,
           :reason => reason,
           :comment => comment,
       }.merge(options)
end

.available_addons(base_product_name, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/killbill_client/models/catalog.rb', line 16

def available_addons(base_product_name, options = {})
  get "#{KILLBILL_API_CATALOG_PREFIX}/availableAddons",
      {
          :baseProductName => base_product_name
      },
      options,
      PlanDetail
end

.available_base_plans(options = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/killbill_client/models/catalog.rb', line 25

def available_base_plans(options = {})
  get "#{KILLBILL_API_CATALOG_PREFIX}/availableBasePlans",
      {},
      options,
      PlanDetail
end

.get_tenant_catalog(format, requested_date = nil, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/killbill_client/models/catalog.rb', line 32

def get_tenant_catalog(format, requested_date=nil, options = {})

  require_multi_tenant_options!(options, "Retrieving a catalog is only supported in multi-tenant mode")

  params = {}
  params[:requestedDate] = requested_date if requested_date

  get KILLBILL_API_CATALOG_PREFIX,
      params,
      {
          :head => {'Accept' => "application/#{format}"},
          :content_type => "application/#{format}",

  }.merge(options)

end

.simple_catalog(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/killbill_client/models/catalog.rb', line 10

def simple_catalog(options = {})
  get "#{KILLBILL_API_CATALOG_PREFIX}",
      {},
      options
end

.upload_tenant_catalog(catalog_xml, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/killbill_client/models/catalog.rb', line 49

def upload_tenant_catalog(catalog_xml, user = nil, reason = nil, comment = nil, options = {})

  require_multi_tenant_options!(options, "Uploading a catalog is only supported in multi-tenant mode")

  post KILLBILL_API_CATALOG_PREFIX,
       catalog_xml,
       {
       },
       {
           :head => {'Accept' => 'application/xml'},
           :content_type => 'application/xml',
           :user => user,
           :reason => reason,
           :comment => comment,
       }.merge(options)
  get_tenant_catalog('xml', nil, options)
end