Class: Candid::PayerPlanGroups::V1::Client
- Inherits:
-
Object
- Object
- Candid::PayerPlanGroups::V1::Client
- Defined in:
- lib/candid/payer_plan_groups/v_1/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Create a payer plan group.
-
#deactivate(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Marks the payer plan group as deactivated.
-
#get(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Return a plan group with a given ID.
-
#get_multi(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroupPage
Returns all payer plan groups matching filter criteria.
- #initialize(client:, base_url: nil, environment: nil) ⇒ void constructor
-
#update(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Update any of the fields on a payer plan group.
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
12 13 14 15 16 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 12 def initialize(client:, base_url: nil, environment: nil) @client = client @base_url = base_url @environment = environment end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Create a payer plan group
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 125 def create(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "POST", path: "/api/payer-plan-groups/v1", body: Candid::PayerPlanGroups::V1::Types::MutablePayerPlanGroup.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PayerPlanGroups::V1::Types::PayerPlanGroup.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#deactivate(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Marks the payer plan group as deactivated
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 195 def deactivate(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "PATCH", path: "/api/payer-plan-groups/v1/#{params[:payer_plan_group_id]}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PayerPlanGroups::V1::Types::PayerPlanGroup.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Return a plan group with a given ID.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 92 def get(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "GET", path: "/api/payer-plan-groups/v1/#{params[:payer_plan_group_id]}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PayerPlanGroups::V1::Types::PayerPlanGroup.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_multi(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroupPage
Returns all payer plan groups matching filter criteria.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 41 def get_multi(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[plan_group_name payer_uuid payer_id plan_type is_active payer_plan_group_id limit sort_by_similarity sort sort_direction page_token organization_id] query_params = {} query_params["plan_group_name"] = params[:plan_group_name] if params.key?(:plan_group_name) query_params["payer_uuid"] = params[:payer_uuid] if params.key?(:payer_uuid) query_params["payer_id"] = params[:payer_id] if params.key?(:payer_id) query_params["plan_type"] = params[:plan_type] if params.key?(:plan_type) query_params["is_active"] = params[:is_active] if params.key?(:is_active) query_params["payer_plan_group_id"] = params[:payer_plan_group_id] if params.key?(:payer_plan_group_id) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["sort_by_similarity"] = params[:sort_by_similarity] if params.key?(:sort_by_similarity) query_params["sort"] = params[:sort] if params.key?(:sort) query_params["sort_direction"] = params[:sort_direction] if params.key?(:sort_direction) query_params["page_token"] = params[:page_token] if params.key?(:page_token) query_params["organization_id"] = params[:organization_id] if params.key?(:organization_id) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "GET", path: "/api/payer-plan-groups/v1", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PayerPlanGroups::V1::Types::PayerPlanGroupPage.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Candid::PayerPlanGroups::V1::Types::PayerPlanGroup
Update any of the fields on a payer plan group
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/candid/payer_plan_groups/v_1/client.rb', line 160 def update(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "PUT", path: "/api/payer-plan-groups/v1/#{params[:payer_plan_group_id]}", body: Candid::PayerPlanGroups::V1::Types::MutablePayerPlanGroup.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PayerPlanGroups::V1::Types::PayerPlanGroup.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |