92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/pushpad/subscription.rb', line 92
def update(attributes, options = {})
project_id = project_id || options[:project_id] || Pushpad.project_id
raise "You must set project_id" unless project_id
raise "You must set id" unless id
endpoint = "https://pushpad.xyz/api/v1/projects/#{project_id}/subscriptions/#{id}"
response = Request.patch(endpoint, attributes.to_json)
unless response.code == "200"
raise UpdateError, "Response #{response.code} #{response.message}: #{response.body}"
end
attributes = JSON.parse(response.body, symbolize_names: true)
@uid = attributes[:uid]
@tags = attributes[:tags]
self
end
|