Sha256: a971213d4caba360b6ee304a7a72ea00891e4c16c27727758f52c8d8dc705131

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

module SolidusAfterpay
  class UserAgentGenerator
    def initialize(merchant_id:)
      @merchant_id = merchant_id
    end

    def generate
      "#{afterpay_plugin} (#{platform}; #{system_information}; #{merchant_id}) #{merchant_website_url}"
    end

    private

    def afterpay_plugin
      "SolidusAfterpay/#{SolidusAfterpay::VERSION}"
    end

    def platform
      "Solidus/#{::Spree.solidus_gem_version}"
    end

    def system_information
      "Ruby/#{RUBY_VERSION}"
    end

    def merchant_id
      "Merchant/#{@merchant_id}"
    end

    def merchant_website_url
      "https://#{::Spree::Store.default.url}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_afterpay-0.3.0 app/models/solidus_afterpay/user_agent_generator.rb
solidus_afterpay-0.2.0 app/models/solidus_afterpay/user_agent_generator.rb
solidus_afterpay-0.1.0 app/models/solidus_afterpay/user_agent_generator.rb