Class: Sambot::Slack::ProductTag

Inherits:
Object
  • Object
show all
Defined in:
lib/sambot/slack/product_tag.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name) ⇒ ProductTag

Returns a new instance of ProductTag.



7
8
9
10
# File 'lib/sambot/slack/product_tag.rb', line 7

def initialize(id, name)
  @id = id
  @name = name
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/sambot/slack/product_tag.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/sambot/slack/product_tag.rb', line 5

def name
  @name
end

Class Method Details

.find(client, name) ⇒ Object



12
13
14
15
# File 'lib/sambot/slack/product_tag.rb', line 12

def self.find(client, name)
  query = "SELECT Id, Name FROM ADM_Product_Tag__c WHERE Active__c = true AND Name = '#{name}'"
  client.query(query).map {|x| ProductTag.new(x[:Id], x[:Name]) }[0]
end