Class: KillBillClient::Model::Admin

Inherits:
AdminPaymentAttributes show all
Defined in:
lib/killbill_client/models/admin.rb

Constant Summary collapse

KILLBILL_API_ADMIN_PREFIX =
"#{KILLBILL_API_PREFIX}/admin"
KILLBILL_API_QUEUES_PREFIX =
"#{KILLBILL_API_ADMIN_PREFIX}/queues"
KILLBILL_API_CLOCK_PREFIX =
"#{KILLBILL_API_PREFIX}/test/clock"

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

.fix_transaction_state(payment_id, transaction_id, transaction_status, payment_state_param = {}, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/killbill_client/models/admin.rb', line 29

def fix_transaction_state(payment_id, transaction_id, transaction_status, payment_state_param = {}, user = nil, reason = nil, comment = nil, options = {})
  put "#{KILLBILL_API_ADMIN_PREFIX}/payments/#{payment_id}/transactions/#{transaction_id}",
      {:transactionStatus => transaction_status}.merge(payment_state_param).to_json,
      {},
      {
          :user => user,
          :reason => reason,
          :comment => comment,
      }.merge(options)
end

.get_clock(time_zone, options) ⇒ Object



92
93
94
95
96
97
98
99
100
# File 'lib/killbill_client/models/admin.rb', line 92

def get_clock(time_zone, options)
  params = {}
  params[:timeZone] = time_zone unless time_zone.nil?

  res = get KILLBILL_API_CLOCK_PREFIX,
            params,
            options
  JSON.parse res.body
end

.get_queues_entries(account_id, queue_name = '', service_name = '', with_history = true, min_date = '', max_date = '', with_in_processing = true, with_bus_events = true, with_notifications = true, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/killbill_client/models/admin.rb', line 11

def get_queues_entries(, queue_name = '', service_name = '', with_history = true, min_date = '', max_date = '', with_in_processing = true, with_bus_events = true, with_notifications = true, options = {})
  get KILLBILL_API_QUEUES_PREFIX,
            {
                :accountId => ,
                :queueName => queue_name,
                :serviceName => service_name,
                :withHistory => with_history,
                :minDate => min_date,
                :maxDate => max_date,
                :withInProcessing => with_in_processing,
                :withBusEvents => with_bus_events,
                :withNotifications => with_notifications
            },
            {
                :accept => 'application/octet-stream'
            }.merge(options)
end

.increment_kb_clock(days, weeks, months, years, time_zone, options) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/killbill_client/models/admin.rb', line 117

def increment_kb_clock(days, weeks, months, years, time_zone, options)
  params = {}
  params[:days] = days unless days.nil?
  params[:weeks] = weeks unless weeks.nil?
  params[:months] = months unless months.nil?
  params[:years] = years unless years.nil?
  params[:timeZone] = time_zone unless time_zone.nil?

  # The default 5s is not always enough
  params[:timeoutSec] ||= 10

  res = put KILLBILL_API_CLOCK_PREFIX,
            {},
            params,
            {}.merge(options)

  JSON.parse res.body
end

.invalidates_cache(cache_name = nil, options = {}) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/killbill_client/models/admin.rb', line 69

def invalidates_cache(cache_name = nil, options = {})
  delete "#{KILLBILL_API_ADMIN_PREFIX}/cache",
         {},
         {
             :cacheName => cache_name
         },
         {}.merge(options)
end

.invalidates_cache_by_account(account_id = nil, options = {}) ⇒ Object



78
79
80
81
82
83
# File 'lib/killbill_client/models/admin.rb', line 78

def ( = nil, options = {})
  delete "#{KILLBILL_API_ADMIN_PREFIX}/cache/accounts/#{}",
         {},
         {},
         {}.merge(options)
end

.invalidates_cache_by_tenant(options = {}) ⇒ Object



85
86
87
88
89
90
# File 'lib/killbill_client/models/admin.rb', line 85

def invalidates_cache_by_tenant(options = {})
  delete "#{KILLBILL_API_ADMIN_PREFIX}/cache/tenants",
         {},
         {},
         {}.merge(options)
end

.put_in_rotation(options = {}) ⇒ Object



55
56
57
58
59
60
# File 'lib/killbill_client/models/admin.rb', line 55

def put_in_rotation(options = {})
  put "#{KILLBILL_API_ADMIN_PREFIX}/healthcheck",
       {},
       {},
       {}.merge(options)
end

.put_out_of_rotation(options = {}) ⇒ Object



62
63
64
65
66
67
# File 'lib/killbill_client/models/admin.rb', line 62

def put_out_of_rotation(options = {})
  delete "#{KILLBILL_API_ADMIN_PREFIX}/healthcheck",
      {},
      {},
      {}.merge(options)
end

.set_clock(requested_date, time_zone, options) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/killbill_client/models/admin.rb', line 102

def set_clock(requested_date, time_zone, options)
  params = {}
  params[:requestedDate] = requested_date unless requested_date.nil?
  params[:timeZone] = time_zone unless time_zone.nil?

  # The default 5s is not always enough
  params[:timeoutSec] ||= 10

  res = post KILLBILL_API_CLOCK_PREFIX,
             {},
             params,
             {}.merge(options)
  JSON.parse res.body
end

.trigger_invoice_generation_for_parked_accounts(offset = 0, limit = 100, plugin_property = [], user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



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

def trigger_invoice_generation_for_parked_accounts(offset = 0, limit = 100, plugin_property = [], user = nil, reason = nil, comment = nil, options = {})
  post "#{KILLBILL_API_ADMIN_PREFIX}/invoices",
       {},
       {
           :offset => offset,
           :limit => limit,
           :pluginProperty => plugin_property
       },
       {
          :user => user,
          :reason => reason,
          :comment => comment,
       }.merge(options)
end