Class: BillForward::ProductRatePlan

Inherits:
MutableEntity show all
Defined in:
lib/bill_forward/entities/product_rate_plan.rb

Overview

This entity exposes the following child entities via method_missing:

Product .product TaxationLink[] .taxation PricingComponent[] .pricingComponents

Instance Attribute Summary

Attributes inherited from BillingEntity

#_client

Class Method Summary collapse

Methods inherited from MutableEntity

#delete, #initialize, #save

Methods inherited from InsertableEntity

create, #initialize

Methods inherited from BillingEntity

#[], #[]=, #_dump, _load, build_entity, build_entity_array, #camel_case_lower, get_all, get_by_id, #initialize, #method_missing, request_ambiguous, request_first_heterotyped, request_many_heterotyped, #serialize, #serialize_field, singleton_client, #state_params, #to_json, #to_ordered_hash, #to_s, #to_unordered_hash

Constructor Details

This class inherits a constructor from BillForward::MutableEntity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BillForward::BillingEntity

Class Method Details

.get_by_product_and_plan_id(product_id, plan_id, query_params = {}, custom_client = nil) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bill_forward/entities/product_rate_plan.rb', line 21

def get_by_product_and_plan_id(product_id, plan_id, query_params = {}, custom_client = nil)
  raise ArgumentError.new("id cannot be nil") if product_id.nil?
  raise ArgumentError.new("id cannot be nil") if plan_id.nil?

  endpoint = sprintf('product/%s/rate-plan/%s',
    ERB::Util.url_encode(product_id),
    ERB::Util.url_encode(plan_id)
    )

  self.request_first('get', endpoint, query_params, custom_client)
end

.get_by_product_id(id, query_params = {}, custom_client = nil) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
# File 'lib/bill_forward/entities/product_rate_plan.rb', line 11

def get_by_product_id(id, query_params = {}, custom_client = nil)
  raise ArgumentError.new("id cannot be nil") if id.nil?

  endpoint = sprintf('product/%s',
    ERB::Util.url_encode(id)
    )

  self.request_many('get', endpoint, query_params, custom_client)
end