zipwhip 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zipwhip.rb +3 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70d620d756eb2ad73ccd5c9e16bf2145fb4acd8
|
4
|
+
data.tar.gz: 10b3417e02cd6ed4b85f730970baef6f1dfd8da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8dabaa9da47885a7de2517dd21524be215f95fab1bfcb00bd6133c31b63a7ff78cdf2d5202992a63617d88fb0ea851408a967fca1b2bb037b3dce88f20e1bfb
|
7
|
+
data.tar.gz: 4b2f28415eef9837ac81e99bea1d5751e6491f561136fbf1a853a2a3e7cc36f2773af049d7e18525dc58699291a8459fa0e98bbd527ca585a4776b5469fca723
|
data/lib/zipwhip.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
class ZipWhip
|
2
|
-
#
|
3
|
-
require 'erb'
|
2
|
+
require 'erb' # If you want to extend functionality to parse a template with ruby syntax
|
4
3
|
require 'net/http'
|
5
4
|
require 'uri'
|
6
5
|
require 'openssl'
|
7
6
|
require 'json'
|
8
7
|
|
9
|
-
def self.login
|
10
|
-
uri = "https://api.zipwhip.com/user/login?username="+
|
11
|
-
# params = { :username => ENV["ZIPWHIP_USERNAME"], :password => ENV["ZIPWHIP_PASSWORD"] }
|
12
|
-
# uri.query = URI.encode_www_form(params)
|
8
|
+
def self.login(u,p)
|
9
|
+
uri = "https://api.zipwhip.com/user/login?username="+u+"&password="+p
|
13
10
|
sms_header(uri)
|
14
11
|
response = @http.request(@request)
|
15
|
-
# puts "response key is " + response.body
|
16
12
|
res = JSON.parse(response.body)
|
17
13
|
return res
|
18
14
|
end
|
@@ -20,23 +16,17 @@ class ZipWhip
|
|
20
16
|
def self.send_new_sms(to,msg,token)
|
21
17
|
uri = "https://api.zipwhip.com/message/send?session="+token+"&body="+msg+"&contacts=ptn:/"+to
|
22
18
|
sms_header(uri)
|
23
|
-
# @request.body = ({"from" => from, "to" => to, "message" => msg})
|
24
19
|
# puts @request.body
|
25
20
|
response = @http.request(@request)
|
26
21
|
# puts response.body
|
27
22
|
end
|
28
23
|
|
29
24
|
def self.sms_header(uri)
|
30
|
-
# uri = URI.parse("https://api.zipwhip.com/message/send")
|
31
25
|
uri = URI.parse(uri)
|
32
|
-
# Full control
|
33
26
|
@http = Net::HTTP.new(uri.host, uri.port)
|
34
27
|
@http.use_ssl = true
|
35
28
|
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
36
29
|
@request = Net::HTTP::Post.new(uri.request_uri)
|
37
|
-
# @request["Accept"] = "text/json"
|
38
|
-
# @request["Content-Type"] = "text/json"
|
39
|
-
# @request.basic_auth(ENV['ZIPWHIP_USERNAME'],ENV['ZIPWHIP_PASSWORD'])
|
40
30
|
return @request
|
41
31
|
end
|
42
32
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipwhip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Merritt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The library so far focuses only on the SMS functionality of the ZipWhip
|
14
14
|
API. Other methods will be added as I develop them.
|