Class: ActionKitRest::User

Inherits:
Base
  • Object
show all
Defined in:
lib/action_kit_rest/user.rb

Instance Method Summary collapse

Methods inherited from Base

#create, #list, #normalized_base_path, #update

Instance Method Details

#base_pathObject



5
6
7
# File 'lib/action_kit_rest/user.rb', line 5

def base_path
  'user'
end

#get(id) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/action_kit_rest/user.rb', line 9

def get(id)
  user = super(id)

  # Perform a second request to retrieve user's phones data if any available
  # (user.phones attribute includes the path for associated phones, not the data itself)
  if user.id.present? && user.phones.any?
    phones_list = client.phone.list(user: user.id)
    user.obj.phones = phones_list.obj.to_a
  end

  user
end