Class: TerminalShop::Resources::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/terminal_shop/resources/profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Profile

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Profile.



49
50
51
# File 'lib/terminal_shop/resources/profile.rb', line 49

def initialize(client:)
  @client = client
end

Instance Method Details

#me(request_options: {}) ⇒ TerminalShop::Models::ProfileMeResponse

Get the current user’s profile.



37
38
39
40
41
42
43
44
# File 'lib/terminal_shop/resources/profile.rb', line 37

def me(params = {})
  @client.request(
    method: :get,
    path: "profile",
    model: TerminalShop::Models::ProfileMeResponse,
    options: params[:request_options]
  )
end

#update(email: , name: , request_options: {}) ⇒ TerminalShop::Models::ProfileUpdateResponse

Update the current user’s profile.



17
18
19
20
21
22
23
24
25
26
# File 'lib/terminal_shop/resources/profile.rb', line 17

def update(params)
  parsed, options = TerminalShop::ProfileUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: "profile",
    body: parsed,
    model: TerminalShop::Models::ProfileUpdateResponse,
    options: options
  )
end