Class: Fluffy::Session::Addressbook

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/fluffy/session/addressbook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API

api

Constructor Details

#initialize(endpoint:) ⇒ Addressbook

Create an addressbook instance for a given session



15
16
17
# File 'lib/fluffy/session/addressbook.rb', line 15

def initialize(endpoint:)
  @endpoint = endpoint + ['addressbook']
end

Instance Attribute Details

#endpointString (readonly)



9
10
11
# File 'lib/fluffy/session/addressbook.rb', line 9

def endpoint
  @endpoint
end

Instance Method Details

#add(name:, **params) ⇒ Hash?

Add a new entry in the session addressbook



33
34
35
# File 'lib/fluffy/session/addressbook.rb', line 33

def add(name:, **params)
  @@api.post(endpoint: self.endpoint + [name], params: params)
end

#delete(name:) ⇒ Hash?

Delete an entry from the session addressbook



52
53
54
# File 'lib/fluffy/session/addressbook.rb', line 52

def delete(name:)
  @@api.delete(endpoint: self.endpoint + [name])
end

#getHash

Retrieve the session addressbook



23
24
25
# File 'lib/fluffy/session/addressbook.rb', line 23

def get
  @@api.get(endpoint: self.endpoint)
end

#update(name:, **params) ⇒ Hash?

Update an existing entry in the session addressbook



43
44
45
# File 'lib/fluffy/session/addressbook.rb', line 43

def update(name:, **params)
  @@api.patch(endpoint: self.endpoint + [name], params: params)
end