Module: DiscourseSubscriptionClient
- Defined in:
- lib/discourse_subscription_client/engine.rb,
lib/discourse_subscription_client/s3_gem.rb,
lib/discourse_subscription_client/notices.rb,
lib/discourse_subscription_client/request.rb,
lib/discourse_subscription_client/version.rb,
lib/discourse_subscription_client/resources.rb,
lib/discourse_subscription_client/authorization.rb,
lib/discourse_subscription_client/subscriptions.rb,
app/jobs/discourse_subscription_client/find_resources.rb,
app/jobs/discourse_subscription_client/update_notices.rb,
lib/discourse_subscription_client/subscriptions/result.rb,
app/jobs/discourse_subscription_client/update_subscriptions.rb,
lib/discourse_subscription_client/subscriptions/update_result.rb,
app/controllers/discourse_subscription_client/admin_controller.rb,
app/serializers/discourse_subscription_client/notice_serializer.rb,
app/controllers/discourse_subscription_client/notices_controller.rb,
app/serializers/discourse_subscription_client/resource_serializer.rb,
app/serializers/discourse_subscription_client/supplier_serializer.rb,
app/controllers/discourse_subscription_client/no_access_controller.rb,
app/controllers/discourse_subscription_client/suppliers_controller.rb,
app/serializers/discourse_subscription_client/subscription_serializer.rb,
app/controllers/discourse_subscription_client/subscriptions_controller.rb
Defined Under Namespace
Classes: AdminController, Authorization, Engine, FindResources, NoAccessController, NoticeSerializer, Notices, NoticesController, Request, ResourceSerializer, Resources, S3Gem, SubscriptionSerializer, Subscriptions, SubscriptionsController, SupplierSerializer, SuppliersController, UpdateNotices, UpdateSubscriptions
Constant Summary
collapse
- VERSION =
"0.1.11"
Class Method Summary
collapse
Class Method Details
.database_exists? ⇒ Boolean
87
88
89
90
91
92
93
|
# File 'lib/discourse_subscription_client/engine.rb', line 87
def database_exists?
ActiveRecord::Base.connection
rescue ActiveRecord::NoDatabaseError
false
else
true
end
|
.find_subscriptions(resource_name = nil) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/discourse_subscription_client/engine.rb', line 95
def find_subscriptions(resource_name = nil)
return nil unless resource_name
subscriptions = SubscriptionClientSubscription.active
.includes(resource: [:supplier])
.references(resource: [:supplier])
.where("subscription_client_resources.name = ? ", resource_name)
result = DiscourseSubscriptionClient::Subscriptions::Result.new
return result unless subscriptions.exists?
resource = subscriptions.first.resource
supplier = resource.supplier
products = supplier.product_slugs(resource_name)
return result unless products.present?
result.resource = resource
result.supplier = supplier
result.subscriptions = subscriptions.to_a
result.products = products
result
end
|
.plugin_status_server_url ⇒ Object
83
84
85
|
# File 'lib/discourse_subscription_client/engine.rb', line 83
def plugin_status_server_url
"https://coop.pavilion.tech"
end
|
.root ⇒ Object
79
80
81
|
# File 'lib/discourse_subscription_client/engine.rb', line 79
def root
Rails.root
end
|