lib/monday/resources/update.rb in monday_ruby-0.6.2 vs lib/monday/resources/update.rb in monday_ruby-1.0.0

- old
+ new

@@ -1,63 +1,65 @@ # frozen_string_literal: true +require_relative "base" + module Monday module Resources # Represents Monday.com's update resource. - module Update + class Update < Base DEFAULT_SELECT = %w[id body created_at].freeze # Retrieves all the updates. # # Allows filtering updates using the args option. # Allows customizing the values to retrieve using the select option. # By default, ID, body and created_at fields are retrieved. - def updates(args: {}, select: DEFAULT_SELECT) - query = "query { updates#{Util.format_args(args)} { #{Util.format_select(select)}}}" + def query(args: {}, select: DEFAULT_SELECT) + request_query = "query{updates#{Util.format_args(args)}{#{Util.format_select(select)}}}" - make_request(query) + make_request(request_query) end # Creates a new update. # # Allows customizing the update creation using the args option. # Allows customizing the values to retrieve using the select option. # By default, ID, body and created_at fields are retrieved. - def create_update(args: {}, select: DEFAULT_SELECT) - query = "mutation { create_update#{Util.format_args(args)} {#{Util.format_select(select)}}}" + def create(args: {}, select: DEFAULT_SELECT) + query = "mutation{create_update#{Util.format_args(args)}{#{Util.format_select(select)}}}" make_request(query) end # Like an update. # # Allows customizing the update creation using the args option. # Allows customizing the values to retrieve using the select option. # By default, ID is retrieved. - def like_update(args: {}, select: %w[id]) - query = "mutation { like_update#{Util.format_args(args)} {#{Util.format_select(select)}}}" + def like(args: {}, select: %w[id]) + query = "mutation{like_update#{Util.format_args(args)}{#{Util.format_select(select)}}}" make_request(query) end # Clear an item's update # # Allows customizing the update creation using the args option. # Allows customizing the values to retrieve using the select option. # By default, ID is retrieved. def clear_item_updates(args: {}, select: %w[id]) - query = "mutation { clear_item_updates#{Util.format_args(args)} {#{Util.format_select(select)}}}" + query = "mutation{clear_item_updates#{Util.format_args(args)}{#{Util.format_select(select)}}}" make_request(query) end # Delete an update # # Allows customizing the update creation using the args option. # Allows customizing the values to retrieve using the select option. # By default, ID is retrieved. - def delete_update(args: {}, select: %w[id]) - query = "mutation { delete_update#{Util.format_args(args)} {#{Util.format_select(select)}}}" + def delete(args: {}, select: %w[id]) + query = "mutation{delete_update#{Util.format_args(args)}{#{Util.format_select(select)}}}" make_request(query) end end end