Sha256: f79ebc42d73a43f9eded65ac0ab6b982341c30218a5632d621e5dc5161365259

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

module Myfinance
  module Resources
    class SaleRule < Base
      def find_all(sale_account_id)
        http.get("/sale_accounts/#{sale_account_id}/rules", body: {}) do |response|
          respond_with_collection(response)
        end
      end

      def find(sale_account_id, rule_id)
        path = "/sale_accounts/#{sale_account_id}/rules/#{rule_id}"
        http.get(path, body: {}) do |response|
          respond_with_object(response, "sale_rule")
        end
      end

      def create(sale_account_id, params = {})
        path = "/sale_accounts/#{sale_account_id}/rules/"
        http.post(path, body: { sale_rule: params }) do |response|
          respond_with_object(response, "sale_rule")
        end
      end

      def update(sale_account_id, rule_id, params = {})
        path = "/sale_accounts/#{sale_account_id}/rules/#{rule_id}"
        http.put(path, body: { sale_rule: params }) do |response|
          respond_with_object(response, "sale_rule")
        end
      end

      def destroy(sale_account_id, rule_id, params = {})
        path = "/sale_accounts/#{sale_account_id}/rules/#{rule_id}"
        http.delete(path, body: { sale_rule: params }) do |response|
          response
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
myfinance-1.8.2 lib/myfinance/resources/sale_rule.rb
myfinance-1.8.1 lib/myfinance/resources/sale_rule.rb
myfinance-1.8.0 lib/myfinance/resources/sale_rule.rb
myfinance-1.7.0 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.6 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.5 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.4 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.3 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.1 lib/myfinance/resources/sale_rule.rb
myfinance-1.6.0 lib/myfinance/resources/sale_rule.rb
myfinance-1.5.0 lib/myfinance/resources/sale_rule.rb
myfinance-1.4.1 lib/myfinance/resources/sale_rule.rb
myfinance-1.4.0 lib/myfinance/resources/sale_rule.rb
myfinance-1.3.1 lib/myfinance/resources/sale_rule.rb
myfinance-1.3.0 lib/myfinance/resources/sale_rule.rb