Class: SmartRecruiters::Client
- Inherits:
-
Object
- Object
- SmartRecruiters::Client
- Defined in:
- lib/smartrecruiters/client.rb
Constant Summary collapse
- SMART_RECRUITERS_TIMEOUT =
128
- SMART_RECRUITERS_RETRIES =
3
- SMART_RECRUITERS_BASE_PATHS =
{ 'production' => 'https://api.smartrecruiters.com', 'sandbox' => 'https://api.sandbox.smartrecruiters.com' }.freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #access_groups ⇒ Object
- #candidates ⇒ Object
- #connection ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil, environment: 'production') ⇒ Client
constructor
A new instance of Client.
- #interview_types ⇒ Object
- #interviews ⇒ Object
- #jobs ⇒ Object
- #offers ⇒ Object
- #postings ⇒ Object
- #reports ⇒ Object
- #reviews ⇒ Object
- #system_roles ⇒ Object
- #users ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil, environment: 'production') ⇒ Client
Returns a new instance of Client.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/smartrecruiters/client.rb', line 19 def initialize( api_key:, adapter: Faraday.default_adapter, stubs: nil, environment: 'production' ) @api_key = api_key @environment = environment @adapter = adapter @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
17 18 19 |
# File 'lib/smartrecruiters/client.rb', line 17 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
17 18 19 |
# File 'lib/smartrecruiters/client.rb', line 17 def api_key @api_key end |
Instance Method Details
#access_groups ⇒ Object
32 33 34 |
# File 'lib/smartrecruiters/client.rb', line 32 def access_groups AccessGroupsResource.new(self) end |
#candidates ⇒ Object
36 37 38 |
# File 'lib/smartrecruiters/client.rb', line 36 def candidates CandidatesResource.new(self) end |
#connection ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/smartrecruiters/client.rb', line 80 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = SMART_RECRUITERS_BASE_PATHS[@environment] conn.headers['X-SmartToken'] = api_key conn.request :json conn.request :retry, conn.response :json, content_type: 'application/json' conn..timeout = SMART_RECRUITERS_TIMEOUT conn.adapter adapter, @stubs end end |
#interview_types ⇒ Object
40 41 42 |
# File 'lib/smartrecruiters/client.rb', line 40 def interview_types InterviewTypesResource.new(self) end |
#interviews ⇒ Object
44 45 46 |
# File 'lib/smartrecruiters/client.rb', line 44 def interviews InterviewsResource.new(self) end |
#jobs ⇒ Object
48 49 50 |
# File 'lib/smartrecruiters/client.rb', line 48 def jobs JobsResource.new(self) end |
#offers ⇒ Object
52 53 54 |
# File 'lib/smartrecruiters/client.rb', line 52 def offers OffersResource.new(self) end |
#postings ⇒ Object
56 57 58 |
# File 'lib/smartrecruiters/client.rb', line 56 def postings PostingsResource.new(self) end |
#reports ⇒ Object
60 61 62 |
# File 'lib/smartrecruiters/client.rb', line 60 def reports ReportsResource.new(self) end |
#reviews ⇒ Object
64 65 66 |
# File 'lib/smartrecruiters/client.rb', line 64 def reviews ReviewsResource.new(self) end |
#system_roles ⇒ Object
68 69 70 |
# File 'lib/smartrecruiters/client.rb', line 68 def system_roles SystemRolesResource.new(self) end |
#users ⇒ Object
72 73 74 |
# File 'lib/smartrecruiters/client.rb', line 72 def users UsersResource.new(self) end |
#webhooks ⇒ Object
76 77 78 |
# File 'lib/smartrecruiters/client.rb', line 76 def webhooks WebhooksResource.new(self) end |