Class: Bandwidth::ConferenceState

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/bandwidth/voice_lib/voice/models/conference_state.rb

Overview

ConferenceState Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, name = nil, created_time = nil, completed_time = nil, conference_event_url = nil, conference_event_method = nil, tag = nil, active_members = nil) ⇒ ConferenceState

Returns a new instance of ConferenceState.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 83

def initialize(id = nil,
               name = nil,
               created_time = nil,
               completed_time = nil,
               conference_event_url = nil,
               conference_event_method = nil,
               tag = nil,
               active_members = nil)
  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @created_time = created_time unless created_time == SKIP
  @completed_time = completed_time unless completed_time == SKIP
  @conference_event_url = conference_event_url unless conference_event_url == SKIP
  @conference_event_method = conference_event_method unless conference_event_method == SKIP
  @tag = tag unless tag == SKIP
  @active_members = active_members unless active_members == SKIP
end

Instance Attribute Details

#active_membersList of ConferenceMemberState

TODO: Write general description for this method

Returns:



43
44
45
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 43

def active_members
  @active_members
end

#completed_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


27
28
29
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 27

def completed_time
  @completed_time
end

#conference_event_methodConferenceEventMethodEnum

TODO: Write general description for this method



35
36
37
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 35

def conference_event_method
  @conference_event_method
end

#conference_event_urlString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 31

def conference_event_url
  @conference_event_url
end

#created_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


23
24
25
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 23

def created_time
  @created_time
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 15

def id
  @id
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 19

def name
  @name
end

#tagString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 39

def tag
  @tag
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  created_time = if hash.key?('createdTime')
                   (DateTimeHelper.from_rfc3339(hash['createdTime']) if hash['createdTime'])
                 else
                   SKIP
                 end
  completed_time = if hash.key?('completedTime')
                     (DateTimeHelper.from_rfc3339(hash['completedTime']) if hash['completedTime'])
                   else
                     SKIP
                   end
  conference_event_url =
    hash.key?('conferenceEventUrl') ? hash['conferenceEventUrl'] : SKIP
  conference_event_method =
    hash.key?('conferenceEventMethod') ? hash['conferenceEventMethod'] : SKIP
  tag = hash.key?('tag') ? hash['tag'] : SKIP
  # Parameter is an array, so we need to iterate through it
  active_members = nil
  unless hash['activeMembers'].nil?
    active_members = []
    hash['activeMembers'].each do |structure|
      active_members << (ConferenceMemberState.from_hash(structure) if structure)
    end
  end

  active_members = SKIP unless hash.key?('activeMembers')

  # Create object from extracted values.
  ConferenceState.new(id,
                      name,
                      created_time,
                      completed_time,
                      conference_event_url,
                      conference_event_method,
                      tag,
                      active_members)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['created_time'] = 'createdTime'
  @_hash['completed_time'] = 'completedTime'
  @_hash['conference_event_url'] = 'conferenceEventUrl'
  @_hash['conference_event_method'] = 'conferenceEventMethod'
  @_hash['tag'] = 'tag'
  @_hash['active_members'] = 'activeMembers'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



74
75
76
77
78
79
80
81
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 74

def nullables
  %w[
    completed_time
    conference_event_url
    conference_event_method
    tag
  ]
end

#optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 60

def optionals
  %w[
    id
    name
    created_time
    completed_time
    conference_event_url
    conference_event_method
    tag
    active_members
  ]
end

#to_completed_timeObject



149
150
151
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 149

def to_completed_time
  DateTimeHelper.to_rfc3339(completed_time)
end

#to_created_timeObject



145
146
147
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 145

def to_created_time
  DateTimeHelper.to_rfc3339(created_time)
end