Class: Square::Bookings::TeamMemberProfiles::Client
- Inherits:
-
Object
- Object
- Square::Bookings::TeamMemberProfiles::Client
- Defined in:
- lib/square/bookings/team_member_profiles/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Square::Types::GetTeamMemberBookingProfileResponse
Retrieves a team member’s booking profile.
- #initialize(client:) ⇒ Square::Bookings::TeamMemberProfiles::Client constructor
-
#list(request_options: {}, **params) ⇒ Square::Types::ListTeamMemberBookingProfilesResponse
Lists booking profiles for team members.
Constructor Details
#initialize(client:) ⇒ Square::Bookings::TeamMemberProfiles::Client
8 9 10 |
# File 'lib/square/bookings/team_member_profiles/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Square::Types::GetTeamMemberBookingProfileResponse
Retrieves a team member’s booking profile.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/square/bookings/team_member_profiles/client.rb', line 46 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "GET", path: "v2/bookings/team-member-booking-profiles/#{params[:team_member_id]}" ) 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::GetTeamMemberBookingProfileResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Square::Types::ListTeamMemberBookingProfilesResponse
Lists booking profiles for team members.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/square/bookings/team_member_profiles/client.rb', line 15 def list(request_options: {}, **params) _query_param_names = [ %w[bookable_only limit cursor location_id], %i[bookable_only limit cursor location_id] ].flatten _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::PRODUCTION, method: "GET", path: "v2/bookings/team-member-booking-profiles", query: _query ) 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::ListTeamMemberBookingProfilesResponse.load(_response.body) else error_class = Square::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |