Class: ZendeskAppsSupport::Product

Inherits:
Object
  • Object
show all
Extended by:
Finders
Defined in:
lib/zendesk_apps_support/product.rb

Constant Summary collapse

PRODUCTS_AVAILABLE =

The product codes below match the values in the database, do not change them!

[
  Product.new(code: 1, name: 'support', legacy_name: 'zendesk'),
  Product.new(code: 2, name: 'chat', legacy_name: 'zopim'),
  Product.new(code: 3, name: 'standalone_chat', legacy_name: 'lotus_box')
].freeze
SUPPORT =
find_by!(name: 'support')
CHAT =
find_by!(name: 'chat')
STANDALONE_CHAT =
find_by!(name: 'standalone_chat')

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Finders

find_by, find_by!, where

Constructor Details

#initialize(attrs) ⇒ Product

Returns a new instance of Product.



7
8
9
10
11
# File 'lib/zendesk_apps_support/product.rb', line 7

def initialize(attrs)
  @code = attrs.fetch(:code)
  @name = attrs.fetch(:name)
  @legacy_name = attrs.fetch(:legacy_name)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/zendesk_apps_support/product.rb', line 5

def code
  @code
end

#legacy_nameObject (readonly)

Returns the value of attribute legacy_name.



5
6
7
# File 'lib/zendesk_apps_support/product.rb', line 5

def legacy_name
  @legacy_name
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/zendesk_apps_support/product.rb', line 5

def name
  @name
end

Class Method Details

.allObject



13
14
15
# File 'lib/zendesk_apps_support/product.rb', line 13

def self.all
  PRODUCTS_AVAILABLE
end