Class: Bandwidth::Media
- Defined in:
- lib/bandwidth/messaging_lib/messaging/models/media.rb
Overview
Media Model.
Instance Attribute Summary collapse
-
#content ⇒ String
TODO: Write general description for this method.
-
#content_length ⇒ Integer
TODO: Write general description for this method.
-
#media_name ⇒ 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(content = nil, content_length = nil, media_name = nil) ⇒ Media
constructor
A new instance of Media.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(content = nil, content_length = nil, media_name = nil) ⇒ Media
Returns a new instance of Media.
47 48 49 50 51 52 53 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 47 def initialize(content = nil, content_length = nil, media_name = nil) @content = content unless content == SKIP @content_length = content_length unless content_length == SKIP @media_name = media_name unless media_name == SKIP end |
Instance Attribute Details
#content ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 14 def content @content end |
#content_length ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 18 def content_length @content_length end |
#media_name ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 22 def media_name @media_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. content = hash.key?('content') ? hash['content'] : SKIP content_length = hash.key?('contentLength') ? hash['contentLength'] : SKIP media_name = hash.key?('mediaName') ? hash['mediaName'] : SKIP # Create object from extracted values. Media.new(content, content_length, media_name) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['content'] = 'content' @_hash['content_length'] = 'contentLength' @_hash['media_name'] = 'mediaName' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 43 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/bandwidth/messaging_lib/messaging/models/media.rb', line 34 def optionals %w[ content content_length media_name ] end |