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'),
  Product.new(code: 4, name: 'sell', legacy_name: 'sell')
].freeze
SUPPORT =
find_by!(name: 'support')
CHAT =
find_by!(name: 'chat')
STANDALONE_CHAT =
find_by!(name: 'standalone_chat')
SELL =
find_by!(name: 'sell')

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.



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

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.



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

def code
  @code
end

#legacy_nameObject (readonly)

Returns the value of attribute legacy_name.



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

def legacy_name
  @legacy_name
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.allObject



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

def self.all
  PRODUCTS_AVAILABLE
end