birdseed 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a01f31bc2b8d5a79660a62ecbc0b3ee66a10382e
4
+ data.tar.gz: fa584480e12b8bbf5f408b59eb1b44bb735f8704
5
+ SHA512:
6
+ metadata.gz: 9a2e2b76893b00328c567cc88b1f453d7724e6753921316c66186faf11252c5e6be6fa4efc3a66441cf766329534d338446b6b440cd3cfe6a2c710ae0daabbf0
7
+ data.tar.gz: b79f2b77df3a0144eca2f8950e04eaccf56e85ed08b86ba004789d381642ae57d4b6b91318a74da061a14805cfd9b6fc6e3caf73748dd64ba81b2598c3b4ee86
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in birdseed.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jerry Luk
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,38 @@
1
+ # Birdseed
2
+
3
+ FatBird Ruby Client
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'birdseed'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install birdseed
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ Birdseed.api_key = "YOUR_API_KEY"
23
+ Birdseed.deliver(
24
+ campaign_id: "some_campaign_id",
25
+ recipient: {address: "nic@edmodo.com", name: "Nic"},
26
+ data: {some: "data"}
27
+ )
28
+ ```
29
+
30
+ See all options at https://github.com/edmodo/fatbird#send-emails-using-rest-api
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/[my-github-username]/birdseed/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/birdseed.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'birdseed/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "birdseed"
8
+ spec.version = Birdseed::VERSION
9
+ spec.authors = ["Jerry Luk"]
10
+ spec.email = ["jerry@edmodo.com"]
11
+ spec.summary = %q{Send emails with FatBird}
12
+ spec.description = %q{Send emails with FatBird}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "webmock"
25
+ spec.add_runtime_dependency "rest_client"
26
+ spec.add_runtime_dependency "json"
27
+ end
@@ -0,0 +1,3 @@
1
+ module Birdseed
2
+ VERSION = "0.0.2"
3
+ end
data/lib/birdseed.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "birdseed/version"
2
+ require 'json'
3
+ require 'rest_client'
4
+
5
+ module Birdseed
6
+ @@api_key = "SET_YOUR_API_KEY"
7
+ @@fatbird_host = nil # Optional
8
+
9
+ def self.api_key=(key)
10
+ @@api_key = key
11
+ end
12
+
13
+ def self.fatbird_host=(host)
14
+ @@fatbird_host = host
15
+ end
16
+
17
+ def self.fatbird_host
18
+ @@fatbird_host ||= "https://fatbird.edmodoqabranch.com"
19
+ end
20
+
21
+ # See https://github.com/edmodo/fatbird#send-emails-using-rest-api
22
+ def self.deliver(options={})
23
+ RestClient.post(
24
+ "#{self.fatbird_host}/deliveries",
25
+ JSON.generate(options),
26
+ {"Authorization" => "api_key #{@@api_key}", :content_type => :json, :accept => :json}
27
+ )
28
+ end
29
+
30
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ require 'birdseed'
3
+
4
+ describe Birdseed do
5
+ let(:response) { double('Response') }
6
+
7
+ it "should send email" do
8
+ Birdseed.api_key = "test_api_key"
9
+ stub_request(:post, "#{Birdseed.fatbird_host}/deliveries").
10
+ with(:body => JSON.generate({template_id: 'test_template', recipient: {address: 'test@example.com'}}),
11
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'api_key test_api_key', 'Content-Type'=>'application/json'}).
12
+ to_return(:status => 200, :body => "", :headers => {})
13
+ Birdseed.deliver(template_id: 'test_template', recipient: {address: 'test@example.com'})
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'rspec'
4
+ require 'webmock/rspec'
5
+
6
+ RSpec.configure do |config|
7
+ config.include WebMock::API
8
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: birdseed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Jerry Luk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
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: rest_client
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: json
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
+ description: Send emails with FatBird
98
+ email:
99
+ - jerry@edmodo.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - birdseed.gemspec
110
+ - lib/birdseed.rb
111
+ - lib/birdseed/version.rb
112
+ - spec/birdseed_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: ''
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.5
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Send emails with FatBird
138
+ test_files:
139
+ - spec/birdseed_spec.rb
140
+ - spec/spec_helper.rb