Class: WhatsappSdk::Resource::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/whatsapp_sdk/resource/template.rb

Defined Under Namespace

Modules: Category, Status

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, status:, category:, language: nil, name: nil, components_json: nil) ⇒ Template



41
42
43
44
45
46
47
48
# File 'lib/whatsapp_sdk/resource/template.rb', line 41

def initialize(id:, status:, category:, language: nil, name: nil, components_json: nil)
  @id = id
  @status = status
  @category = category
  @language = language
  @name = name
  @components_json = components_json
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def category
  @category
end

#components_jsonObject

Returns the value of attribute components_json.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def components_json
  @components_json
end

#idObject

Returns the value of attribute id.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def id
  @id
end

#languageObject

Returns the value of attribute language.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def language
  @language
end

#nameObject

Returns the value of attribute name.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def name
  @name
end

#statusObject

Returns the value of attribute status.



39
40
41
# File 'lib/whatsapp_sdk/resource/template.rb', line 39

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/whatsapp_sdk/resource/template.rb', line 50

def self.from_hash(hash)
  new(
    id: hash["id"],
    status: hash["status"],
    category: hash["category"],
    language: hash["language"],
    name: hash["name"],
    components_json: hash["components"]
  )
end

Instance Method Details

#==(other) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/whatsapp_sdk/resource/template.rb', line 61

def ==(other)
  id == other.id &&
    status == other.status &&
    category == other.category &&
    language == other.language &&
    name == other.name &&
    components_json == other.components_json
end