schism 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 +6 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/Rakefile +2 -0
- data/Readme.md +41 -0
- data/bin/schism +81 -0
- data/lib/schism.rb +2 -0
- data/lib/schism/version.rb +3 -0
- data/schism.gemspec +22 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d29765a0ddb32e8f25e0f2a496aad8ce81bd65d
|
4
|
+
data.tar.gz: 553f6b369351e4bd9d9176ec8c26d7f480af72f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e5377f418277e5a750698e5ad81e0deefabc3b7e7a699b3c4ab3c38d822c60e2add3092218b80f7a01bb0af403849d928159b0e3d4543bf754dbf733ed150ba
|
7
|
+
data.tar.gz: c1ab27b12a277147ba7401bf5da05eb31f0c1f1add63f29ba09231524dad10287bdedfc12a1e58ca02d77b6a63f4f44ca483e1dafa1f34aea08b96c8a6d46e68
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dave Russell
|
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.
|
22
|
+
|
data/Rakefile
ADDED
data/Readme.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
`schism` allows you to send SMS via the console with the Clockwork API
|
2
|
+
|
3
|
+
# Install #
|
4
|
+
|
5
|
+
gem install schism
|
6
|
+
|
7
|
+
# Configuration #
|
8
|
+
|
9
|
+
* Get an API key from [Clockwork](http://www.clockworksms.com/)
|
10
|
+
* Create a file at `~/.config/schism_api_key` and paste your Clockwork API key in to it.
|
11
|
+
|
12
|
+
|
13
|
+
# Usage #
|
14
|
+
|
15
|
+
To check your balance:
|
16
|
+
|
17
|
+
schism balance
|
18
|
+
|
19
|
+
To send an SMS
|
20
|
+
|
21
|
+
schism send --to NUMBER --message MESSAGE
|
22
|
+
|
23
|
+
`NUMBER` must include the internation dialling code and area code, excluding any spaces or special characters. For example:
|
24
|
+
|
25
|
+
--to 447654123456
|
26
|
+
|
27
|
+
`MESSAGE` should be wrapped in quotations, for example:
|
28
|
+
|
29
|
+
--message "Hello, this is a multiple word message"
|
30
|
+
|
31
|
+
# Contributors #
|
32
|
+
|
33
|
+
Built by [OkayDave](https://github.com/OkayDave)
|
34
|
+
|
35
|
+
Special thanks to [Powder](https://github.com/rodreegez/powder) for providing the application skeleton.
|
36
|
+
|
37
|
+
|
38
|
+
## Copyright ##
|
39
|
+
|
40
|
+
Copyright (c) 2015 Dave Russell. See LICENSE for details.
|
41
|
+
|
data/bin/schism
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'thor'
|
5
|
+
require 'rest-client'
|
6
|
+
|
7
|
+
module Schism
|
8
|
+
class CLI < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
default_task :help
|
11
|
+
|
12
|
+
CONFIG_DIR = "#{ENV["HOME"]}/.config/"
|
13
|
+
CONFIG_FILE = "schism_api_key"
|
14
|
+
CONFIG_FULL = "#{CONFIG_DIR}#{CONFIG_FILE}"
|
15
|
+
|
16
|
+
SEND_URL = "api.clockworksms.com/http/send.aspx"
|
17
|
+
BALANCE_URL = "api.clockworksms.com/http/balance.aspx"
|
18
|
+
|
19
|
+
@recipient = ""
|
20
|
+
@message = ""
|
21
|
+
@@api_key = ""
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
no_commands do
|
27
|
+
def load_config
|
28
|
+
exit unless create_config
|
29
|
+
@@api_key = `cat #{CONFIG_FULL}`
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_config
|
34
|
+
unless File.exists?(CONFIG_FULL)
|
35
|
+
puts "Creating config at #{CONFIG_FULL}"
|
36
|
+
puts "Enter your Clockwork API key in this file"
|
37
|
+
%x{mkdir #{CONFIG_DIR}} unless File.directory?(CONFIG_DIR)
|
38
|
+
%x{touch #{CONFIG_FULL}}
|
39
|
+
return false
|
40
|
+
else
|
41
|
+
return true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def key_param
|
47
|
+
return {key: @@api_key}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
desc "balance", "Get account balance"
|
54
|
+
def balance
|
55
|
+
load_config
|
56
|
+
response = RestClient.get BALANCE_URL, {params: {key: @@api_key}}
|
57
|
+
|
58
|
+
puts response.body
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
desc "send", "Send message to number"
|
63
|
+
method_option :to, aliases: "-t", desc: "Number to send SMS to. Format: 447000000000", required: true
|
64
|
+
method_option :message, aliases: "-m", desc: "Message to send.", required: true
|
65
|
+
|
66
|
+
def send()
|
67
|
+
load_config
|
68
|
+
|
69
|
+
response = RestClient.get SEND_URL, {params: {key: @@api_key, to: options[:to], content: options[:message]}}
|
70
|
+
|
71
|
+
if response.code==200
|
72
|
+
puts "Message sent"
|
73
|
+
else
|
74
|
+
puts "Unable to send message, please try again later"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
Schism::CLI.start
|
data/lib/schism.rb
ADDED
data/schism.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "schism/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "schism"
|
7
|
+
s.version = Schism::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Dave Russell"]
|
10
|
+
s.email = ["dave.kerr@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/OkayDave/schism"
|
12
|
+
s.summary = %q{Send SMS via the console}
|
13
|
+
s.description = %q{Send SMS via the console}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.executables = ["schism"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency 'thor', '=0.19.1'
|
20
|
+
s.add_dependency 'rest-client', '=2.0.0.rc1'
|
21
|
+
s.add_development_dependency 'rake'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: schism
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Russell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0.rc1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0.rc1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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: Send SMS via the console
|
56
|
+
email:
|
57
|
+
- dave.kerr@gmail.com
|
58
|
+
executables:
|
59
|
+
- schism
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- Rakefile
|
67
|
+
- Readme.md
|
68
|
+
- bin/schism
|
69
|
+
- lib/schism.rb
|
70
|
+
- lib/schism/version.rb
|
71
|
+
- schism.gemspec
|
72
|
+
homepage: http://github.com/OkayDave/schism
|
73
|
+
licenses: []
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Send SMS via the console
|
95
|
+
test_files: []
|
96
|
+
has_rdoc:
|