mogreet 0.0.1

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.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .rvmrc
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mogreet.gemspec
4
+ gemspec
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.
@@ -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
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new('spec')
@@ -0,0 +1,9 @@
1
+ require 'hashie'
2
+ require 'httparty'
3
+ require 'crack/xml'
4
+
5
+ require "mogreet/mogreet"
6
+ require "mogreet/version"
7
+ require "mogreet/config"
8
+ require "mogreet/message"
9
+ require "mogreet/response/transaction_send"
@@ -0,0 +1,3 @@
1
+ class Mogreet::Config < Hashie::Mash
2
+
3
+ end
@@ -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
@@ -0,0 +1,13 @@
1
+ module Mogreet
2
+ def self.config
3
+ @@config ||= Config.new
4
+ end
5
+
6
+ def self.configure
7
+ @@config = Config.new
8
+ yield config
9
+ end
10
+
11
+ class Response
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class Mogreet::Response::TransactionSend < Hashie::Mash
2
+ def transaction_hash
3
+ self[:hash]
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Mogreet
2
+ class User
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Mogreet
2
+ VERSION = "0.0.1"
3
+ end
@@ -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,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <response status="success" code="1">
3
+ <message><![CDATA[Mogreet successfully sent!]]></message>
4
+ <message_id>123456789</message_id>
5
+ <hash>a12b3c4d</hash>
6
+ </response>
@@ -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
@@ -0,0 +1,11 @@
1
+ require 'mogreet'
2
+
3
+ module Helpers
4
+ def load_fixture(name)
5
+ File.read(File.expand_path("../fixtures/#{name}", __FILE__))
6
+ end
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.include Helpers
11
+ end
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