Sha256: 223261e01943097b70d0ce2f08c55ade792908429f6276f7d81d02a74be3ee68

Contents?: true

Size: 1001 Bytes

Versions: 3

Compression:

Stored size: 1001 Bytes

Contents

module Commercelayer
  module CLI
    module Helpers

      def config_data
        YAML::load_file(config_path).deep_symbolize_keys
      end

      def config_data_template
        {
          "commercelayer" => {
            "site" => "https://<subdomain>.commercelayer.io",
            "client_id" => "YOUR-COMMERCELAYER-CLIENT-ID",
            "client_secret" => "YOUR-COMMERCELAYER-CLIENT-SECRET",
            "scope" => "market:<market_id>",
          },
          "dato" => {
            "api_key" => "YOUR-DATOCMS-APIKEY"
          }
        }.to_yaml
      end

      def config_path
        ENV['HOME'] + "/.commercelayer-cli.yml"
      end

      def commercelayer_client
        Commercelayer::Client.new(
          client_id: config_data[:commercelayer][:client_id],
          client_secret: config_data[:commercelayer][:client_secret],
          scope: config_data[:commercelayer][:scope],
          site: config_data[:commercelayer][:site]
        )
      end      

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commercelayer-cli-0.2.2 lib/commercelayer/cli/helpers.rb
commercelayer-cli-0.2.1 lib/commercelayer/cli/helpers.rb
commercelayer-cli-0.2.0 lib/commercelayer/cli/helpers.rb