phone-dot-com 0.0.2
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 +7 -0
- data/lib/phone-dot-com.rb +31 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 871d33590516c6e964d12c2c9de2f210a62ffe4a
|
4
|
+
data.tar.gz: 2550238becb7a0dfe688a446b3b9dbb36da27626
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dff12ff6aaffce289d2d7c860aa107f637af699ce03f5ab105af6519318009518af25469b6368ddbde630be5e32300d9b004bdbe21f8b05c87bc515b7baff3c2
|
7
|
+
data.tar.gz: 34f1889d8ad4d4cacda85a358e34a25e23e4ccf7c4df2ad36f6ff3c63d9d7086fe45999fe2f9cd2d3f4df36c87b3c1594740e52467c2ec11e970db673aae40e6
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class PhoneDotCom
|
2
|
+
# include ActionView::Helpers::NumberHelper
|
3
|
+
require 'erb'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
require 'openssl'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
def self.send_new_sms(from,to,msg)
|
10
|
+
sms_header
|
11
|
+
@request.body = ({"from" => from, "to" => to, "message" => msg}).to_json
|
12
|
+
puts @request.body
|
13
|
+
response = @http.request(@request)
|
14
|
+
# puts response.body
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.sms_header
|
18
|
+
uri = URI.parse("https://v1.api.phone.com/sms")
|
19
|
+
# Full control
|
20
|
+
@http = Net::HTTP.new(uri.host, uri.port)
|
21
|
+
@http.use_ssl = true
|
22
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
23
|
+
@request = Net::HTTP::Post.new(uri.request_uri)
|
24
|
+
@request["Accept"] = "text/json"
|
25
|
+
@request["Content-Type"] = "text/json"
|
26
|
+
@request.basic_auth(ENV['PHONE_DOT_COM_KEY'],ENV['PHONE_DOT_COM_PASSWORD'])
|
27
|
+
# @request.body = ({"from" => "+13477742512", "to" => "+14242987773", "message" => "Test from Field Harmony"}).to_json
|
28
|
+
return @request
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: phone-dot-com
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tyler Merritt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The library so far focuses only on the SMS functionality of the Phone.com
|
14
|
+
API (in BETA as of this writing). Other methods will be added as I develop them.
|
15
|
+
email:
|
16
|
+
- tgmerritt@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/phone-dot-com.rb
|
22
|
+
homepage: http://yurinbo.wordpress.com
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.2
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: A Ruby implementation of the Phone.com API
|
46
|
+
test_files: []
|