voxmail 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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rvmrc +62 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +63 -0
- data/Rakefile +3 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/voxmail.rb +16 -0
- data/lib/voxmail/request.rb +23 -0
- data/lib/voxmail/version.rb +3 -0
- data/tasks/rspec.rake +3 -0
- data/voxmail.gemspec +25 -0
- metadata +99 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f4ac7209e08cccd8244b621290edfd9b8ef0d7be
|
|
4
|
+
data.tar.gz: 2f54e97cf4edf45306b6335a58f98eb9835e8411
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bbebf0dbe49e4234ad0451daad2ef04986432fcb99f26355450355efc98f3c9a19aea846f435ce0e95e420a72545c06976bd0fdb50740edf2ac1b7ecb754884f
|
|
7
|
+
data.tar.gz: 772746a01275d3979e4e7e55394add526327c3047d005179646fa699e1a3bb2150127724fef8bd233e2e1e6147465402d26e10aff0431abbb85970acc8fea099
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
|
4
|
+
# development environment upon cd'ing into the directory
|
|
5
|
+
|
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
|
8
|
+
# echo "rvm use 2.1.0@voxmail" > .rvmrc
|
|
9
|
+
environment_id="ruby-2.1.0@voxmail"
|
|
10
|
+
|
|
11
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
|
12
|
+
# rvmrc_rvm_version="1.25.15 (stable)" # 1.10.1 seems like a safe start
|
|
13
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | __rvm_awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
|
14
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
|
15
|
+
# return 1
|
|
16
|
+
# }
|
|
17
|
+
|
|
18
|
+
# First we attempt to load the desired environment directly from the environment
|
|
19
|
+
# file. This is very fast and efficient compared to running through the entire
|
|
20
|
+
# CLI and selector. If you want feedback on which environment was used then
|
|
21
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
|
22
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
|
23
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
|
24
|
+
then
|
|
25
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
|
26
|
+
for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
|
|
27
|
+
do
|
|
28
|
+
if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
|
|
29
|
+
then \. "${__hook}" || true
|
|
30
|
+
fi
|
|
31
|
+
done
|
|
32
|
+
unset __hook
|
|
33
|
+
if (( ${rvm_use_flag:=1} >= 2 )) # display only when forced
|
|
34
|
+
then
|
|
35
|
+
if [[ $- == *i* ]] # check for interactive shells
|
|
36
|
+
then printf "%b" "Using: $(tput setaf 2 2>/dev/null)$GEM_HOME$(tput sgr0 2>/dev/null)
|
|
37
|
+
" # show the user the ruby and gemset they are using in green
|
|
38
|
+
else printf "%b" "Using: $GEM_HOME
|
|
39
|
+
" # don't use colors in non-interactive shells
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
else
|
|
43
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
|
44
|
+
rvm --create "$environment_id" || {
|
|
45
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
|
46
|
+
return 1
|
|
47
|
+
}
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# If you use bundler, this might be useful to you:
|
|
51
|
+
# if [[ -s Gemfile ]] && {
|
|
52
|
+
# ! builtin command -v bundle >/dev/null ||
|
|
53
|
+
# builtin command -v bundle | GREP_OPTIONS="" \grep $rvm_path/bin/bundle >/dev/null
|
|
54
|
+
# }
|
|
55
|
+
# then
|
|
56
|
+
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
|
57
|
+
# gem install bundler
|
|
58
|
+
# fi
|
|
59
|
+
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
|
60
|
+
# then
|
|
61
|
+
# bundle install | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
|
|
62
|
+
# fi
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 marco ghezzi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Voxmail
|
|
2
|
+
|
|
3
|
+
API wrapper for VoxMail
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'voxmail'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install voxmail
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
the gem uses environment variables stored in .env file to connect to Voxmail APIs.
|
|
24
|
+
You can put them in a .env file at the root of your project.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
VOXMAILHOST = 'your voxmail hostname'
|
|
28
|
+
VOXMAILSECRETKEY = 'your secret key'
|
|
29
|
+
VOXMAILPUBLICKEY = 'your publickey'
|
|
30
|
+
```
|
|
31
|
+
you can obtain API keys through Voxmail account dashboard.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
voxmail.info
|
|
37
|
+
```
|
|
38
|
+
will return informations about your voxmail account
|
|
39
|
+
|
|
40
|
+
you can use all the methods provided by voxmail in this way:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
@myvoxmail = Voxmail.lookup(method, *args)
|
|
44
|
+
```
|
|
45
|
+
Check [Voxmail website](http://www.voxmail.it) to see available methods
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Todo
|
|
49
|
+
1. integrate errors from APIs
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
54
|
+
|
|
55
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
1. Fork it ( https://github.com/[my-github-username]/voxmail/fork )
|
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
63
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "voxmail"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/voxmail.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'voxmail/version'
|
|
2
|
+
require 'xmlrpc/client'
|
|
3
|
+
require 'openssl'
|
|
4
|
+
require 'voxmail/request'
|
|
5
|
+
|
|
6
|
+
module Voxmail
|
|
7
|
+
|
|
8
|
+
def self.lookup(method, *args)
|
|
9
|
+
Request.new.client(method, *args)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.info
|
|
13
|
+
args = []
|
|
14
|
+
Request.new.client('voxmail.info', *args)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Voxmail
|
|
2
|
+
class Request
|
|
3
|
+
attr_accessor :host, :publickey, :secretkey
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@host = ENV['VOXMAILHOST'] || 'voxmailgem.voxmail.it'
|
|
7
|
+
@secretkey = ENV['VOXMAILSECRETKEY'] || 'ae041cf49a95854ffcfc9ab56cfdeb1e'
|
|
8
|
+
@publickey = ENV['VOXMAILPUBLICKEY'] || 'b31d119a48a5e5fb57819312be55e83e'
|
|
9
|
+
@args = []
|
|
10
|
+
@client = XMLRPC::Client.new(host, "/services/xmlrpc", 80)
|
|
11
|
+
#@client.http_header_extra = { 'Content-Type' => 'text/xml' }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def client(method, *args)
|
|
15
|
+
digest = OpenSSL::Digest.new('sha256')
|
|
16
|
+
ts = Time.now.to_i;
|
|
17
|
+
nonce = rand(100000000).to_s;
|
|
18
|
+
pk = publickey+";"+ts.to_s+";"+nonce+";"+method
|
|
19
|
+
hash = OpenSSL::HMAC.hexdigest(digest,secretkey, pk)
|
|
20
|
+
@client.call( method, "API"+publickey, ts, nonce, hash, *args )
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/tasks/rspec.rake
ADDED
data/voxmail.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'voxmail/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "voxmail"
|
|
8
|
+
spec.version = Voxmail::VERSION
|
|
9
|
+
spec.authors = ["Marco Ghezzi"]
|
|
10
|
+
spec.email = ["marcog@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Very Simple APIs wrapper for Voxmail}
|
|
13
|
+
spec.description = %q{Very Simple APIs wrapper for [Voxmail]:http://www.voxmail.it}
|
|
14
|
+
spec.homepage = "https://github.com/marcog/voxmail"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
spec.bindir = "exe"
|
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
24
|
+
spec.add_development_dependency 'rspec'
|
|
25
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voxmail
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Marco Ghezzi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.8'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.8'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: Very Simple APIs wrapper for [Voxmail]:http://www.voxmail.it
|
|
56
|
+
email:
|
|
57
|
+
- marcog@gmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".rvmrc"
|
|
64
|
+
- Gemfile
|
|
65
|
+
- LICENSE.txt
|
|
66
|
+
- README.md
|
|
67
|
+
- Rakefile
|
|
68
|
+
- bin/console
|
|
69
|
+
- bin/setup
|
|
70
|
+
- lib/voxmail.rb
|
|
71
|
+
- lib/voxmail/request.rb
|
|
72
|
+
- lib/voxmail/version.rb
|
|
73
|
+
- tasks/rspec.rake
|
|
74
|
+
- voxmail.gemspec
|
|
75
|
+
homepage: https://github.com/marcog/voxmail
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata: {}
|
|
79
|
+
post_install_message:
|
|
80
|
+
rdoc_options: []
|
|
81
|
+
require_paths:
|
|
82
|
+
- lib
|
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '0'
|
|
93
|
+
requirements: []
|
|
94
|
+
rubyforge_project:
|
|
95
|
+
rubygems_version: 2.2.1
|
|
96
|
+
signing_key:
|
|
97
|
+
specification_version: 4
|
|
98
|
+
summary: Very Simple APIs wrapper for Voxmail
|
|
99
|
+
test_files: []
|