Class: Bandwidth::Tag
- Defined in:
- lib/bandwidth/messaging_lib/messaging/models/tag.rb
Overview
Tag Model.
Instance Attribute Summary collapse
-
#key ⇒ String
TODO: Write general description for this method.
-
#value ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(key = nil, value = nil) ⇒ Tag
constructor
A new instance of Tag.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(key = nil, value = nil) ⇒ Tag
Returns a new instance of Tag.
41 42 43 44 45 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 41 def initialize(key = nil, value = nil) @key = key unless key == SKIP @value = value unless value == SKIP end |
Instance Attribute Details
#key ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 14 def key @key end |
#value ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 18 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. key = hash.key?('key') ? hash['key'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP # Create object from extracted values. Tag.new(key, value) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['key'] = 'key' @_hash['value'] = 'value' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 37 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
29 30 31 32 33 34 |
# File 'lib/bandwidth/messaging_lib/messaging/models/tag.rb', line 29 def optionals %w[ key value ] end |