Module: ThreeScale::Backend::Transactor
- Extended by:
- Transactor
- Includes:
- StorageKeyHelpers, NotifyBatcher
- Included in:
- Transactor
- Defined in:
- lib/3scale/backend/transactor.rb,
lib/3scale/backend/transactor/status.rb,
lib/3scale/backend/transactor/notify_job.rb,
lib/3scale/backend/transactor/report_job.rb,
lib/3scale/backend/transactor/process_job.rb,
lib/3scale/backend/transactor/usage_report.rb,
lib/3scale/backend/transactor/limit_headers.rb,
lib/3scale/backend/transactor/notify_batcher.rb
Overview
Methods for reporting and authorizing transactions.
Defined Under Namespace
Modules: LimitHeaders, NotifyBatcher
Classes: NotifyJob, ProcessJob, ReportJob, Status
Instance Method Summary
collapse
-
#authorize(provider_key, params, context_info = {}) ⇒ Object
-
#authrep(provider_key, params, context_info = {}) ⇒ Object
-
#oauth_authorize(provider_key, params, context_info = {}) ⇒ Object
-
#oauth_authrep(provider_key, params, context_info = {}) ⇒ Object
-
#report(provider_key, service_id, transactions, context_info = {}) ⇒ Object
-
#utilization(service_id, application_id) ⇒ Object
#do_batch, #get_batch, #key_for_notifications_batch, #notify, #notify_authorize, #notify_authrep, #notify_batch, #notify_report, #process_batch
#configuration, #configuration=, included
#encode_key
Instance Method Details
#authorize(provider_key, params, context_info = {}) ⇒ Object
33
34
35
|
# File 'lib/3scale/backend/transactor.rb', line 33
def authorize(provider_key, params, context_info = {})
do_authorize :authorize, provider_key, params, context_info
end
|
#authrep(provider_key, params, context_info = {}) ⇒ Object
41
42
43
|
# File 'lib/3scale/backend/transactor.rb', line 41
def authrep(provider_key, params, context_info = {})
do_authrep :authrep, provider_key, params, context_info
end
|
#oauth_authorize(provider_key, params, context_info = {}) ⇒ Object
37
38
39
|
# File 'lib/3scale/backend/transactor.rb', line 37
def oauth_authorize(provider_key, params, context_info = {})
do_authorize :oauth_authorize, provider_key, params, context_info
end
|
#oauth_authrep(provider_key, params, context_info = {}) ⇒ Object
45
46
47
|
# File 'lib/3scale/backend/transactor.rb', line 45
def oauth_authrep(provider_key, params, context_info = {})
do_authrep :oauth_authrep, provider_key, params, context_info
end
|
#report(provider_key, service_id, transactions, context_info = {}) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/3scale/backend/transactor.rb', line 20
def report(provider_key, service_id, transactions, context_info = {})
service = Service.load_with_provider_key!(service_id, provider_key)
filtered_transactions = filter_usages_with_0(transactions.clone)
return if filtered_transactions.empty?
report_enqueue(service.id, filtered_transactions, context_info)
notify_report(provider_key, filtered_transactions.size)
end
|
#utilization(service_id, application_id) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/3scale/backend/transactor.rb', line 49
def utilization(service_id, application_id)
application = Application.load!(service_id, application_id)
application.load_metric_names
usage = Usage.application_usage(application, Time.now.getutc)
status = Status.new(service_id: service_id,
application: application,
values: usage)
Validators::Limits.apply(status, {})
status.application_usage_reports
end
|