Class: WorkOS::UserResponse

Inherits:
Object
  • Object
show all
Includes:
HashProvider
Defined in:
lib/workos/user_response.rb

Overview

The UserResponse class represents a User as well as an corresponding response data that can later be appended on.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(user_response_json) ⇒ UserResponse

Returns a new instance of UserResponse.



11
12
13
14
# File 'lib/workos/user_response.rb', line 11

def initialize(user_response_json)
  json = JSON.parse(user_response_json, symbolize_names: true)
  @user = WorkOS::User.new(json[:user].to_json)
end

Instance Attribute Details

#userObject

Returns the value of attribute user.



9
10
11
# File 'lib/workos/user_response.rb', line 9

def user
  @user
end

Instance Method Details

#to_jsonObject



16
17
18
19
20
# File 'lib/workos/user_response.rb', line 16

def to_json(*)
  {
    user: user.to_json,
  }
end