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



146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/killbill_client/models/catalog.rb', line 146

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

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



161
162
163
164
165
166
167
168
169
170
171
# File 'lib/killbill_client/models/catalog.rb', line 161

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

  delete "#{KILLBILL_API_CATALOG_PREFIX}",
         {},
         {},
         {
             :user => user,
             :reason => reason,
             :comment => comment,
         }.merge(options)
end

.get_catalog_phase(subscription_id, requested_date, options = {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/killbill_client/models/catalog.rb', line 75

def get_catalog_phase(subscription_id, requested_date, options = {})

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

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

  get "#{KILLBILL_API_CATALOG_PREFIX}/phase",
      params,
      options
end

.get_catalog_plan(subscription_id, requested_date, options = {}) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/killbill_client/models/catalog.rb', line 88

def get_catalog_plan(subscription_id, requested_date, options = {})

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

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

  get "#{KILLBILL_API_CATALOG_PREFIX}/plan",
      params,
      options
end

.get_catalog_price_list(subscription_id, requested_date, options = {}) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/killbill_client/models/catalog.rb', line 101

def get_catalog_price_list(subscription_id, requested_date, options = {})

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

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

  get "#{KILLBILL_API_CATALOG_PREFIX}/priceList",
      params,
      options
end

.get_catalog_product(subscription_id, requested_date, options = {}) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/killbill_client/models/catalog.rb', line 114

def get_catalog_product(subscription_id, requested_date, options = {})

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

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

  get "#{KILLBILL_API_CATALOG_PREFIX}/product",
      params,
      options
end

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/killbill_client/models/catalog.rb', line 58

def get_tenant_catalog_json(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/json"},
          :content_type => "application/json",

      }.merge(options)

end

.get_tenant_catalog_versions(options = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/killbill_client/models/catalog.rb', line 32

def get_tenant_catalog_versions(options = {})

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

  get "#{KILLBILL_API_CATALOG_PREFIX}/versions",
      {},
      options
end

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/killbill_client/models/catalog.rb', line 41

def get_tenant_catalog_xml(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}/xml",
      params,
      {
          :head => {'Accept' => "text/xml"},
          :content_type => "text/xml",

  }.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



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/killbill_client/models/catalog.rb', line 127

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}/xml",
       catalog_xml,
       {
       },
       {
           :head => {'Accept' => 'application/json'},
           :content_type => 'text/xml',
           :user => user,
           :reason => reason,
           :comment => comment,
       }.merge(options)
  get_tenant_catalog_json(nil, options)
end