Class: Alchemy::Admin::ProductSelect

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/alchemy/admin/product_select.rb

Constant Summary collapse

VALUE_ATTRIBUTES =
%i[id slug].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, product: nil, url: nil, query_params: nil, placeholder: nil, value_attribute: nil) ⇒ ProductSelect

Returns a new instance of ProductSelect.



10
11
12
13
14
15
16
17
# File 'app/components/alchemy/admin/product_select.rb', line 10

def initialize(api_key, product: nil, url: nil, query_params: nil, placeholder: nil, value_attribute: nil)
  @api_key = api_key
  @product = product
  @url = url
  @query_params = query_params
  @placeholder = placeholder
  @value_attribute = value_attribute
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'app/components/alchemy/admin/product_select.rb', line 8

def api_key
  @api_key
end

#placeholderObject (readonly)

Returns the value of attribute placeholder.



8
9
10
# File 'app/components/alchemy/admin/product_select.rb', line 8

def placeholder
  @placeholder
end

#productObject (readonly)

Returns the value of attribute product.



8
9
10
# File 'app/components/alchemy/admin/product_select.rb', line 8

def product
  @product
end

#query_paramsObject (readonly)

Returns the value of attribute query_params.



8
9
10
# File 'app/components/alchemy/admin/product_select.rb', line 8

def query_params
  @query_params
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'app/components/alchemy/admin/product_select.rb', line 8

def url
  @url
end

Instance Method Details

#callObject



19
20
21
# File 'app/components/alchemy/admin/product_select.rb', line 19

def call
  ("alchemy-product-select", content, attributes)
end