Sha256: 84ffd22a8fc012194b58ca4160fdbc07bb181bd4f1701e0801eb7bc85cc5df90

Contents?: true

Size: 772 Bytes

Versions: 4

Compression:

Stored size: 772 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 :quote_id
    property :date, transform_with: Transforms::Date
    property :pages, transform_with: Transforms::Integer
    property :trees, transform_with: Transforms::Float

    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

    def quote
      return nil if quote_id.nil?
      @quote ||= Quote.find(quote_id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
printreleaf-1.5.0 lib/printreleaf/transaction.rb
printreleaf-1.3.2 lib/printreleaf/transaction.rb
printreleaf-1.3.1 lib/printreleaf/transaction.rb
printreleaf-1.3.0 lib/printreleaf/transaction.rb