cloudhub_wrapper 0.0.0

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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +4 -0
  4. data/lib/cloudhub_wrapper.rb +40 -0
  5. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 94ae2ab3b60ec938656f8131d542e76b884a90f8
4
+ data.tar.gz: 2b1928a0a9a54efdecef13f7bfa9b4a483c354ed
5
+ SHA512:
6
+ metadata.gz: eec9e6d354c46612226205b141f3991ecd625478feca2c58bc952df463a6558b91d3a1d2f090c99c9c4655ae32742a31b0627962814ca5fce17a7ce12b0f2b12
7
+ data.tar.gz: 24f5cf6339b79ecd53bef2fca536ddfbf396738e91adf105140bca745f0995b082d3e9cd2f7c49e1cafab5d0b05e19cbc8697983435ff58aa0bdacd9bb25b6ff
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ # cloudhub_wrapper
2
+ ---------
3
+
4
+
@@ -0,0 +1,40 @@
1
+ class CloudhubWrapper
2
+
3
+ require "net/https"
4
+ require "uri"
5
+
6
+ def initialize(endpoint, user, password)
7
+ @endpoint = endpoint
8
+ @user = user
9
+ @password = password
10
+ end
11
+
12
+ def xml
13
+ @xml
14
+ end
15
+
16
+ def xml=(xml)
17
+ @xml = xml
18
+ end
19
+
20
+ def build_xml(subscriber, channel, origin, schema)
21
+ # build xml somehow
22
+ # @xml = ApplicationController.new.render_to_string(:partial => "opt_in", :locals => {:subscriber => subscriber, :channel => channel, :origin => origin})
23
+ end
24
+
25
+ def post_xml
26
+ if @xml
27
+ uri = URI.parse(@endpoint)
28
+ request = Net::HTTP::Post.new(uri.path)
29
+ request.body = @xml
30
+ request.basic_auth(@user, @password)
31
+ http = Net::HTTP.new(uri.host, uri.port)
32
+ http.use_ssl = true
33
+ response = http.request(request)
34
+ else
35
+ #throw an error of some description
36
+ end
37
+
38
+ end
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloudhub_wrapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Erik Froese
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This wrapper is built to communicate with a custom Cloudhub API.
14
+ email: froesecom@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - MIT-LICENSE
20
+ - README.md
21
+ - lib/cloudhub_wrapper.rb
22
+ homepage: http://rubygems.org/gems/cloudhub_wrapper
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 wrapper built to communicate with a CloudHub API
46
+ test_files: []