messaging_gateway 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ee9723ea9c3d62a30c8266748202cbbc8d0f4fc
4
+ data.tar.gz: a0b483c8221d8385d78ed16601b9d8d44cd48315
5
+ SHA512:
6
+ metadata.gz: cf9f6af10dfc956e795d003f36daf8e0c92fa05f552f613cd53fc422f947b0bb241bd819cc89196d93b4434bb8ab78a6e789ac64b45f7e68039a0f2bf15ca055
7
+ data.tar.gz: 3a2d0500989d0bc8534d82fe2e32ad0ea5c7111ec50259691b98da327c5f3f65bc9f06a5b7cc1dfb19df8fd38778e972c8ce83839731bd01b94cb9715a5626f1
Binary file
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in message_gateway_gem.gemspec
4
+ gemspec
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ message_gateway_gem (0.1.0)
5
+ daemons
6
+ delayed_job_active_record
7
+ httparty
8
+ therubyracer
9
+ twilio-ruby (~> 4.2.1)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activemodel (4.2.4)
15
+ activesupport (= 4.2.4)
16
+ builder (~> 3.1)
17
+ activerecord (4.2.4)
18
+ activemodel (= 4.2.4)
19
+ activesupport (= 4.2.4)
20
+ arel (~> 6.0)
21
+ activesupport (4.2.4)
22
+ i18n (~> 0.7)
23
+ json (~> 1.7, >= 1.7.7)
24
+ minitest (~> 5.1)
25
+ thread_safe (~> 0.3, >= 0.3.4)
26
+ tzinfo (~> 1.1)
27
+ arel (6.0.3)
28
+ builder (3.2.2)
29
+ daemons (1.2.3)
30
+ delayed_job (4.1.1)
31
+ activesupport (>= 3.0, < 5.0)
32
+ delayed_job_active_record (4.1.0)
33
+ activerecord (>= 3.0, < 5)
34
+ delayed_job (>= 3.0, < 5)
35
+ httparty (0.13.7)
36
+ json (~> 1.8)
37
+ multi_xml (>= 0.5.2)
38
+ i18n (0.7.0)
39
+ json (1.8.3)
40
+ jwt (1.5.1)
41
+ libv8 (3.16.14.11)
42
+ minitest (5.8.1)
43
+ multi_json (1.11.2)
44
+ multi_xml (0.5.5)
45
+ rake (10.4.2)
46
+ ref (2.0.0)
47
+ therubyracer (0.12.2)
48
+ libv8 (~> 3.16.14.0)
49
+ ref
50
+ thread_safe (0.3.5)
51
+ twilio-ruby (4.2.1)
52
+ builder (>= 2.1.2)
53
+ jwt (~> 1.0)
54
+ multi_json (>= 1.3.0)
55
+ tzinfo (1.2.2)
56
+ thread_safe (~> 0.1)
57
+
58
+ PLATFORMS
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ bundler (~> 1.10)
63
+ message_gateway_gem!
64
+ rake (~> 10.0)
65
+
66
+ BUNDLED WITH
67
+ 1.10.6
@@ -0,0 +1,36 @@
1
+ # MessageGatewayGem
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/message_gateway_gem`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'message_gateway_gem'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install message_gateway_gem
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/message_gateway_gem.
36
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "message_gateway_gem"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,57 @@
1
+ #author: lotzer_a
2
+
3
+ require "message_gateway_gem/version"
4
+ require 'httparty'
5
+ require 'twilio-ruby'
6
+
7
+ module MessagingGateway
8
+
9
+ class << self
10
+ attr_accessor :configuration
11
+
12
+ def output_config
13
+ puts "Token: #{MessagingGateway.configuration.token}"
14
+ puts "Server url #{MessagingGateway.configuration.server_url}"
15
+ puts "Server path #{MessagingGateway.configuration.server_path}"
16
+
17
+ return true
18
+ end
19
+
20
+ def configure
21
+ self.configuration ||= Configuration.new
22
+ yield(configuration)
23
+ end
24
+ end
25
+
26
+ class Configuration
27
+ attr_accessor :server_url, :token, :server_path
28
+
29
+ def initialize
30
+ @server_url = 'localhost:3001'
31
+ @server_path = '/api/v1/items'
32
+ end
33
+ end
34
+
35
+
36
+ def self.create_notification(recipient, body, format, url)
37
+ if MessagingGateway.configuration.token.nil? || MessagingGateway.configuration.token == ""
38
+ raise "Il manque le token !"
39
+ elsif @server_name.nil? || @server_name == ""
40
+ raise "Il manque le nom de serveur !"
41
+ elsif @environment.nil? || @environment == ""
42
+ raise "Il manque l'environnement !"
43
+ end
44
+ begin
45
+ response = HTTParty.post("http://#{MessagingGateway.configuration.server_url}#{MessagingGateway.configuration.server_path}",
46
+ body: { token: MessagingGateway.configuration.token,
47
+ recipient: recipient,
48
+ body: body,
49
+ format: format,
50
+ url: url } )
51
+ rescue Exception => e
52
+ puts "Following error happened #{e.message}\n\nBacktrace:\n#{e.backtrace.join('\n')}"
53
+ return false
54
+ end
55
+ return true
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module MessageGatewayGem
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'messaging_gateway/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "messaging_gateway"
8
+ spec.version = MessageGatewayGem::VERSION
9
+ spec.authors = ["lotzer_a"]
10
+ spec.email = ["julien@modulotech.fr"]
11
+
12
+ spec.summary = %q{Sends sms and calls to our Notification Gateway}
13
+ spec.homepage = ""
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.10"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+
23
+ spec.add_dependency "therubyracer"
24
+ spec.add_dependency "delayed_job_active_record"
25
+ spec.add_dependency "daemons"
26
+ spec.add_dependency "httparty"
27
+ spec.add_dependency "twilio-ruby", '~> 4.2.1'
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: messaging_gateway
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - lotzer_a
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: therubyracer
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: delayed_job_active_record
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: daemons
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: httparty
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: twilio-ruby
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 4.2.1
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 4.2.1
111
+ description:
112
+ email:
113
+ - julien@modulotech.fr
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".DS_Store"
119
+ - Gemfile
120
+ - Gemfile.lock
121
+ - README.md
122
+ - Rakefile
123
+ - bin/console
124
+ - bin/setup
125
+ - lib/messaging_gateway.rb
126
+ - lib/messaging_gateway/version.rb
127
+ - messaging_gateway.gemspec
128
+ homepage: ''
129
+ licenses: []
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.4.5
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Sends sms and calls to our Notification Gateway
151
+ test_files: []