Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused generate_signature helper method #59

Merged
merged 1 commit into from Dec 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 0 additions & 13 deletions lib/mixpanel/utils.rb
Expand Up @@ -16,19 +16,6 @@ class Client
# Copyright (c) 2009+ Keolo Keagy
# See LICENSE for details
module Utils
# Return a string composed of hashed values specified by the mixpanel
# data API
#
# @return [String] md5 hash signature required by mixpanel data API
def self.generate_signature(args, api_secret)
Digest::MD5.hexdigest(
args.map { |key, val| "#{key}=#{val}" }
.sort
.join +
api_secret
)
end

# Return a JSON object or a string depending on a given format
#
# @param [String] data either CSV or JSON formatted
Expand Down
19 changes: 0 additions & 19 deletions spec/mixpanel_client/mixpanel_client_spec.rb
Expand Up @@ -262,25 +262,6 @@
end
end

describe '#hash_args' do
it 'should return a hashed string alpha sorted by key names.' do
args = { c: 'see', a: 'ey', d: 'dee', b: 'bee' }
args_alpha_sorted = { a: 'ey', b: 'bee', c: 'see', d: 'dee' }

unsorted_signature = Mixpanel::Client::Utils.generate_signature(
args,
@client.api_secret
)

sorted_signature = Mixpanel::Client::Utils.generate_signature(
args_alpha_sorted,
@client.api_secret
)

expect(unsorted_signature).to eq sorted_signature
end
end

describe '#to_hash' do
it 'should return a ruby hash given json as a string' do
expect(Mixpanel::Client::Utils.to_hash(
Expand Down