Class: Bandwidth::MessageRequest

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/messaging_lib/messaging/models/message_request.rb

Overview

MessageRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil) ⇒ MessageRequest

Returns a new instance of MessageRequest.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 45

def initialize(application_id = nil,
               to = nil,
               from = nil,
               text = nil,
               media = nil,
               tag = nil)
  @application_id = application_id
  @to = to
  @from = from
  @text = text
  @media = media
  @tag = tag
end

Instance Attribute Details

#application_idString

TODO: Write general description for this method

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 11

def application_id
  @application_id
end

#fromString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 19

def from
  @from
end

#mediaList of String

TODO: Write general description for this method

Returns:

  • (List of String)


27
28
29
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 27

def media
  @media
end

#tagString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 31

def tag
  @tag
end

#textString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 23

def text
  @text
end

#toList of String

TODO: Write general description for this method

Returns:

  • (List of String)


15
16
17
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 15

def to
  @to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  application_id = hash['applicationId']
  to = hash['to']
  from = hash['from']
  text = hash['text']
  media = hash['media']
  tag = hash['tag']

  # Create object from extracted values.
  MessageRequest.new(application_id,
                     to,
                     from,
                     text,
                     media,
                     tag)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
43
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['application_id'] = 'applicationId'
  @_hash['to'] = 'to'
  @_hash['from'] = 'from'
  @_hash['text'] = 'text'
  @_hash['media'] = 'media'
  @_hash['tag'] = 'tag'
  @_hash
end