Module: FlowcommerceSpree::ExperienceService

Extended by:
ExperienceService
Included in:
ExperienceService
Defined in:
lib/flowcommerce_spree/experience_service.rb

Instance Method Summary collapse

Instance Method Details

#all(no_world = nil) ⇒ Object



9
10
11
12
# File 'lib/flowcommerce_spree/experience_service.rb', line 9

def all(no_world = nil)
  experiences = fetch_from_flow
  no_world ? experiences.reject { |exp| exp.key == 'world' } : experiences
end

#defaultObject



25
26
27
28
# File 'lib/flowcommerce_spree/experience_service.rb', line 25

def default
  FlowcommerceSpree::ExperienceService
    .all.select { |exp| exp.key.downcase == ENV.fetch('FLOW_BASE_COUNTRY').downcase }.first
end

#get(key) ⇒ Object



18
19
20
21
22
23
# File 'lib/flowcommerce_spree/experience_service.rb', line 18

def get(key)
  all.each do |exp|
    return exp if exp.key == key
  end
  nil
end

#keysObject



14
15
16
# File 'lib/flowcommerce_spree/experience_service.rb', line 14

def keys
  all.map(&:key)
end