Class: Fluffy::Session::Addressbook
- Inherits:
-
Object
- Object
- Fluffy::Session::Addressbook
- Includes:
- API
- Defined in:
- lib/fluffy/session/addressbook.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ String
readonly
The session endpoint.
Instance Method Summary collapse
-
#add(name:, **params) ⇒ Hash?
Add a new entry in the session addressbook.
-
#delete(name:) ⇒ Hash?
Delete an entry from the session addressbook.
-
#get ⇒ Hash
Retrieve the session addressbook.
-
#initialize(endpoint:) ⇒ Addressbook
constructor
Create an addressbook instance for a given session.
-
#update(name:, **params) ⇒ Hash?
Update an existing entry in the session addressbook.
Methods included from 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
#endpoint ⇒ String (readonly)
Returns The session endpoint.
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 |
#get ⇒ Hash
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 |