horntell 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d22ee87ef44bb90ca9f0c6165e4a2d009f66954a
4
- data.tar.gz: f221452c1e9964f360eb18f3dc4671df0785a098
3
+ metadata.gz: c8b857c286d6ec2a8b1c3afc89cbf9daa1b563a7
4
+ data.tar.gz: eb0f7f62962d93858c40ebe9b32c51894675fd86
5
5
  SHA512:
6
- metadata.gz: e1b2262f41802f585be823e228b880317430e183c7373ab169dc5f2fcb541096945851cce259961a13ba9afb3a430ff4348fe7d95d763e3c5afaf33e24453ab2
7
- data.tar.gz: 21c3dcfa682243807a363a62a440e0a25603b73a89e249d4fa473a6ec83505989d10f66d0880cb8f71e06c2c36c41cdd3b0af47f418cf4e98ef66ccc6e772bbe
6
+ metadata.gz: d652b75c69eaa846fd64c702cf0f36b858bd8fb42401deb0d823bc38d7a4f550d83bcf639253dd420b4de44bde9cc28d96a0d06d75ce6e982f0c999d3b367fd2
7
+ data.tar.gz: 3e48fb867e80847138151f9c0fb5ec6cd43f8e895c8f5a2dc8555c5b6c369a4f7c9dee0968aeb043c6ff50fb463bfc691992ce44411328f75de8c9f4d4fe5e88
data/README.md CHANGED
@@ -6,6 +6,8 @@ This SDK allows you to easily integrate Horntell in your Ruby applications.
6
6
  ## Requirements
7
7
  **Ruby 1.9.2 and later.**
8
8
 
9
+ **`openssl` compiled with your Ruby installation**
10
+
9
11
  **Gems: rest-client, json**
10
12
 
11
13
  ## Installation
data/lib/horntell.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
2
  require 'rest_client'
3
+ require 'openssl'
3
4
 
4
5
  require_relative "horntell/version.rb"
5
6
  require_relative 'horntell/errors/error.rb'
data/lib/horntell/app.rb CHANGED
@@ -14,13 +14,13 @@ module Horntell
14
14
 
15
15
  # initializes the key and secret of the app
16
16
  def self.init(key = nil, secret = nil)
17
- @key = key
18
- @secret = secret
17
+ @key = "#{key}"
18
+ @secret = "#{secret}"
19
19
  end
20
20
 
21
21
  # sets the base url of the app
22
22
  def self.set_base(base = nil)
23
- @base = base
23
+ @base = "#{base}"
24
24
  end
25
25
 
26
26
  # returns the base url of the app
@@ -40,7 +40,7 @@ module Horntell
40
40
 
41
41
  # sets the version of the app
42
42
  def self.set_version(version = nil)
43
- @version = version
43
+ @version = "#{version}"
44
44
  end
45
45
 
46
46
  # gets the version of the app
@@ -48,5 +48,12 @@ module Horntell
48
48
  return @version
49
49
  end
50
50
 
51
+ #return hash hmac 256
52
+ def self.hash(uid)
53
+ sha256 = OpenSSL::Digest::SHA256.new
54
+ hash = OpenSSL::HMAC.hexdigest(sha256, @secret, "#{uid}")
55
+
56
+ return hash
57
+ end
51
58
  end
52
59
  end
@@ -3,15 +3,17 @@ module Horntell
3
3
  extend Horntell::Http::Request
4
4
 
5
5
  # triggers campaign for single profile
6
- def self.to_profile(uid, campaignId)
7
- return raw_request('post', "/profiles/#{uid}/campaigns/#{campaignId}")
6
+ def self.to_profile(uid, campaignId, meta = nil)
7
+ data = { :meta => meta }
8
+
9
+ return raw_request('post', "/profiles/#{uid}/campaigns/#{campaignId}", data)
8
10
  end
9
11
 
10
12
  #triggers campaign for multiple profile
11
- def self.to_profiles(profiles, campaignId)
12
- profiles = { :profile_uids => profiles }
13
+ def self.to_profiles(profiles, campaignId, meta = nil)
14
+ data = { :profile_uids => profiles, :meta => meta }
13
15
 
14
- return raw_request('post', "/profiles/campaigns/#{campaignId}", profiles)
16
+ return raw_request('post', "/profiles/campaigns/#{campaignId}", data)
15
17
  end
16
18
  end
17
19
  end
@@ -1,3 +1,3 @@
1
1
  module Horntell
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horntell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohit Mamoria
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client