Sha256: 67818c4ee6399853976fa23a149e5823f9b9677da7a4fb5d7e2bbed9989fe50a

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

module BillForward
  # This entity exposes the following child entities via method_missing:
  # 
  # Invoice         .invoice
  class SubscriptionCharge < MutableEntity
  	@resource_path = BillForward::ResourcePath.new('charges', 'subscriptionCharge')

    class << self
      def recalculate(id, request_object = {}, custom_client = nil)
        raise ArgumentError.new("id cannot be nil") if id.nil?

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

        request_entity = BillForward::GenericEntity.new(
            request_object
        )

        self.request_first('post', endpoint, request_entity, nil, custom_client)
      end

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

        endpoint = sprintf('recalculate',
                           ERB::Util.url_encode(id)
        )

        request_entity = BillForward::GenericEntity.new(
            request_object
        )

        self.request_first('post', endpoint, request_entity, nil, custom_client)
      end
    end

  protected
    def unserialize_all(hash)
      super
      unserialize_entity('invoice', Invoice, hash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bill_forward-1.2016.101 lib/bill_forward/entities/subscription_charge.rb