class ZendeskAppsSupport::Location

Constants

LOCATIONS_AVAILABLE

the ids below match the enum values on the database, do not change them!

Attributes

collapsible[R]
id[R]
name[R]
orderable[R]
product_code[R]
v2_only[R]
visible[R]

Public Class Methods

all() click to toggle source
# File lib/zendesk_apps_support/location.rb, line 28
def self.all
  LOCATIONS_AVAILABLE
end
new(attrs) click to toggle source
# File lib/zendesk_apps_support/location.rb, line 12
def initialize(attrs)
  @id = attrs.fetch(:id)
  raise 'Duplicate id' if Location.unique_ids.include? @id
  Location.unique_ids.add @id
  @name = attrs.fetch(:name)
  @orderable = attrs.fetch(:orderable, false)
  @collapsible = attrs.fetch(:collapsible, false)
  @visible = attrs.fetch(:visible, false)
  @product_code = attrs.fetch(:product_code)
  @v2_only = attrs.fetch(:v2_only, product != Product::SUPPORT)
end
unique_ids() click to toggle source
# File lib/zendesk_apps_support/location.rb, line 8
def self.unique_ids
  @ids ||= Set.new
end

Public Instance Methods

product() click to toggle source
# File lib/zendesk_apps_support/location.rb, line 24
def product
  Product.find_by(code: product_code)
end