Sha256: e71792acde431bb69bde92aabb7dc05217b6a185b257cb630003229fd071e964

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

module Nova
  module API
    module Resource
      class CurrentAsset < Nova::API::Base
        ALLOWED_ATTRIBUTES = %i[]

        attribute? :id, Dry::Types['coercible.integer'].optional
        attribute? :company, Nova::API::Resource::Company.optional
        attribute? :active, Dry::Types['strict.bool'].optional
        attribute? :image, Dry::Types['coercible.string'].optional
        attribute? :balance, Dry::Types['coercible.float'].optional

        def self.endpoint
          '/api/current_assets'
        end

        def self.statement(parameters = {})
          do_get("#{endpoint}/statement", parameters.to_h, Nova::API::Resource::Response::CurrentAssetStatement.new)
        end

        def statement(initial_date, final_date)
          protect_operation_from_missing_value

          self.class.do_get("#{endpoint}/statement", { company_id: company.id, current_asset_id: id, final_date: final_date, initial_date: initial_date }, Nova::API::Resource::Response::CurrentAssetStatement.new)
        end

        def endpoint
          "/api/current_assets"
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
nova-api-1.4.6 lib/nova/api/resource/current_asset.rb
nova-api-1.4.5 lib/nova/api/resource/current_asset.rb
nova-api-1.4.3 lib/nova/api/resource/current_asset.rb
nova-api-1.4.1 lib/nova/api/resource/current_asset.rb
nova-api-1.4.0 lib/nova/api/resource/current_asset.rb
nova-api-1.3.0 lib/nova/api/resource/current_asset.rb
nova-api-1.2.0 lib/nova/api/resource/current_asset.rb
nova-api-1.1.0 lib/nova/api/resource/current_asset.rb
nova-api-1.0.0 lib/nova/api/resource/current_asset.rb
nova-api-0.8.0 lib/nova/api/resource/current_asset.rb
nova-api-0.7.0 lib/nova/api/resource/current_asset.rb