Class: ConcurConnect::UserFinder
- Inherits:
-
Object
- Object
- ConcurConnect::UserFinder
- Defined in:
- lib/concur_connect/user_finder.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
Returns the value of attribute session.
Instance Method Summary collapse
- #build_user(response) ⇒ Object
- #find(id) ⇒ Object
-
#initialize(session) ⇒ UserFinder
constructor
A new instance of UserFinder.
Constructor Details
#initialize(session) ⇒ UserFinder
Returns a new instance of UserFinder.
7 8 9 |
# File 'lib/concur_connect/user_finder.rb', line 7 def initialize(session) self.session = session end |
Instance Attribute Details
#session ⇒ Object
Returns the value of attribute session.
5 6 7 |
# File 'lib/concur_connect/user_finder.rb', line 5 def session @session end |
Instance Method Details
#build_user(response) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/concur_connect/user_finder.rb', line 19 def build_user(response) user = User.new user.login_id = response['LoginId'] user.first_name = response['FirstName'] user.last_name = response['LastName'] user.session = session user end |
#find(id) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/concur_connect/user_finder.rb', line 11 def find(id) response = session.get 'user/v1.0/User' do |g| g.headers['X-CompanyDomain'] = session.company_id g.headers['X-UserID'] = id end build_user response.body end |