Skip to content

Commit c31246c

Browse files
committed
Better naming
1 parent c948ace commit c31246c

15 files changed

Lines changed: 48 additions & 48 deletions

lib/drip/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ def content_type
7171
Drip::Request::VERB_CLASS_MAPPING.keys.each do |verb|
7272
define_method(verb) do |path, options = {}|
7373
warn "[DEPRECATED] Drip::Client##{verb} please use the API endpoint specific methods"
74-
make_v2_request(verb, "v2/#{path}", options)
74+
make_json_api_request(verb, "v2/#{path}", options)
7575
end
7676
end
7777

7878
private
7979

80-
def make_v2_request(http_verb, path, options = {})
80+
def make_json_api_request(http_verb, path, options = {})
8181
make_request Drip::Request.new(http_verb, make_uri(path), options, JSON_API_CONTENT_TYPE)
8282
end
8383

lib/drip/client/accounts.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Accounts
66
# Returns a Drip::Response.
77
# See https://www.getdrip.com/docs/rest-api#accounts
88
def accounts
9-
make_v2_request :get, "v2/accounts"
9+
make_json_api_request :get, "v2/accounts"
1010
end
1111

1212
# Public: Fetch an account.
@@ -16,7 +16,7 @@ def accounts
1616
# Returns a Drip::Response.
1717
# See https://www.getdrip.com/docs/rest-api#accounts
1818
def account(id)
19-
make_v2_request :get, "v2/accounts/#{id}"
19+
make_json_api_request :get, "v2/accounts/#{id}"
2020
end
2121
end
2222
end

lib/drip/client/broadcasts.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Broadcasts
1212
# Returns a Drip::Response
1313
# See https://www.getdrip.com/docs/rest-api#broadcasts
1414
def broadcasts(options = {})
15-
make_v2_request :get, "v2/#{account_id}/broadcasts", options
15+
make_json_api_request :get, "v2/#{account_id}/broadcasts", options
1616
end
1717

1818
# Public: Fetch a broadcast.
@@ -22,7 +22,7 @@ def broadcasts(options = {})
2222
# Returns a Drip::Response.
2323
# See https://www.getdrip.com/docs/rest-api#broadcasts
2424
def broadcast(id)
25-
make_v2_request :get, "v2/#{account_id}/broadcasts/#{id}"
25+
make_json_api_request :get, "v2/#{account_id}/broadcasts/#{id}"
2626
end
2727
end
2828
end

lib/drip/client/campaign_subscriptions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module CampaignSubscriptions
88
# Returns a Drip::Response.
99
# See https://www.getdrip.com/docs.rest-api#campaign_subscriptions
1010
def campaign_subscriptions(subscriber_id)
11-
make_v2_request :get, "v2/#{account_id}/subscribers/#{subscriber_id}/campaign_subscriptions"
11+
make_json_api_request :get, "v2/#{account_id}/subscribers/#{subscriber_id}/campaign_subscriptions"
1212
end
1313
end
1414
end

lib/drip/client/campaigns.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Campaigns
1414
# Returns a Drip::Response.
1515
# See https://www.getdrip.com/docs.rest-api#campaigns
1616
def campaigns(options = {})
17-
make_v2_request :get, "v2/#{account_id}/campaigns", options
17+
make_json_api_request :get, "v2/#{account_id}/campaigns", options
1818
end
1919

2020
# Public: Fetch a campaign.
@@ -24,7 +24,7 @@ def campaigns(options = {})
2424
# Returns a Drip::Response.
2525
# See https://www.getdrip.com/docs/rest-api#campaigns
2626
def campaign(id)
27-
make_v2_request :get, "v2/#{account_id}/campaigns/#{id}"
27+
make_json_api_request :get, "v2/#{account_id}/campaigns/#{id}"
2828
end
2929

3030
# Public: Activate a campaign.
@@ -34,7 +34,7 @@ def campaign(id)
3434
# Returns a Drip::Response.
3535
# See https://www.getdrip.com/docs/rest-api#campaigns
3636
def activate_campaign(id)
37-
make_v2_request :post, "v2/#{account_id}/campaigns/#{id}/activate"
37+
make_json_api_request :post, "v2/#{account_id}/campaigns/#{id}/activate"
3838
end
3939

4040
# Public: Pause a campaign.
@@ -44,7 +44,7 @@ def activate_campaign(id)
4444
# Returns a Drip::Response.
4545
# See https://www.getdrip.com/docs/rest-api#campaigns
4646
def pause_campaign(id)
47-
make_v2_request :post, "v2/#{account_id}/campaigns/#{id}/pause"
47+
make_json_api_request :post, "v2/#{account_id}/campaigns/#{id}/pause"
4848
end
4949

5050
# Public: List everyone subscribed to a campaign.
@@ -68,7 +68,7 @@ def pause_campaign(id)
6868
# Returns a Drip::Response.
6969
# See https://www.getdrip.com/docs/rest-api#campaigns
7070
def campaign_subscribers(id, options = {})
71-
make_v2_request :get, "v2/#{account_id}/campaigns/#{id}/subscribers", options
71+
make_json_api_request :get, "v2/#{account_id}/campaigns/#{id}/subscribers", options
7272
end
7373
end
7474
end

lib/drip/client/conversions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Conversions
1010
# Returns a Drip::Response.
1111
# See https://www.getdrip.com/docs/rest-api#conversions
1212
def conversions(options = {})
13-
make_v2_request :get, "v2/#{account_id}/goals", options
13+
make_json_api_request :get, "v2/#{account_id}/goals", options
1414
end
1515

1616
# Public: Fetch a conversion.
@@ -20,7 +20,7 @@ def conversions(options = {})
2020
# Returns a Drip::Response.
2121
# See https://www.getdrip.com/docs/rest-api#conversions
2222
def conversion(id)
23-
make_v2_request :get, "v2/#{account_id}/goals/#{id}"
23+
make_json_api_request :get, "v2/#{account_id}/goals/#{id}"
2424
end
2525
end
2626
end

lib/drip/client/custom_fields.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module CustomFields
66
# Returns a Drip::Response.
77
# See https://www.getdrip.com/docs/rest-api#custom_fields
88
def custom_fields
9-
make_v2_request :get, "v2/#{account_id}/custom_field_identifiers"
9+
make_json_api_request :get, "v2/#{account_id}/custom_field_identifiers"
1010
end
1111
end
1212
end

lib/drip/client/events.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Events
1414
# See https://www.getdrip.com/docs/rest-api#record_event
1515
def track_event(email, action, properties = {}, options = {})
1616
data = options.merge({ "email" => email, "action" => action, "properties" => properties })
17-
make_v2_request :post, "v2/#{account_id}/events", private_generate_resource("events", data)
17+
make_json_api_request :post, "v2/#{account_id}/events", private_generate_resource("events", data)
1818
end
1919

2020
# Public: Track a collection of events all at once.
@@ -28,7 +28,7 @@ def track_event(email, action, properties = {}, options = {})
2828
# See https://www.getdrip.com/docs/rest-api#event_batches
2929
def track_events(events)
3030
url = "v2/#{account_id}/events/batches"
31-
make_v2_request :post, url, private_generate_resource("batches", { "events" => events })
31+
make_json_api_request :post, url, private_generate_resource("batches", { "events" => events })
3232
end
3333

3434
# Public: Fetch all custom event actions.
@@ -41,7 +41,7 @@ def track_events(events)
4141
# Returns a Drip::Response.
4242
# See https://www.getdrip.com/docs/rest-api#events
4343
def event_actions(options = {})
44-
make_v2_request :get, "v2/#{account_id}/event_actions", options
44+
make_json_api_request :get, "v2/#{account_id}/event_actions", options
4545
end
4646
end
4747
end

lib/drip/client/forms.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Forms
66
# Returns a Drip::Response.
77
# See https://www.getdrip.com/docs/rest-api#forms
88
def forms
9-
make_v2_request :get, "v2/#{account_id}/forms"
9+
make_json_api_request :get, "v2/#{account_id}/forms"
1010
end
1111

1212
# Public: Fetch a form.
@@ -16,7 +16,7 @@ def forms
1616
# Returns a Drip::Response.
1717
# See https://www.getdrip.com/docs/rest-api#forms
1818
def form(id)
19-
make_v2_request :get, "v2/#{account_id}/forms/#{id}"
19+
make_json_api_request :get, "v2/#{account_id}/forms/#{id}"
2020
end
2121
end
2222
end

lib/drip/client/orders.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Orders
1111
# See https://developer.drip.com/#orders
1212
def create_or_update_order(email, options = {})
1313
data = options.merge(email: email)
14-
make_v2_request :post, "v2/#{account_id}/orders", private_generate_resource("orders", data)
14+
make_json_api_request :post, "v2/#{account_id}/orders", private_generate_resource("orders", data)
1515
end
1616

1717
# Public: Create or update a batch of orders.
@@ -21,7 +21,7 @@ def create_or_update_order(email, options = {})
2121
# Returns a Drip::Response.
2222
# See https://developer.drip.com/#create-or-update-a-batch-of-orders
2323
def create_or_update_orders(orders)
24-
make_v2_request :post, "v2/#{account_id}/orders/batches", private_generate_resource("batches", { "orders" => orders })
24+
make_json_api_request :post, "v2/#{account_id}/orders/batches", private_generate_resource("batches", { "orders" => orders })
2525
end
2626

2727
# Public: Create or update a refund.
@@ -38,7 +38,7 @@ def create_or_update_orders(orders)
3838
# Returns a Drip::Response.
3939
# See https://developer.drip.com/#create-or-update-a-refund
4040
def create_or_update_refund(options)
41-
make_v2_request :post, "v2/#{account_id}/refunds", private_generate_resource("refunds", options)
41+
make_json_api_request :post, "v2/#{account_id}/refunds", private_generate_resource("refunds", options)
4242
end
4343
end
4444
end

0 commit comments

Comments
 (0)