Sha256: 892394b3c00447185b430d15002b19e7130bcd15e828022d43a62589f57db927

Contents?: true

Size: 714 Bytes

Versions: 17

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true
require 'shopify_cli'

module Extension
  module Tasks
    module Converters
      module AppConverter
        API_KEY_FIELD = 'apiKey'
        API_SECRET_KEYS_FIELD = 'apiSecretKeys'
        API_SECRET_FIELD = 'secret'
        TITLE_FIELD = 'title'
        ORGANIZATION_NAME_FIELD = 'businessName'

        def self.from_hash(hash, organization = {})
          return nil if hash.nil?

          Models::App.new(
            api_key: hash[API_KEY_FIELD],
            secret: hash[API_SECRET_KEYS_FIELD].first[API_SECRET_FIELD],
            title: hash[TITLE_FIELD],
            business_name: organization[ORGANIZATION_NAME_FIELD]
          )
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.5.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.4.1 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.4.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.3.1 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.3.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.2.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.1.2 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.1.1 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.1.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.5 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.4 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.3 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.2 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.1 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-1.0.0 lib/project_types/extension/tasks/converters/app_converter.rb
shopify-cli-0.9.3 lib/project_types/extension/tasks/converters/app_converter.rb