Class: CFC::User

Inherits:
APIObject show all
Defined in:
lib/cfc/objects/user.rb

Class Method Summary collapse

Methods inherited from APIObject

#initialize, #inspect, #method_missing, opts, relationship, #respond_to_missing?, #to_h, #to_json

Constructor Details

This class inherits a constructor from CFC::APIObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CFC::APIObject

Class Method Details

.detailsObject

Get full details of the current user.



8
9
10
# File 'lib/cfc/objects/user.rb', line 8

def self.details
  new(@api.get_json('user')['result'])
end

.edit(first_name: nil, last_name: nil, telephone: nil, country: nil, zipcode: nil) ⇒ Object

Update part of the current user’s details as permitted.

Parameters:

  • first_name (String) (defaults to: nil)
  • last_name (String) (defaults to: nil)
  • telephone (String) (defaults to: nil)
  • country (String) (defaults to: nil)
  • zipcode (String) (defaults to: nil)


19
20
21
22
# File 'lib/cfc/objects/user.rb', line 19

def self.edit(first_name: nil, last_name: nil, telephone: nil, country: nil, zipcode: nil)
  data = opts(binding)
  @api.patch_to_json('user', data)
end