Class: Five9::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/five9/user_resources/profile.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Profile

Returns a new instance of Profile.



4
5
6
# File 'lib/five9/user_resources/profile.rb', line 4

def initialize(args)
  @attributes = AccessibleHash.new(args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



13
14
15
# File 'lib/five9/user_resources/profile.rb', line 13

def method_missing(method_name, *args)
  @attributes.send(method_name, *args)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/five9/user_resources/profile.rb', line 3

def attributes
  @attributes
end

Class Method Details

.allObject



25
26
27
28
29
# File 'lib/five9/user_resources/profile.rb', line 25

def self.all
  ProfileManagement.get_user_profiles.map do |profile_info|
    self.new(profile_info)
  end
end

.create!(args) ⇒ Object



17
18
19
# File 'lib/five9/user_resources/profile.rb', line 17

def self.create!(args)
  self.new(ProfileManagement.(args))
end

.find(profile_name) ⇒ Object



21
22
23
# File 'lib/five9/user_resources/profile.rb', line 21

def self.find(profile_name)
  self.new(matching_profile(all, profile_name))
end

Instance Method Details

#saveObject Also known as: update!



8
9
10
# File 'lib/five9/user_resources/profile.rb', line 8

def save
  ProfileManagement.(self.to_h)
end