Module: Transaction
- Defined in:
- lib/transaction.rb,
lib/transaction/version.rb
Defined Under Namespace
Constant Summary collapse
- STATUSES =
i[queued processing success error].freeze
- DEFAULT_ATTRIBUTES =
{ status: :queued }.freeze
- VERSION =
'1.0.0'
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .pubsub_client ⇒ Object
- .pubsub_client=(client:, trigger:, channel_name: nil, event: 'status') ⇒ Object
- .redis ⇒ Object
- .redis=(hash = {}) ⇒ Object
Class Method Details
.configure {|_self| ... } ⇒ Object
16 17 18 |
# File 'lib/transaction.rb', line 16 def self.configure yield self end |
.pubsub_client ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/transaction.rb', line 40 def self.pubsub_client return if @client.nil? || @trigger.nil? { client: @client, trigger: @trigger, event: @event, channel_name: @channel_name } end |
.pubsub_client=(client:, trigger:, channel_name: nil, event: 'status') ⇒ Object
33 34 35 36 37 38 |
# File 'lib/transaction.rb', line 33 def self.pubsub_client=(client:, trigger:, channel_name: nil, event: 'status') @client = client @trigger = trigger @event = event @channel_name = channel_name end |
.redis ⇒ Object
28 29 30 31 |
# File 'lib/transaction.rb', line 28 def self.redis # use default redis if not set @redis ||= Redis.new end |
.redis=(hash = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/transaction.rb', line 20 def self.redis=(hash = {}) @redis = if hash.instance_of?(Redis) hash else Redis.new(hash) end end |