semaphore-sms 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e70997b5f0367ef176c7c8f2db655797d08e8a5
4
- data.tar.gz: bb8fe5377da473b232521f498acff15369e58023
3
+ metadata.gz: e7358f54b837825b64dd4bc1b141e17b18cce880
4
+ data.tar.gz: 61e9d78419c12c8a810eeed68b3bf7cc9d3c1aa1
5
5
  SHA512:
6
- metadata.gz: 0c0c17058522c146c5d27da910fb2f5614a12686b85250c76037afa000f77e2d31c52b793ba0c321e06fe4aafeb2dd84582cf731beee8fc06d36831f0038ad93
7
- data.tar.gz: d462853cf084377de65bfa28243c4772a0060d8cc4ca9417604a78ec86ab46a9152b287e6359f0d272aaa9dbba760870aa8e45a13a360a7c46d21d3f349b1b5d
6
+ metadata.gz: 5bb7f0a88a10d185a709097e5574320458f4ccfc0cd417de2c0b1e9647de60dc10c2c862e8c6821a487390ce2a663c06aa9325c7e45d11f328ac3f8428f6974d
7
+ data.tar.gz: 84c048da5047661a273e35b8a6ada3c84621bdfe34032ac263b555091ea66b360ad2f4a80b73c6f4f23bf9264b57f6fc930a92ebc4a6b5b61308c23394013a6b
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Semaphore::Sms
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/semaphore/sms`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This is a ruby api wrapper for Semaphore, https://semaphore.co/
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,141 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ Run:
24
+ ```
25
+ rails g semaphore:sms:install
26
+ ```
27
+
28
+ Note:
29
+
30
+ This will generate a file in `config/initializers` called `semaphore-sms.rb`. Configure semaphore api here.
31
+
32
+ ```
33
+ Semaphore::Sms.setup do |config|
34
+ # config.api_key = "YOUR API KEY HERE"
35
+ # NOTE: add if you want to use a single sender name by default.
36
+ # config.sender_name = "SEMAPHORE"
37
+ end
38
+ ```
39
+ Below we demonstrate the most basic usage of the library:
40
+
41
+ ```ruby
42
+ require "semaphore-sms"
43
+
44
+ # You should already configure you api key under `initializers/semaphore-sms.rb`
45
+ client = Semaphore::Sms.client
46
+
47
+ # Sending a single message.
48
+
49
+ client.send("Hello World", "09175488888")
50
+
51
+ # response
52
+
53
+ [
54
+ {
55
+ "message_id" => 55871500,
56
+ "user_id" => 4788,
57
+ "user" => "jag.arnold.go@gmail.com",
58
+ "account_id" => 4688,
59
+ "account" => "FreeLance",
60
+ "recipient" => "639778048888",
61
+ "message" => "Hello World",
62
+ "sender_name" => "Semaphore",
63
+ "network" => "Next",
64
+ "status" => "Pending",
65
+ "type" => "Single",
66
+ "source" => "Api",
67
+ "created_at" => "2018-03-12 20:11:21",
68
+ "updated_at" => "2018-03-12 20:11:21"
69
+ }
70
+ ]
71
+
72
+ # Sending a single message to multiple recipients or bulk messages.
73
+
74
+ client.send("Hello World", ["09175488888","09778048888"])
75
+
76
+ # response
77
+
78
+ [
79
+ {
80
+ "message_id" => 55871554,
81
+ "user_id" => 4788,
82
+ "user" => "jag.arnold.go@gmail.com",
83
+ "account_id" => 4688,
84
+ "account" => "FreeLance",
85
+ "recipient" => "639175488888",
86
+ "message" => "Hello World",
87
+ "sender_name" => "Semaphore",
88
+ "network" => "Globe",
89
+ "status" => "Pending",
90
+ "type" => "Bulk",
91
+ "source" => "Api",
92
+ "created_at" => "2018-03-12 20:16:46",
93
+ "updated_at" => "2018-03-12 20:16:46"
94
+ },
95
+ {
96
+ "message_id" => 55871555,
97
+ "user_id" => 4788,
98
+ "user" => "jag.arnold.go@gmail.com",
99
+ "account_id" => 4688,
100
+ "account" => "FreeLance",
101
+ "recipient" => "639778048888",
102
+ "message" => "Hello World",
103
+ "sender_name" => "Semaphore",
104
+ "network" => "Next",
105
+ "status" => "Pending",
106
+ "type" => "Bulk",
107
+ "source" => "Api",
108
+ "created_at" => "2018-03-12 20:16:46",
109
+ "updated_at" => "2018-03-12 20:16:46"
110
+ }
111
+ ]
112
+
113
+
114
+ # Sending a message using a sender name.
115
+
116
+ client.send("Hello World", ["09175488888", "09175488888"], "SAITAMA")
117
+
118
+ NOTE: By default you can configure your sender name in `config/initializers/semaphore-sms` or
119
+ pass a third agument to overwrite existing sender name in `initializers/semaphore-sms.rb`.
120
+ If no sendername is attached it will default to `Semaphore`.
121
+
122
+
123
+ ## Sending a single priority message.
124
+
125
+ client.priority("Hello World", "09175488888")
126
+
127
+ ## Sending a single priority message to multiple recipients or bulk messages.
128
+
129
+ client.priority("Hello World", ["09175488888","09778048888"])
130
+
131
+ ## Requesting for account information
132
+
133
+ client.account
134
+
135
+ ## Requesting for all the messages sent
136
+
137
+ client.messages
138
+
139
+ ## Requesting for a specific message
140
+
141
+ client.messages(id: 55871555)
142
+
143
+ ## Requesting for all transaction made
144
+
145
+ client.transactions
146
+ client.transactions(id: 1, limit: 100) # Page and Limit are optional. Limit default to 100.
147
+
148
+ ## Requesting for all sender names
149
+
150
+ client.sender_names
151
+ client.sender_name(id: 1, limit: 100) # Page and Limit are optional. Limit default to 100.
152
+
153
+ ## Requesting for all users
154
+
155
+ client.users
156
+ client.users(id: 1, limit: 100) # Page and Limit are optional. Limit default to 100.
157
+ ```
26
158
 
27
159
  ## Development
28
160
 
@@ -32,7 +164,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
164
 
33
165
  ## Contributing
34
166
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/semaphore-sms. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
167
+ Bug reports and pull requests are welcome on GitHub at https://github.com/goldendragon1988/semaphore-sms. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
168
 
37
169
  ## License
38
170
 
@@ -1,5 +1,5 @@
1
1
  Semaphore::Sms.setup do |config|
2
- config.api_key = "YOUR API KEY HERE"
2
+ # config.api_key = "YOUR API KEY HERE"
3
3
  # NOTE: add if you want to use a single sender name by default.
4
4
  # config.sender_name = "SEMAPHORE"
5
5
  end
@@ -10,7 +10,7 @@ module Semaphore
10
10
  Response = Struct.new(:status, :content)
11
11
 
12
12
  def initialize(config)
13
- raise Semaphore::Sms::Error, 'Config must have app credentials' unless config.respond_to? :api_key
13
+ raise Semaphore::Sms::Error, 'Config must have api key credentials' unless config.respond_to? :api_key
14
14
  @config = config
15
15
  end
16
16
 
@@ -1,5 +1,5 @@
1
1
  module Semaphore
2
2
  module Sms
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semaphore-sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Arnold Go