Class: SquareLegacy::TeamApi
- Defined in:
- lib/square_legacy/api/team_api.rb
Overview
TeamApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#bulk_create_team_members(body:) ⇒ ApiResponse
Creates multiple
TeamMemberobjects. -
#bulk_update_team_members(body:) ⇒ ApiResponse
Updates multiple
TeamMemberobjects. -
#create_job(body:) ⇒ ApiResponse
Creates a job in a seller account.
-
#create_team_member(body:) ⇒ ApiResponse
Creates a single
TeamMemberobject. -
#list_jobs(cursor: nil) ⇒ ApiResponse
Lists jobs in a seller account.
-
#retrieve_job(job_id:) ⇒ ApiResponse
Retrieves a specified job.
-
#retrieve_team_member(team_member_id:) ⇒ ApiResponse
Retrieves a
TeamMemberobject for the givenTeamMember.id. -
#retrieve_wage_setting(team_member_id:) ⇒ ApiResponse
Retrieves a
WageSettingobject for a team member specified byTeamMember.id. -
#search_team_members(body:) ⇒ ApiResponse
Returns a paginated list of
TeamMemberobjects for a business. -
#update_job(job_id:, body:) ⇒ ApiResponse
Updates the title or tip eligibility of a job.
-
#update_team_member(team_member_id:, body:) ⇒ ApiResponse
Updates a single
TeamMemberobject. -
#update_wage_setting(team_member_id:, body:) ⇒ ApiResponse
Creates or updates a
WageSettingobject.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SquareLegacy::BaseApi
Instance Method Details
#bulk_create_team_members(body:) ⇒ ApiResponse
Creates multiple TeamMember objects. The created TeamMember objects
are returned on successful creates.
This process is non-transactional and processes as much of the request as
possible. If one of the creates in
the request cannot be successfully processed, the request is not marked as
failed, but the body of the response
contains explicit error information for the failed create.
Learn about [Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-
team-members).
containing the fields to POST for the request. See the corresponding
object definition for field details.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/square_legacy/api/team_api.rb', line 47 def bulk_create_team_members(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/team-members/bulk-create', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#bulk_update_team_members(body:) ⇒ ApiResponse
Updates multiple TeamMember objects. The updated TeamMember objects
are returned on successful updates.
This process is non-transactional and processes as much of the request as
possible. If one of the updates in
the request cannot be successfully processed, the request is not marked as
failed, but the body of the response
contains explicit error information for the failed update.
Learn about [Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-
team-members).
containing the fields to POST for the request. See the corresponding
object definition for field details.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/square_legacy/api/team_api.rb', line 78 def bulk_update_team_members(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/team-members/bulk-update', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_job(body:) ⇒ ApiResponse
Creates a job in a seller account. A job defines a title and tip eligibility. Note that compensation is defined in a job assignment in a team member's wage setting. the fields to POST for the request. See the corresponding object definition for field details.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/square_legacy/api/team_api.rb', line 126 def create_job(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/team-members/jobs', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_team_member(body:) ⇒ ApiResponse
Creates a single TeamMember object. The TeamMember object is returned
on successful creates.
You must provide the following values in your request to this endpoint:
given_namefamily_nameLearn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteamme mber). containing the fields to POST for the request. See the corresponding object definition for field details.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/square_legacy/api/team_api.rb', line 16 def create_team_member(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/team-members', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_jobs(cursor: nil) ⇒ ApiResponse
Lists jobs in a seller account. Results are sorted by title in ascending order. by the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p atterns/pagination).
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/square_legacy/api/team_api.rb', line 103 def list_jobs(cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/team-members/jobs', 'default') .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_job(job_id:) ⇒ ApiResponse
Retrieves a specified job. retrieve.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/square_legacy/api/team_api.rb', line 147 def retrieve_job(job_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/team-members/jobs/{job_id}', 'default') .template_param(new_parameter(job_id, key: 'job_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_team_member(team_member_id:) ⇒ ApiResponse
Retrieves a TeamMember object for the given TeamMember.id.
Learn about [Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-t
eam-member).
member to retrieve.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/square_legacy/api/team_api.rb', line 226 def retrieve_team_member(team_member_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/team-members/{team_member_id}', 'default') .template_param(new_parameter(team_member_id, key: 'team_member_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_wage_setting(team_member_id:) ⇒ ApiResponse
Retrieves a WageSetting object for a team member specified
by TeamMember.id. For more information, see
[Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
setting).
Square recommends using RetrieveTeamMember
or SearchTeamMembers
to get this information directly from the TeamMember.wage_setting field.
member for which to retrieve the wage setting.
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/square_legacy/api/team_api.rb', line 284 def retrieve_wage_setting(team_member_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/team-members/{team_member_id}/wage-setting', 'default') .template_param(new_parameter(team_member_id, key: 'team_member_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_team_members(body:) ⇒ ApiResponse
Returns a paginated list of TeamMember objects for a business.
The list can be filtered by location IDs, ACTIVE or INACTIVE status,
or whether
the team member is the Square account owner.
containing the fields to POST for the request. See the corresponding
object definition for field details.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/square_legacy/api/team_api.rb', line 202 def search_team_members(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/team-members/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_job(job_id:, body:) ⇒ ApiResponse
Updates the title or tip eligibility of a job. Changes to the title
propagate to all
JobAssignment, Shift, and TeamMemberWage objects that reference the
job ID. Changes to
tip eligibility propagate to all TeamMemberWage objects that reference
the job ID.
the fields to POST for the request. See the corresponding object
definition for field details.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/square_legacy/api/team_api.rb', line 174 def update_job(job_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/team-members/jobs/{job_id}', 'default') .template_param(new_parameter(job_id, key: 'job_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_team_member(team_member_id:, body:) ⇒ ApiResponse
Updates a single TeamMember object. The TeamMember object is returned
on successful updates.
Learn about [Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#update-a-tea
m-member).
member to update.
containing the fields to POST for the request. See the corresponding
object definition for field details.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/square_legacy/api/team_api.rb', line 253 def update_team_member(team_member_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/team-members/{team_member_id}', 'default') .template_param(new_parameter(team_member_id, key: 'team_member_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_wage_setting(team_member_id:, body:) ⇒ ApiResponse
Creates or updates a WageSetting object. The object is created if a
WageSetting with the specified team_member_id doesn't exist.
Otherwise,
it fully replaces the WageSetting object for the team member.
The WageSetting is returned on a successful update. For more
information, see
[Troubleshooting the Team
API](https://developer.squareup.com/docs/team/troubleshooting#create-or-up
date-a-wage-setting).
Square recommends using CreateTeamMember or
UpdateTeamMember
to manage the TeamMember.wage_setting field directly.
member for which to update the WageSetting object.
containing the fields to POST for the request. See the corresponding
object definition for field details.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/square_legacy/api/team_api.rb', line 318 def update_wage_setting(team_member_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/team-members/{team_member_id}/wage-setting', 'default') .template_param(new_parameter(team_member_id, key: 'team_member_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |