mogreet 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +5 -0
- data/lib/mogreet.rb +9 -0
- data/lib/mogreet/config.rb +3 -0
- data/lib/mogreet/message.rb +8 -0
- data/lib/mogreet/mogreet.rb +13 -0
- data/lib/mogreet/response/transaction_send.rb +5 -0
- data/lib/mogreet/user.rb +5 -0
- data/lib/mogreet/version.rb +3 -0
- data/mogreet.gemspec +23 -0
- data/spec/fixtures/transaction_send.xml +6 -0
- data/spec/mogreet/config_spec.rb +17 -0
- data/spec/mogreet/message_spec.rb +32 -0
- data/spec/spec_helper.rb +11 -0
- metadata +119 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Andrew Hage
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Mogreet
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mogreet'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mogreet
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/mogreet.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
class Mogreet::Message
|
2
|
+
class << self
|
3
|
+
def send(options)
|
4
|
+
response = HTTParty.get("https://api.mogreet.com/moms/transaction.send", query: Mogreet.config.merge(options).to_hash)
|
5
|
+
Mogreet::Response::TransactionSend.new Crack::XML.parse(response.body)['response']
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
data/lib/mogreet/user.rb
ADDED
data/mogreet.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/mogreet/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Andrew Hage", "Mateusz Dominiak"]
|
6
|
+
gem.email = ["andrew@okvenue.com", "mateusz.dominiak@gmail.com"]
|
7
|
+
gem.description = %q{A ruby wrapper for the Mogreet API}
|
8
|
+
gem.summary = %q{A simple ruby interface to the api at https://api.mogreet.com}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "mogreet"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Mogreet::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
|
20
|
+
gem.add_runtime_dependency "hashie"
|
21
|
+
gem.add_runtime_dependency "httparty"
|
22
|
+
gem.add_runtime_dependency "crack"
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mogreet::Config do
|
4
|
+
describe ".configure" do
|
5
|
+
specify do
|
6
|
+
Mogreet.configure do |config|
|
7
|
+
config.client_id = "123"
|
8
|
+
config.token = 'abcd'
|
9
|
+
config.campaign_id = '1234'
|
10
|
+
end
|
11
|
+
|
12
|
+
Mogreet.config.client_id.should == '123'
|
13
|
+
Mogreet.config.token.should == 'abcd'
|
14
|
+
Mogreet.config.campaign_id.should == '1234'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mogreet::Message do
|
4
|
+
before do
|
5
|
+
Mogreet.configure do |config|
|
6
|
+
config.client_id = '123'
|
7
|
+
config.token = 'abc'
|
8
|
+
config.campaign_id = '1234'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".send" do
|
13
|
+
it "should send the MMS" do
|
14
|
+
http_response = double('mogreet response', body: load_fixture('transaction_send.xml'))
|
15
|
+
HTTParty.should_receive(:get).with("https://api.mogreet.com/moms/transaction.send", query: {
|
16
|
+
'client_id' => '123',
|
17
|
+
'token' => 'abc',
|
18
|
+
'campaign_id' => '1234',
|
19
|
+
'to' => '6015121232',
|
20
|
+
'content_url' => 'http://assets.com/image.png',
|
21
|
+
'message' => 'hello'
|
22
|
+
}).and_return(http_response)
|
23
|
+
|
24
|
+
response = Mogreet::Message.send(to: '6015121232', message: 'hello', content_url: 'http://assets.com/image.png')
|
25
|
+
response.status.should == 'success'
|
26
|
+
response.code.should == '1'
|
27
|
+
response.message.should == 'Mogreet successfully sent!'
|
28
|
+
response.message_id.should == "123456789"
|
29
|
+
response.transaction_hash.should == "a12b3c4d"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mogreet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Hage
|
9
|
+
- Mateusz Dominiak
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-05-07 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &70282665112420 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70282665112420
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: hashie
|
28
|
+
requirement: &70282665111540 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70282665111540
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: httparty
|
39
|
+
requirement: &70282665110780 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70282665110780
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: crack
|
50
|
+
requirement: &70282665110080 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70282665110080
|
59
|
+
description: A ruby wrapper for the Mogreet API
|
60
|
+
email:
|
61
|
+
- andrew@okvenue.com
|
62
|
+
- mateusz.dominiak@gmail.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- .gitignore
|
68
|
+
- .rspec
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- lib/mogreet.rb
|
74
|
+
- lib/mogreet/config.rb
|
75
|
+
- lib/mogreet/message.rb
|
76
|
+
- lib/mogreet/mogreet.rb
|
77
|
+
- lib/mogreet/response/transaction_send.rb
|
78
|
+
- lib/mogreet/user.rb
|
79
|
+
- lib/mogreet/version.rb
|
80
|
+
- mogreet.gemspec
|
81
|
+
- spec/fixtures/transaction_send.xml
|
82
|
+
- spec/mogreet/config_spec.rb
|
83
|
+
- spec/mogreet/message_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
homepage: ''
|
86
|
+
licenses: []
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: -2999825688056420005
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
hash: -2999825688056420005
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 1.8.10
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: A simple ruby interface to the api at https://api.mogreet.com
|
115
|
+
test_files:
|
116
|
+
- spec/fixtures/transaction_send.xml
|
117
|
+
- spec/mogreet/config_spec.rb
|
118
|
+
- spec/mogreet/message_spec.rb
|
119
|
+
- spec/spec_helper.rb
|