lib/zoom/actions/billing.rb in zoom_rb-0.11.0 vs lib/zoom/actions/billing.rb in zoom_rb-1.0.0

- old
+ new

@@ -1,38 +1,41 @@ # frozen_string_literal: true module Zoom module Actions module Billing - def billing_get(*args) - params = Zoom::Params.new(Utils.extract_options!(args)) - params.require(:account_id) - Utils.parse_response self.class.get("/accounts/#{params[:account_id]}/billing", headers: request_headers) - end + extend Zoom::Actions - def billing_update(*args) - params = Zoom::Params.new(Utils.extract_options!(args)) - params.require(:account_id).permit(%i[first_name last_name email phone_number address apt city state zip country]) - Utils.parse_response self.class.patch("/accounts/#{params[:account_id]}/billing", body: params.except(:account_id).to_json, headers: request_headers) - end + get 'billing_get', '/accounts/:account_id/billing' - def billing_plans_list(*args) - params = Zoom::Params.new(Utils.extract_options!(args)) - params.require(:account_id) - Utils.parse_response self.class.get("/accounts/#{params[:account_id]}/plans", headers: request_headers) - end + patch 'billing_update', '/accounts/:account_id/billing', + permit: %i[first_name last_name email phone_number address apt city state zip country] - def billing_plans_usage(*args) - params = Zoom::Params.new(Utils.extract_options!(args)) - params.require(:account_id) - Utils.parse_response self.class.get("/accounts/#{params[:account_id]}/plans/usage", headers: request_headers) - end + get 'billing_plans_list', '/accounts/:account_id/plans' - def billing_plans_subscribe(*args) - params = Zoom::Params.new(Utils.extract_options!(args)) - # TODO: Move to constants and do some data validation - params.require(:account_id, contact: %i[first_name last_name email phone_number address city state zip country], plan_base: %i[type hosts]).permit(:plan_recording, contact: [:apt], plan_zoom_rooms: %i[type hosts], plan_room_connector: %i[type hosts], plan_large_meeting: [], plan_webinar: [], plan_audio: %i[type tollfree_countries premium_countries callout_countries ddi_numbers], plan_phone: { plan_base: %i[type hosts], plan_calling: [], plan_number: [] }) - Utils.parse_response self.class.post("/accounts/#{params[:account_id]}/plans", body: params.except(:account_id).to_json, headers: request_headers) - end + get 'billing_plans_usage', '/accounts/:account_id/plans/usage' + + post 'billing_plans_subscribe', '/accounts/:account_id/plans', + require: { + contact: %i[first_name last_name email phone_number address city state zip country], + plan_base: %i[type hosts] + }, + permit: [ + :plan_recording, + { + contact: %i[apt], + plan_zoom_rooms: %i[type hosts], + plan_room_connector: %i[type hosts], + plan_large_meeting: %i[type hosts], + plan_zoom_events: %i[type hosts], + plan_webinar: %i[type hosts], + plan_audio: %i[type tollfree_countries premium_countries callout_countries ddi_numbers], + plan_phone: { + plan_base: %i[type callout_countries], + plan_calling: %i[type hosts], + plan_number: %i[type hosts] + } + } + ] end end -end \ No newline at end of file +end