class Myfinance::Resources::CreditCard

Public Instance Methods

create(entity_id, params = {}) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 17
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
destroy(entity_id, id) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 32
def destroy(entity_id, id)
  cc_path = path(entity_id) + "/#{id}"
  http.delete(cc_path, body: {}) do |response|
    response
  end
end
find(entity_id, id) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 10
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
find_all(entity_id) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 4
def find_all(entity_id)
  http.get(path(entity_id), body: {}) do |response|
    respond_with_collection(response)
  end
end
update(entity_id, id, params = {}) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 24
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

Private Instance Methods

path(entity_id) click to toggle source
# File lib/myfinance/resources/credit_card.rb, line 42
def path(entity_id)
  "/entities/#{entity_id}/credit_cards"
end