Sha256: 0aec8e6a50f3641a9949eb3a69fc35262c583a511448c9b917e3279169ba085d

Contents?: true

Size: 1.16 KB

Versions: 20

Compression:

Stored size: 1.16 KB

Contents

module Myfinance
  module Resources
    class CreditCard < Base
      def find_all(entity_id)
        http.get(path(entity_id), body: {}) do |response|
          respond_with_collection(response)
        end
      end

      def find(entity_id, id)
        cc_path = path(entity_id) + "/#{id}"
        http.get(cc_path, body: {}) do |response|
          respond_with_object(response, "credit_card")
        end
      end

      def create(entity_id, params = {})
        body = { credit_card: params }
        http.post(path(entity_id), body: body) do |response|
          respond_with_object(response, "credit_card")
        end
      end

      def update(entity_id, id, params = {})
        cc_path = path(entity_id) + "/#{id}"
        body = { credit_card: params }
        http.put(cc_path, body: body) do |response|
          respond_with_object(response, "credit_card")
        end
      end

      def destroy(entity_id, id)
        cc_path = path(entity_id) + "/#{id}"
        http.delete(cc_path, body: {}) do |response|
          response
        end
      end


      private

      def path(entity_id)
        "/entities/#{entity_id}/credit_cards"
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
myfinance-1.8.3 lib/myfinance/resources/credit_card.rb
myfinance-1.8.2 lib/myfinance/resources/credit_card.rb
myfinance-1.8.1 lib/myfinance/resources/credit_card.rb
myfinance-1.8.0 lib/myfinance/resources/credit_card.rb
myfinance-1.7.0 lib/myfinance/resources/credit_card.rb
myfinance-1.6.6 lib/myfinance/resources/credit_card.rb
myfinance-1.6.5 lib/myfinance/resources/credit_card.rb
myfinance-1.6.4 lib/myfinance/resources/credit_card.rb
myfinance-1.6.3 lib/myfinance/resources/credit_card.rb
myfinance-1.6.1 lib/myfinance/resources/credit_card.rb
myfinance-1.6.0 lib/myfinance/resources/credit_card.rb
myfinance-1.5.0 lib/myfinance/resources/credit_card.rb
myfinance-1.4.1 lib/myfinance/resources/credit_card.rb
myfinance-1.4.0 lib/myfinance/resources/credit_card.rb
myfinance-1.3.1 lib/myfinance/resources/credit_card.rb
myfinance-1.3.0 lib/myfinance/resources/credit_card.rb
myfinance-1.2.1 lib/myfinance/resources/credit_card.rb
myfinance-1.2.0 lib/myfinance/resources/credit_card.rb
myfinance-1.1.0 lib/myfinance/resources/credit_card.rb
myfinance-1.0.0 lib/myfinance/resources/credit_card.rb