Class: SFRest::Site_ownership
- Inherits:
-
Object
- Object
- SFRest::Site_ownership
- Defined in:
- lib/sfrest/site_ownership.rb
Overview
We need to keep this naming due to the way connection.rb autoloads things. rubocop: disable Naming/ClassAndModuleCamelCase Manage the site default ownership feature.
Instance Method Summary collapse
-
#default_ownership ⇒ Array
Get current site ownership settings.
-
#initialize(conn) ⇒ Site_ownership
constructor
A new instance of Site_ownership.
-
#make_default_owner(username) ⇒ Array
Set the site ownership settings.
-
#remove_default_owner ⇒ Array
Removes the default site owner.
-
#transfer_site_ownership_using_email(site_id, email, force_transfer) ⇒ Array
Transfers site ownership using recipients email.
-
#transfer_site_ownership_using_username(site_id, username, force_transfer) ⇒ Array
Transfers site ownership using recipients username.
Constructor Details
#initialize(conn) ⇒ Site_ownership
Returns a new instance of Site_ownership.
11 12 13 |
# File 'lib/sfrest/site_ownership.rb', line 11 def initialize(conn) @conn = conn end |
Instance Method Details
#default_ownership ⇒ Array
Get current site ownership settings.
18 19 20 |
# File 'lib/sfrest/site_ownership.rb', line 18 def default_ownership @conn.get('/api/v1/site-ownership') end |
#make_default_owner(username) ⇒ Array
Set the site ownership settings.
26 27 28 29 30 31 32 |
# File 'lib/sfrest/site_ownership.rb', line 26 def make_default_owner(username) payload = { 'username' => username } @conn.put('/api/v1/site-ownership', payload.to_json) end |
#remove_default_owner ⇒ Array
Removes the default site owner.
37 38 39 |
# File 'lib/sfrest/site_ownership.rb', line 37 def remove_default_owner @conn.delete('/api/v1/site-ownership') end |
#transfer_site_ownership_using_email(site_id, email, force_transfer) ⇒ Array
Transfers site ownership using recipients email.
62 63 64 65 66 67 68 69 |
# File 'lib/sfrest/site_ownership.rb', line 62 def transfer_site_ownership_using_email(site_id, email, force_transfer) payload = { 'email' => email, 'force_transfer' => force_transfer } @conn.post("/api/v1/site-ownership/#{site_id}", payload.to_json) end |
#transfer_site_ownership_using_username(site_id, username, force_transfer) ⇒ Array
Transfers site ownership using recipients username.
47 48 49 50 51 52 53 54 |
# File 'lib/sfrest/site_ownership.rb', line 47 def transfer_site_ownership_using_username(site_id, username, force_transfer) payload = { 'username' => username, 'force_transfer' => force_transfer } @conn.post("/api/v1/site-ownership/#{site_id}", payload.to_json) end |