nibbme 1.1.0 → 1.2.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.
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +41 -0
- data/lib/nibbme/sms_log.rb +23 -0
- data/lib/nibbme/version.rb +1 -1
- metadata +4 -3
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -73,6 +73,7 @@ You can request data simply by calling a +find+ method.
|
|
73
73
|
groups = Nibbme::Group.find(:all)
|
74
74
|
groups = Nibbme::Group.find(:first)
|
75
75
|
groups = Nibbme::Group.find(:last)
|
76
|
+
group = Nibbme::Group.find(15) # Where 15 is a Group ID number
|
76
77
|
|
77
78
|
Note that this will return only the items on the first page. You can pass the +page+ variable to
|
78
79
|
get the items on the subpage. If the request is empty you know there is no more items.
|
@@ -114,6 +115,7 @@ You can request data simply by calling a +find+ method.
|
|
114
115
|
clients = Nibbme::Client.find(:all)
|
115
116
|
clients = Nibbme::Client.find(:first)
|
116
117
|
clients = Nibbme::Client.find(:last)
|
118
|
+
client = Nibbme::Client.find(15) # Where 15 is a Client ID number
|
117
119
|
|
118
120
|
Note that this will return only the items on the first page. You can pass the +page+ variable to
|
119
121
|
get the items on the subpage. If the request is empty you know there is no more items.
|
@@ -155,6 +157,7 @@ You can request data simply by calling a +find+ method.
|
|
155
157
|
messages = Nibbme::Message.find(:all)
|
156
158
|
messages = Nibbme::Message.find(:first)
|
157
159
|
messages = Nibbme::Message.find(:last)
|
160
|
+
message = Nibbme::Message.find(15) # Where 15 is a Message ID number
|
158
161
|
|
159
162
|
Note that this will return only the items on the first page. You can pass the +page+ variable to
|
160
163
|
get the items on the subpage. If the request is empty you know there is no more items.
|
@@ -211,6 +214,44 @@ Similar to ActiveRecord all errors are logged as part of +errors+ variable.
|
|
211
214
|
|
212
215
|
You can find more about error handling {here}[http://api.rubyonrails.org/classes/ActiveResource/Validations.html].
|
213
216
|
|
217
|
+
=== Logs (Tracking SMS Status)
|
218
|
+
|
219
|
+
You can request data simply by calling a +find+ method.
|
220
|
+
|
221
|
+
logs = Nibbme::SmsLog.find(:all)
|
222
|
+
logs = Nibbme::SmsLog.find(:first)
|
223
|
+
logs = Nibbme::SmsLog.find(:last)
|
224
|
+
logs = Nibbme::SmsLog.find(15) # Where 15 is a SmsLog ID number
|
225
|
+
|
226
|
+
Note that this will return only the items on the first page. You can pass the +page+ variable to
|
227
|
+
get the items on the subpage. If the request is empty you know there is no more items.
|
228
|
+
|
229
|
+
# Request the second page
|
230
|
+
logs = Nibbme::SmsLog.find(:all, :params => { :page => 1 })
|
231
|
+
|
232
|
+
You can also filter the list through a +tags+ variable.
|
233
|
+
|
234
|
+
# Request the second page but filter only the items containing the word '313'
|
235
|
+
logs = Nibbme::SmsLog.find(:all, :params => { :page => 1, :tags => '313' })
|
236
|
+
|
237
|
+
You can check if an item exists by calling the +exists?+ method.
|
238
|
+
|
239
|
+
# Check if the SmsLog with ID=1 exists
|
240
|
+
exists = Nibbme::SmsLog.exists?(1)
|
241
|
+
|
242
|
+
Usually you will know a message and client ID. You can check an SMS status as follows
|
243
|
+
|
244
|
+
# Find log for a message with ID=14 and client ID=50
|
245
|
+
log = Nibbme::SmsLog.find_one(14, 50)
|
246
|
+
|
247
|
+
# Check if the message has been delivered
|
248
|
+
log.delivered?
|
249
|
+
|
250
|
+
# Check if the message has failed
|
251
|
+
log.failed?
|
252
|
+
|
253
|
+
# Show the message state
|
254
|
+
log.state
|
214
255
|
|
215
256
|
== Links
|
216
257
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Nibbme
|
2
|
+
class SmsLog < Nibbme::AbstractBase
|
3
|
+
|
4
|
+
def self.find_one(message_id, client_id)
|
5
|
+
self.find(message_id, :params => { :client_id => client_id })
|
6
|
+
end
|
7
|
+
|
8
|
+
def delivered?
|
9
|
+
!self.delivered_at.nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def failed?
|
13
|
+
!self.failed_at.nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def state
|
17
|
+
return 'delivered' if self.delivered?
|
18
|
+
return 'failed' if self.failed?
|
19
|
+
'in_progress'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/nibbme/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristijan Sedlak
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-16 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/nibbme/gateway.rb
|
36
36
|
- lib/nibbme/group.rb
|
37
37
|
- lib/nibbme/message.rb
|
38
|
+
- lib/nibbme/sms_log.rb
|
38
39
|
- lib/nibbme/tasks.rb
|
39
40
|
- lib/nibbme/version.rb
|
40
41
|
- lib/nibbme.rb
|