sunnytrail 0.0.1.4 → 0.0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/sunnytrail.rb +4 -0
  2. data/spec/sunnytrail_spec.rb +14 -15
  3. metadata +4 -4
data/lib/sunnytrail.rb CHANGED
@@ -3,6 +3,7 @@ require 'net/https'
3
3
  require 'json'
4
4
  require 'hashie'
5
5
  require 'logger'
6
+ require 'cgi'
6
7
 
7
8
  class Sunnytrail
8
9
 
@@ -74,6 +75,9 @@ class Sunnytrail
74
75
 
75
76
  api = setup_call
76
77
 
78
+ #CGI encode the message
79
+ message = CGI.escape(message)
80
+
77
81
  response = api.post("/messages?apikey=#{@options[:api_key]}",
78
82
  "message=#{message}")
79
83
 
@@ -4,21 +4,20 @@ require 'mock'
4
4
  describe Sunnytrail do
5
5
 
6
6
  before :all do
7
- TIME_NOW = Time.now.to_i
8
- OPTIONS_HASH = {"id" => 123,
9
- "email" => "user123@example.com",
10
- "name" => "User123",
11
- "action" => {
12
- "name" => "Signup",
13
- "created" => TIME_NOW
14
- },
15
- "plan" => {
16
- "name" => "Gold",
17
- "price" => 123.0,
18
- "recurring" => 31
19
- }
20
- }
21
-
7
+ TIME_NOW = Time.now.to_i
8
+ OPTIONS_HASH = {"id" => 123,
9
+ "email" => "user123@example.com",
10
+ "name" => "User123",
11
+ "action" => {
12
+ "name" => "Signup",
13
+ "created" => TIME_NOW
14
+ },
15
+ "plan" => {
16
+ "name" => "Gold",
17
+ "price" => 123.0,
18
+ "recurring" => 31
19
+ }
20
+ }
22
21
  end
23
22
 
24
23
  it "should raise exception if not configured" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunnytrail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 67
4
+ hash: 65
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
- - 4
11
- version: 0.0.1.4
10
+ - 5
11
+ version: 0.0.1.5
12
12
  platform: ruby
13
13
  authors:
14
14
  - Mateusz Zawisza
@@ -94,6 +94,6 @@ rubyforge_project:
94
94
  rubygems_version: 1.3.7
95
95
  signing_key:
96
96
  specification_version: 3
97
- summary: Wrapper for SunnyTrail API
97
+ summary: Wrapper for Sunnytrail API
98
98
  test_files: []
99
99