Class: IronBank::Resources::RatePlanCharge

Inherits:
IronBank::Resource show all
Extended by:
Gem::Deprecate
Defined in:
lib/iron_bank/resources/rate_plan_charge.rb

Overview

A rate plan charge belongs to a subscription rate plan.

Instance Attribute Summary

Attributes inherited from IronBank::Resource

#remote

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IronBank::Resource

#==, #id, #initialize, #inspect, object_name, #reload, #remove_instance_vars, with_cache, with_local_records

Methods included from Associations::ClassMethods

#with_many, #with_one

Methods included from Metadata

#excluded_fields, #fields, #query_custom_fields, #query_fields, #reset, #schema, #single_resource_query_fields, #with_schema

Methods included from Queryable

#all, #find, #find_each, #first, #where

Methods included from Associations

#with_memoization

Constructor Details

This class inherits a constructor from IronBank::Resource

Class Method Details

.excluded_fieldsObject



10
11
12
# File 'lib/iron_bank/resources/rate_plan_charge.rb', line 10

def self.excluded_fields
  super + single_resource_query_fields
end

.single_resource_query_fieldsObject



14
15
16
# File 'lib/iron_bank/resources/rate_plan_charge.rb', line 14

def self.single_resource_query_fields
  %w[RolloverBalance Price]
end

Instance Method Details

#priceObject

NOTE: #price was only available when (1) the pricing model for the

charge is either "Flat Fee" or "Per Unit" AND (2) the charge was
queried through ZOQL, i.e, using `IronBank::Charge#where` method.

Testing Zuora REST API (using the `IronBank::Charge#find` method)
shows that Zuora does not return a `price` attribute in their
response. This means we consider #price to be a remain from the
SOAP ZOQL query operation. We are deprecating this method without
replacement. Instead, users should be fetching the `#tiers` for
the current charge and get the price information from there.


41
42
43
# File 'lib/iron_bank/resources/rate_plan_charge.rb', line 41

def price
  nil
end

#rollover_balanceObject



27
28
29
# File 'lib/iron_bank/resources/rate_plan_charge.rb', line 27

def rollover_balance
  remote[:rollover_balance] || reload.remote[:rollover_balance]
end