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"

Class Method Summary collapse

Class Method Details

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



24
25
26
27
28
29
30
31
32
33
# File 'lib/killbill_client/models/admin.rb', line 24

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

.get_clock(time_zone, options) ⇒ Object



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

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, options = {}) ⇒ Object



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

def get_queues_entries(, options = {})
  get KILLBILL_API_QUEUES_PREFIX,
            {
                :accountId => ,
                :withHistory => options[:withHistory],
                :minDate => options[:minDate],
                :maxDate => options[:maxDate]
            },
            {
                :accept => 'application/octet-stream'
            }.merge(options)
end

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



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/killbill_client/models/admin.rb', line 109

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



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

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



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

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

.invalidates_cache_by_tenant(options = {}) ⇒ Object



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

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

.put_in_rotation(options = {}) ⇒ Object



47
48
49
50
51
52
# File 'lib/killbill_client/models/admin.rb', line 47

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

.put_out_of_rotation(options = {}) ⇒ Object



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

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

.set_clock(requested_date, time_zone, options) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/killbill_client/models/admin.rb', line 94

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, user = nil, options = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/killbill_client/models/admin.rb', line 35

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