Skip to content

Instantly share code, notes, and snippets.

@dmitry-ilyashevich
Created April 26, 2017 14:48
Show Gist options
  • Select an option

  • Save dmitry-ilyashevich/0ceb7bec83d9c6a5b7b484db7ad9d54c to your computer and use it in GitHub Desktop.

Select an option

Save dmitry-ilyashevich/0ceb7bec83d9c6a5b7b484db7ad9d54c to your computer and use it in GitHub Desktop.

Revisions

  1. dmitry-ilyashevich created this gist Apr 26, 2017.
    22 changes: 22 additions & 0 deletions app_id_generator.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    class Analytics::AppIdGenerator
    attr_accessor :current_site
    DEFAULT_APP_ID = 200

    def initialize(current_site = 'fashion', _request_host = nil)
    self.current_site = current_site
    end

    def app_id
    send("#{current_site.gsub(/\.|\-/, "_")}_app_id")
    ensure
    DEFAULT_APP_ID
    end

    def fashion_app_id
    200
    end

    def sheknows_fashion_app_id
    201
    end
    end