Module: Workarea::Listrak
- Defined in:
- lib/workarea/listrak.rb,
lib/workarea/listrak/error.rb,
lib/workarea/listrak/engine.rb,
lib/workarea/listrak/version.rb,
lib/workarea/listrak/analytics.rb,
app/services/workarea/listrak/oauth.rb,
lib/workarea/listrak/bogus_data_api.rb,
lib/workarea/listrak/bogus_email_api.rb,
app/services/workarea/listrak/data_api.rb,
app/services/workarea/listrak/email_api.rb,
app/models/workarea/listrak/configuration.rb,
app/services/workarea/listrak/models/list.rb,
app/services/workarea/listrak/models/event.rb,
lib/workarea/listrak/bogus_data_api/orders.rb,
lib/workarea/listrak/bogus_email_api/lists.rb,
app/workers/workarea/listrak/order_exporter.rb,
lib/workarea/listrak/bogus_email_api/events.rb,
app/services/workarea/listrak/models/address.rb,
app/services/workarea/listrak/models/contact.rb,
lib/workarea/listrak/bogus_data_api/products.rb,
app/helpers/workarea/listrak/analytics/helper.rb,
app/services/workarea/listrak/data_api/orders.rb,
app/services/workarea/listrak/email_api/lists.rb,
app/workers/workarea/listrak/product_exporter.rb,
lib/workarea/listrak/bogus_data_api/customers.rb,
lib/workarea/listrak/bogus_email_api/contacts.rb,
app/services/workarea/listrak/email_api/events.rb,
app/workers/workarea/listrak/customer_exporter.rb,
app/services/workarea/listrak/data_api/products.rb,
app/services/workarea/listrak/models/event_form.rb,
app/services/workarea/listrak/models/order_form.rb,
app/services/workarea/listrak/models/order_item.rb,
app/services/workarea/listrak/data_api/customers.rb,
app/services/workarea/listrak/email_api/contacts.rb,
app/services/workarea/listrak/email_api/messages.rb,
lib/workarea/listrak/bogus_data_api/proxy_client.rb,
app/services/workarea/listrak/models/contact_form.rb,
app/services/workarea/listrak/models/message_form.rb,
app/services/workarea/listrak/models/product_form.rb,
lib/workarea/listrak/bogus_email_api/proxy_client.rb,
app/services/workarea/listrak/models/customer_form.rb,
app/services/workarea/listrak/transactional_message.rb,
app/workers/workarea/listrak/subscribe_email_signup.rb,
app/workers/workarea/listrak/unsubscribe_email_signup.rb,
lib/generators/workarea/listrak/message/message_generator.rb,
lib/workarea/listrak/bogus_email_api/transactional_messages.rb,
app/services/workarea/listrak/email_api/transactional_messages.rb,
app/services/workarea/listrak/models/transactional_message_form.rb
Overview
Workarea integration with the Listrak service.
Defined Under Namespace
Modules: Analytics, Models, Oauth, TransactionalMessage Classes: Configuration, CustomerExporter, DataApi, EmailApi, Engine, Error, HttpError, MessageGenerator, OauthError, OrderExporter, ProductExporter, SubscribeEmailSignup, UnsubscribeEmailSignup
Constant Summary collapse
- VERSION =
"5.0.4".freeze
Class Method Summary collapse
- .configuration ⇒ Object
- .credentials ⇒ Object
-
.data(timeout: nil, open_timeout: nil, read_timeout: nil) ⇒ Workarea::Listrak::EmailApi, Workarea::Listrak::BogusEmailApi
An instance of the Listrak Data Api.
- .email(timeout: nil, open_timeout: nil, read_timeout: nil) ⇒ Object
Class Method Details
.configuration ⇒ Object
22 23 24 |
# File 'lib/workarea/listrak.rb', line 22 def self.configuration Listrak::Configuration.first || Listrak::Configuration.new end |
.credentials ⇒ Object
18 19 20 |
# File 'lib/workarea/listrak.rb', line 18 def self.credentials (Rails.application.secrets.listrak || {}).deep_symbolize_keys end |
.data(timeout: nil, open_timeout: nil, read_timeout: nil) ⇒ Workarea::Listrak::EmailApi, Workarea::Listrak::BogusEmailApi
An instance of the Listrak Data Api
If the required data api credentials are present an instance of Workarea::Listrak::EmailApi is returned otherwise an instance of Workarea::Listrak::BogusEmailApi is returned
47 48 49 50 51 52 53 54 55 |
# File 'lib/workarea/listrak.rb', line 47 def self.data(timeout: nil, open_timeout: nil, read_timeout: nil) open_timeout ||= timeout read_timeout ||= timeout if credentials.dig(:data_api, :client_id) && credentials.dig(:email_api, :client_secret) Listrak::DataApi.new(credentials[:data_api].merge(open_timeout: open_timeout, read_timeout: read_timeout)) else Listrak::BogusDataApi.new end end |
.email(timeout: nil, open_timeout: nil, read_timeout: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/workarea/listrak.rb', line 26 def self.email(timeout: nil, open_timeout: nil, read_timeout: nil) open_timeout ||= timeout read_timeout ||= timeout if credentials.dig(:email_api, :client_id) && credentials.dig(:email_api, :client_secret) Listrak::EmailApi.new(credentials[:email_api].merge(open_timeout: open_timeout, read_timeout: read_timeout)) else Listrak::BogusEmailApi.new end end |