openmarket 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -2
- data/lib/open_market/mo.rb +11 -6
- data/lib/open_market/version.rb +1 -1
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03574cf4234c4383d169c8a973df45152a4bf18
|
4
|
+
data.tar.gz: c6424fc60e44331e67a68a27bca98c25139c7c8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce88d406969b83cae11ffdd9e6b9ac1bc6d5e19161136b65319b5a9a3c46d0a88be7f491de6473ba4a9adb9eeecdcbba997941b870658df91002204cf60b788d
|
7
|
+
data.tar.gz: a108bc03bcc8970f01158d16d9996e3881743f4dd37bfa21af344f1f77e12a7642cd2c54421772c68b7447af968b4561f800eac8b8da6128110edbd1391970bc
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
###
|
23
|
+
### Configuration
|
24
24
|
|
25
25
|
The openmarket gem requires you to provide an id, password, program_id and short_code. Configure them before attempting any API calls.
|
26
26
|
|
@@ -102,7 +102,6 @@ result = OpenMarket::API.send_sms(
|
|
102
102
|
|
103
103
|
ticket_id_for_retry: ticket_id # If this is a re-try of a failed ticket.
|
104
104
|
)
|
105
|
-
|
106
105
|
```
|
107
106
|
#### status
|
108
107
|
|
@@ -117,7 +116,34 @@ puts result.description # should be 'No Error'
|
|
117
116
|
# Check the result of the SMS message
|
118
117
|
puts result.status_code
|
119
118
|
puts result.status_description
|
119
|
+
```
|
120
|
+
|
121
|
+
### Processing MO's
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
require 'openmarket/mo'
|
125
|
+
# In a Rails controller or Sinatra app environment, params will be defined
|
126
|
+
mo = OpenMarket::MO.new(params['xml'])
|
127
|
+
puts mo.inspect
|
128
|
+
# Do something with the MO...
|
129
|
+
|
130
|
+
# Just send a HTTP 200
|
131
|
+
render nothing: true # Rails
|
132
|
+
return [200] # Sinatra
|
133
|
+
```
|
120
134
|
|
135
|
+
### Processing DR's
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
require 'openmarket/dr'
|
139
|
+
# In a Rails controller or Sinatra app environment, params will be defined
|
140
|
+
dr = OpenMarket::DR.new(params['xml'])
|
141
|
+
puts dr.inspect
|
142
|
+
# Do something with the DR...
|
143
|
+
|
144
|
+
# Just send a HTTP 200
|
145
|
+
render nothing: true # Rails
|
146
|
+
return [200] # Sinatra
|
121
147
|
```
|
122
148
|
|
123
149
|
## Contributing
|
data/lib/open_market/mo.rb
CHANGED
@@ -2,7 +2,8 @@ require "rexml/document"
|
|
2
2
|
|
3
3
|
module OpenMarket
|
4
4
|
class MO
|
5
|
-
|
5
|
+
ATTRIBUTES = [:account_id, :carrier_id, :data, :data_coding, :destination_address, :destination_ton, :source_address, :source_ton, :ticket_id, :udhi]
|
6
|
+
attr_reader *ATTRIBUTES
|
6
7
|
def initialize(data)
|
7
8
|
(class << self; self; end).class_eval do
|
8
9
|
# Defining a member variable for xml would pollute #inspect
|
@@ -17,13 +18,13 @@ module OpenMarket
|
|
17
18
|
@account_id = account.attributes["id"]
|
18
19
|
end
|
19
20
|
if source = xml.elements["source"]
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
21
|
+
@source_address = source.attributes["address"]
|
22
|
+
@carrier_id = source.attributes["carrier"]
|
23
|
+
@source_ton = source.attributes["ton"]
|
23
24
|
end
|
24
25
|
if destination = xml.elements["destination"]
|
25
|
-
@
|
26
|
-
@
|
26
|
+
@destination_address = destination.attributes["address"]
|
27
|
+
@destination_ton = destination.attributes["ton"]
|
27
28
|
end
|
28
29
|
if option = xml.elements["option"]
|
29
30
|
@data_coding = option.attributes["datacoding"]
|
@@ -33,5 +34,9 @@ module OpenMarket
|
|
33
34
|
@data = message.attributes["data"]
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
def ==(rhs)
|
39
|
+
rhs.is_a?(self.class) && ATTRIBUTES.all? { |a| send(a) == rhs.send(a) }
|
40
|
+
end
|
36
41
|
end
|
37
42
|
end
|
data/lib/open_market/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openmarket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Betesh
|
@@ -117,7 +117,7 @@ description: |
|
|
117
117
|
|
118
118
|
## Usage
|
119
119
|
|
120
|
-
###
|
120
|
+
### Configuration
|
121
121
|
|
122
122
|
The openmarket gem requires you to provide an id, password, program_id and short_code. Configure them before attempting any API calls.
|
123
123
|
|
@@ -199,7 +199,6 @@ description: |
|
|
199
199
|
|
200
200
|
ticket_id_for_retry: ticket_id # If this is a re-try of a failed ticket.
|
201
201
|
)
|
202
|
-
|
203
202
|
```
|
204
203
|
#### status
|
205
204
|
|
@@ -214,7 +213,34 @@ description: |
|
|
214
213
|
# Check the result of the SMS message
|
215
214
|
puts result.status_code
|
216
215
|
puts result.status_description
|
216
|
+
```
|
217
|
+
|
218
|
+
### Processing MO's
|
219
|
+
|
220
|
+
```ruby
|
221
|
+
require 'openmarket/mo'
|
222
|
+
# In a Rails controller or Sinatra app environment, params will be defined
|
223
|
+
mo = OpenMarket::MO.new(params['xml'])
|
224
|
+
puts mo.inspect
|
225
|
+
# Do something with the MO...
|
226
|
+
|
227
|
+
# Just send a HTTP 200
|
228
|
+
render nothing: true # Rails
|
229
|
+
return [200] # Sinatra
|
230
|
+
```
|
217
231
|
|
232
|
+
### Processing DR's
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
require 'openmarket/dr'
|
236
|
+
# In a Rails controller or Sinatra app environment, params will be defined
|
237
|
+
dr = OpenMarket::DR.new(params['xml'])
|
238
|
+
puts dr.inspect
|
239
|
+
# Do something with the DR...
|
240
|
+
|
241
|
+
# Just send a HTTP 200
|
242
|
+
render nothing: true # Rails
|
243
|
+
return [200] # Sinatra
|
218
244
|
```
|
219
245
|
|
220
246
|
## Contributing
|