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.



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

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
  @name = name
  @created_time = created_time
  @completed_time = completed_time
  @conference_event_url = conference_event_url
  @conference_event_method = conference_event_method
  @tag = tag
  @active_members = active_members
end

Instance Attribute Details

#active_membersList of ConferenceMemberState

TODO: Write general description for this method

Returns:



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

def active_members
  @active_members
end

#completed_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def completed_time
  @completed_time
end

#conference_event_methodConferenceEventMethodEnum

TODO: Write general description for this method



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

def conference_event_method
  @conference_event_method
end

#conference_event_urlString

TODO: Write general description for this method

Returns:

  • (String)


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

def conference_event_url
  @conference_event_url
end

#created_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def created_time
  @created_time
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


12
13
14
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 12

def id
  @id
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#tagString

TODO: Write general description for this method

Returns:

  • (String)


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

def tag
  @tag
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash['id']
  name = hash['name']
  created_time = DateTimeHelper.from_rfc3339(hash['createdTime']) if
    hash['createdTime']
  completed_time = DateTimeHelper.from_rfc3339(hash['completedTime']) if
    hash['completedTime']
  conference_event_url = hash['conferenceEventUrl']
  conference_event_method = hash['conferenceEventMethod']
  tag = hash['tag']
  # 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

  # 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.



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 43

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

#to_completed_timeObject



112
113
114
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 112

def to_completed_time
  DateTimeHelper.to_rfc3339(completed_time)
end

#to_created_timeObject



108
109
110
# File 'lib/bandwidth/voice_lib/voice/models/conference_state.rb', line 108

def to_created_time
  DateTimeHelper.to_rfc3339(created_time)
end