Class: Purest::Users

Inherits:
APIMethods show all
Defined in:
lib/purest/users.rb

Constant Summary collapse

GET_PARAMS =
%i[api_token expose publickey].freeze

Instance Method Summary collapse

Methods inherited from APIMethods

#append_path

Methods inherited from Rest

access_method?, #authenticated?, #concat_url, #initialize, #logout, method_missing, #use_named_parameter

Constructor Details

This class inherits a constructor from Purest::Rest

Instance Method Details

#create(options = nil) ⇒ Object



20
21
22
23
# File 'lib/purest/users.rb', line 20

def create(options = nil)
  path = "admin/#{options.delete(:name)}/apitoken"
  super(options, path)
end

#delete(options = nil) ⇒ Object



29
30
31
32
# File 'lib/purest/users.rb', line 29

def delete(options = nil)
  path = "admin/#{options.delete(:name)}/apitoken"
  super(options, path)
end

#get(options = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/purest/users.rb', line 9

def get(options = nil)
  if !options.nil? && options[:name] && options[:api_token]
    path = "admin/#{options[:name]}/apitoken"
    options.delete_if { |k| k == :name || k == :api_token }
  else
    path = 'admin'
  end

  super(options, path, GET_PARAMS)
end

#update(options = nil) ⇒ Object



25
26
27
# File 'lib/purest/users.rb', line 25

def update(options = nil)
  super(options, 'admin')
end