lox24 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4836c806808f61a797407d51cae0a9faa9c1adb
4
+ data.tar.gz: 56c23796e2a80acce60828b76abf4975a418e223
5
+ SHA512:
6
+ metadata.gz: d6791921a655a19be0c10e75d323dfcbf32d026c6b3ac5ecebf03db000bc942673e3b75e49057e5a600249c71381568ea90a4bde6ffeaa757b3b6efdc8c93235
7
+ data.tar.gz: 3776bd927b906f8f70c05a1ad47c91cc1944ffcd5b337caa94a1de81756426a9f5786bc9ca98290f509895474ebc3a77192e97f39248a2bf90ac449661c4fe93
@@ -0,0 +1,12 @@
1
+ module Lox24
2
+ # Standard Library
3
+ require 'digest'
4
+ require 'net/https'
5
+ require 'xmlsimple'
6
+
7
+ # Lox24
8
+ require 'lox24/lox24'
9
+ require 'lox24/config'
10
+ require 'lox24/sms'
11
+ require 'lox24/version'
12
+ end
@@ -0,0 +1,14 @@
1
+ module Lox24
2
+ class Config
3
+
4
+ @debug = false
5
+
6
+ class << self
7
+ attr_accessor :service, :client, :password, :debug
8
+ end
9
+
10
+ def self.password_hash
11
+ Digest::MD5.hexdigest @password
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Lox24
2
+ def self.configure
3
+ yield(Config)
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ module Lox24
2
+ class Sms
3
+
4
+ def self.create(msg={})
5
+ uri = URI('https://www.lox24.eu/api/httpsms.php')
6
+ res = Net::HTTP.post_form(uri,
7
+ action: Lox24::Config.debug ? 'info': 'send',
8
+ konto: Lox24::Config.client,
9
+ password: Lox24::Config.password_hash,
10
+ service: Lox24::Config.service,
11
+ return: 'xml',
12
+ text: msg[:text],
13
+ to: msg[:to],
14
+ from: msg[:from]
15
+ )
16
+
17
+ xml = XmlSimple.xml_in(res.body)
18
+ code = xml['code'].first.to_i
19
+ if code < 200
20
+ xml['info'].first['MSGID'].first
21
+ else
22
+ false
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module Lox24
2
+ GEM_VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lox24
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christoph Czeplak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xml-simple
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ description: Library to send text messages with the lox24.eu SMS gateway
28
+ email: czeplak@worklagoon.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/lox24.rb
34
+ - lib/lox24/config.rb
35
+ - lib/lox24/lox24.rb
36
+ - lib/lox24/sms.rb
37
+ - lib/lox24/version.rb
38
+ homepage: http://rubygems.org/gems/lox24
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.6.14
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Lox24 SMS Gateway
62
+ test_files: []