module Commercelayer::CLI::Helpers

Public Instance Methods

commercelayer_client() click to toggle source
# File lib/commercelayer/cli/helpers.rb, line 30
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
config_data() click to toggle source
# File lib/commercelayer/cli/helpers.rb, line 5
def config_data
  YAML::load_file(config_path).deep_symbolize_keys
end
config_data_template() click to toggle source
# File lib/commercelayer/cli/helpers.rb, line 9
def config_data_template
  {
    "commercelayer" => {
      "site" => "https://<subdomain>.commercelayer.io",
      "client_id" => "YOUR-COMMERCELAYER-CLIENT-ID",
      "client_secret" => "YOUR-COMMERCELAYER-CLIENT-SECRET"
    },
    "contentful" => {
      "space" => "YOUR-CONTENTFUL-SPACE-ID",
      "access_token" => "YOUR-CONTENTFUL-ACCESS-TOKEN"
    },
    "dato" => {
      "api_key" => "YOUR-DATOCMS-APIKEY"
    }
  }.to_yaml
end
config_path() click to toggle source
# File lib/commercelayer/cli/helpers.rb, line 26
def config_path
  ENV['HOME'] + "/.commercelayer-cli.yml"
end