Sha256: c532009a324d518379731ee205cc16abc1929a954b5679e9bee7e06969ff1f85

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module BillForward
  # This entity exposes the following child entities via method_missing:
  # 
  # Role[]           .roles
  # PaymentMethod[]  .paymentMethods
  # Profile          .profile
  class Account < MutableEntity
  	@resource_path = BillForward::ResourcePath.new("accounts", "account")

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

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

        request_entity = BillForward::GenericEntity.new(
            request_object
        )

        self.request_first_heterotyped(BillForward::CreditNote, 'post', endpoint, request_entity, nil, custom_client)
      end
    end

  protected
    def unserialize_all(hash)
      super
      unserialize_entity('profile', Profile, hash)

      unserialize_array_of_entities('roles', Role, hash)
      unserialize_array_of_entities('paymentMethods', PaymentMethod, hash)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bill_forward-2.2016.241 lib/bill_forward/entities/account.rb
bill_forward-2.2016.227 lib/bill_forward/entities/account.rb
bill_forward-2.2016.222 lib/bill_forward/entities/account.rb
bill_forward-2.2016.209 lib/bill_forward/entities/account.rb
bill_forward-1.2016.117 lib/bill_forward/entities/account.rb
bill_forward-1.2016.101 lib/bill_forward/entities/account.rb