unisender_api 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,8 +27,10 @@ class ApiCall
27
27
  case param
28
28
  when Time
29
29
  hash.merge!("#{label}" => param.strftime("%F %H:%M"))
30
- when Boolean
31
- hash.merge!("#{label}" => param.to_s)
30
+ when TrueClass
31
+ hash.merge!("#{label}" => '1')
32
+ when FalseClass
33
+ hash.merge!("#{label}" => '0')
32
34
  when String
33
35
  hash.merge!("#{label}" => param.to_s)
34
36
  when Fixnum
@@ -1,3 +1,3 @@
1
1
  module UnisenderApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unisender_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-24 00:00:00.000000000 Z
12
+ date: 2013-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -137,9 +137,7 @@ files:
137
137
  - LICENSE.txt
138
138
  - README.md
139
139
  - Rakefile
140
- - lib/.unisender_api.rb.swp
141
140
  - lib/unisender_api.rb
142
- - lib/unisender_api.rb~
143
141
  - lib/unisender_api/api_call.rb
144
142
  - lib/unisender_api/extends.rb
145
143
  - lib/unisender_api/lists.rb
Binary file
@@ -1,34 +0,0 @@
1
- require "unisender_api/version"
2
-
3
- module Unisender
4
-
5
-
6
- class Api
7
- attr_accessor :api_key, :test, :url
8
-
9
- def initialize(api_key, locale = 'en', test = false)
10
- self.api_key = api_key
11
- self.test = test
12
- self.url = "http://api.unisender.com/#{locale}/api/"
13
- end
14
-
15
-
16
- def api_call(method, params)
17
- url = self.url + method
18
- params.merge!(:test_mode => '1') if self.test
19
- params.merge!(:api_key => self.api_key)
20
- result = JSON.parse(self.post(url, params))
21
- return result
22
- end
23
-
24
- def post(url, param)
25
- uri = URI.parse(url)
26
- https = Net::HTTP.new(uri.host, uri.port)
27
- https.use_ssl = true
28
- params = Addressable::URI.new
29
- params.query_values = param
30
- https.post(uri.path, params.query).body
31
- end
32
-
33
- end
34
- end