Sha256: 0f487ae88cbab85f09473cf41a9a52621cd0a12f500f333fe254c7d38ffb1f90

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

module PrintReleaf
  class Transaction < Resource
    path "/transactions"

    action :find
    action :list
    action :create
    action :delete

    property :id
    property :account_id
    property :project_id
    property :certificate_id
    property :date, transform_with: Transforms::Date
    property :trees, transform_with: Transforms::Float
    property :items
    coerce_key :items, Array[TransactionItem]

    def account
      @account ||= Account.find(account_id)
    end

    def project
      @project ||= Forestry::Project.find(project_id)
    end

    def certificate
      @certificate ||= Certificate.find(certificate_id)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
printreleaf-1.0.3 lib/printreleaf/transaction.rb
printreleaf-1.0.2 lib/printreleaf/transaction.rb
printreleaf-1.0.1 lib/printreleaf/transaction.rb