mogreet 0.0.2.pre → 0.0.2.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -9
- data/lib/mogreet/client.rb +4 -1
- data/lib/mogreet/deprecated.rb +0 -24
- data/lib/mogreet/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -1,20 +1,33 @@
|
|
1
1
|
Mogreet API
|
2
2
|
===========
|
3
3
|
|
4
|
-
|
4
|
+
A Ruby wrapper for the Mogreet API.
|
5
|
+
|
6
|
+
##Installation
|
7
|
+
Install the gem by issuing
|
8
|
+
|
9
|
+
gem install mogreet
|
10
|
+
|
11
|
+
or put it in your Gemfile and run `bundle install`
|
12
|
+
|
13
|
+
gem "mogreet"
|
14
|
+
|
15
|
+
## Usage Examples
|
16
|
+
|
17
|
+
__Create client__
|
18
|
+
|
19
|
+
client = Mogreet::Client.new('111111', 'xyxyxyxyxyxyxyxyxyxyxyx')
|
5
20
|
|
6
21
|
__Ping__
|
7
22
|
|
8
|
-
client = Mogreet::Client.new(ENV['MOGREET_CLIENT_ID'], ENV['MOGREET_TOKEN'])
|
9
23
|
response = client.system.ping
|
10
24
|
puts response.message
|
11
25
|
|
12
26
|
|
13
27
|
__Send MMS to one recipient__
|
14
28
|
|
15
|
-
client = Mogreet::Client.new(ENV['MOGREET_CLIENT_ID'], ENV['MOGREET_TOKEN'])
|
16
29
|
response = client.transaction.send(
|
17
|
-
:campaign_id =>
|
30
|
+
:campaign_id => 987,
|
18
31
|
:to => '1111111111',
|
19
32
|
:message => 'hello world',
|
20
33
|
:content_url => 'https://wp-uploads.mogreet.com/wp-uploads/2013/02/API-Beer-sticker-300dpi-1024x1024.jpg'
|
@@ -22,18 +35,16 @@ __Send MMS to one recipient__
|
|
22
35
|
|
23
36
|
__Send SMS to one recipient__
|
24
37
|
|
25
|
-
client = Mogreet::Client.new(ENV['MOGREET_CLIENT_ID'], ENV['MOGREET_TOKEN'])
|
26
38
|
response = client.transaction.send(
|
27
|
-
:campaign_id =>
|
39
|
+
:campaign_id => 988,
|
28
40
|
:to => '1111111111',
|
29
41
|
:message => 'hello world'
|
30
42
|
)
|
31
43
|
|
32
44
|
__Send SMS to list of recipients__
|
33
45
|
|
34
|
-
client = Mogreet::Client.new(ENV['MOGREET_CLIENT_ID'], ENV['MOGREET_TOKEN'])
|
35
46
|
response = client.list.send(
|
36
|
-
:campaign_id =>
|
47
|
+
:campaign_id => 988,
|
37
48
|
:message => 'hello world',
|
38
49
|
:list_id => '8228'
|
39
50
|
)
|
@@ -41,10 +52,16 @@ __Send SMS to list of recipients__
|
|
41
52
|
|
42
53
|
__Upload File__
|
43
54
|
|
44
|
-
client = Mogreet::Client.new(ENV['MOGREET_CLIENT_ID'], ENV['MOGREET_TOKEN'])
|
45
55
|
response = client.media.upload(
|
46
56
|
:name => 'upload name',
|
47
57
|
:type => 'image',
|
48
58
|
:file => File.new("image.jpg")
|
49
59
|
)
|
50
60
|
|
61
|
+
## Development
|
62
|
+
|
63
|
+
Questions or problems? Please post them on the [issue tracker](https://github.com/pforsyth/mogreet/issues). You can contribute changes by forking the project and submitting a pull request. You can ensure the tests are passing by running `bundle` and `rake`.
|
64
|
+
|
65
|
+
## Contributors
|
66
|
+
|
67
|
+
The Mogreet gem was initially created by Andrew Hage and Mateusz Dominiak. [Paul Forsyth](http://github.com/pforsyth) is the current maintainer.
|
data/lib/mogreet/client.rb
CHANGED
@@ -4,7 +4,6 @@ require 'json'
|
|
4
4
|
|
5
5
|
module Mogreet
|
6
6
|
class Client
|
7
|
-
# include Request
|
8
7
|
|
9
8
|
attr_accessor :client_id, :token, :http_response
|
10
9
|
|
@@ -48,6 +47,10 @@ module Mogreet
|
|
48
47
|
def transaction
|
49
48
|
@transaction ||= Transaction.new(self)
|
50
49
|
end
|
50
|
+
|
51
|
+
def inspect
|
52
|
+
%(<Mogreet::Client @client_id="#{@client_id}", @token="#{@token}">)
|
53
|
+
end
|
51
54
|
|
52
55
|
private
|
53
56
|
|
data/lib/mogreet/deprecated.rb
CHANGED
@@ -30,27 +30,3 @@ module Mogreet
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
|
35
|
-
# - "{\"client_id\"=>\"714\", \"token\"=>\"a48951eed1e8b093fbea70d882257d84\", \"campaign_id\"=>\"20861\", \"to\"=>\"3104656416\", \"message\"=>\"Hello World!\", \"content_url\"=>\"http://rubyonrails.org/images/rails.png\", \"format\"=>:json}"
|
36
|
-
|
37
|
-
# Configuration
|
38
|
-
# Configure mogreet (add this block to config/initializers/mogreet.rb in case of Rails application):
|
39
|
-
#
|
40
|
-
# Mogreet.configure do |config|
|
41
|
-
# config.client_id = "123"
|
42
|
-
# config.token = "ee91dfa14e59a8600d7976c554f2ed12"
|
43
|
-
# config.campaign_id = "19001"
|
44
|
-
# end
|
45
|
-
# Usage
|
46
|
-
# Send MMS message:
|
47
|
-
#
|
48
|
-
# response = Mogreet::Message.send to: '5551236789',
|
49
|
-
# message: 'Hello World!',
|
50
|
-
# content_url: 'http://rubyonrails.org/images/rails.png'
|
51
|
-
#
|
52
|
-
# response.status #=> "success"
|
53
|
-
# response.code #=> "1"
|
54
|
-
# response.message #=> "Mogreet successfully sent!"
|
55
|
-
# response.message_id #=> 123456789
|
56
|
-
# response.transaction_hash #=> "a12b3c4d"
|
data/lib/mogreet/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mogreet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.pre2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-03-28 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70294022745780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70294022745780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hashie
|
27
|
-
requirement: &
|
27
|
+
requirement: &70294022745200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70294022745200
|
36
36
|
description: Ruby interface to the Mogreet API. Allows sending SMS and MMS messages.
|
37
37
|
Go to https://developer.mogreet.com to create an account.
|
38
38
|
email:
|