Class: Square::TeamMembers::WageSetting::Client
- Inherits:
-
Object
- Object
- Square::TeamMembers::WageSetting::Client
- Defined in:
- lib/square/team_members/wage_setting/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Square::Types::GetWageSettingResponse
Retrieves a ‘WageSetting` object for a team member specified by `TeamMember.id`.
- #initialize(client:) ⇒ Square::TeamMembers::WageSetting::Client constructor
-
#update(request_options: {}, **params) ⇒ Square::Types::UpdateWageSettingResponse
Creates or updates a ‘WageSetting` object.
Constructor Details
#initialize(client:) ⇒ Square::TeamMembers::WageSetting::Client
8 9 10 |
# File 'lib/square/team_members/wage_setting/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Square::Types::GetWageSettingResponse
Retrieves a ‘WageSetting` object for a team member specified by `TeamMember.id`. For more information, see [Troubleshooting the Team API](developer.squareup.com/docs/team/troubleshooting#retrievewagesetting).
Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get this information directly from the ‘TeamMember.wage_setting` field.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/square/team_members/wage_setting/client.rb', line 20 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "GET", path: "v2/team-members/#{params[:team_member_id]}/wage-setting" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::GetWageSettingResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Square::Types::UpdateWageSettingResponse
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](developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting).
Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember) to manage the ‘TeamMember.wage_setting` field directly.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/square/team_members/wage_setting/client.rb', line 50 def update(request_options: {}, **params) _path_param_names = ["team_member_id"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "PUT", path: "v2/team-members/#{params[:team_member_id]}/wage-setting", body: params.except(*_path_param_names) ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Square::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Square::Types::UpdateWageSettingResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |