lib/mailerlite/fields/fields.rb in mailerlite-ruby-1.0.4 vs lib/mailerlite/fields/fields.rb in mailerlite-ruby-1.0.5
- old
+ new
@@ -23,11 +23,11 @@
params['filter[keyword]'] = filter[:keyword] if filter.key?(:keyword)
params['filter[type]'] = filter[:type] if filter.key?(:type)
params['sort'] = sort if sort
params['limit'] = limit if limit
params['page'] = page if page
- uri = URI("#{API_URL}/fields")
+ uri = URI("#{MAILERLITE_API_URL}/fields")
uri.query = URI.encode_www_form(params.compact)
client.http.get(uri)
end
# Update the specified Field
@@ -35,27 +35,27 @@
# @param name [String] the name of the field to create
# @param type [String] the type, can be text, number or date
# @return [HTTP::Response] the response from the API
def create(type:, name:)
params = { 'name' => name, 'type' => type }
- client.http.post("#{API_URL}/fields", json: params.compact)
+ client.http.post("#{MAILERLITE_API_URL}/fields", json: params.compact)
end
# Update the specified Field
#
# @param field_id [Integer] the field_id to update
# @param name [String] the name to update
# @return [HTTP::Response] the response from the API
def update(field_id:, name:)
params = { 'name' => name }
- client.http.put("#{API_URL}/fields/#{field_id}", json: params.compact)
+ client.http.put("#{MAILERLITE_API_URL}/fields/#{field_id}", json: params.compact)
end
# Deletes the specified Field.
#
# @param field_id [String] the ID of the Field to delete
# @return [HTTP::Response] the response from the API
def delete(field_id)
- client.http.delete("#{API_URL}/fields/#{field_id}")
+ client.http.delete("#{MAILERLITE_API_URL}/fields/#{field_id}")
end
end
end