birdseed 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e76c65998bc0149431264bc2bb0d290952714688
4
- data.tar.gz: ec72a3936045d4468266ffacad6a53c119e755ef
3
+ metadata.gz: c476db6a956b4e6147ccb8c1c767ad4fc6c54283
4
+ data.tar.gz: d0c7017c0408edb368275c7b01c9c9f61b0fcd79
5
5
  SHA512:
6
- metadata.gz: 514183892e44df9053c5cbd88ebc4da1f22d60c956fbe0e973eb732aa6719cab088517747095f9a2b49f3ad37eadb7e2ab0626dcbe557082f92c56fa4bc193aa
7
- data.tar.gz: 549192f48f64bb3cd27eb2600c0e4533a154e69c09814e3a411f2f9fb65e00177a7bd64cc39c91b02ff6d37a6217b1322cb53e787b3ab7bdb11152505164274a
6
+ metadata.gz: 537aa5f32e4291ff8c664ca5522e011ceb1d5f14958d5c1eba5f1c4e676c0ba3d59b59603a07c9bd6637950ac8469de84090150993a7311fadff56b51af2d2bd
7
+ data.tar.gz: 8546cecd5c320f91569d3334100c38001584d0aa7e10d9f89cc3bfcc8a3a47bc4174256623e1d16a850734f0bc814a46dfad2049bd6c36726fba01d5b618b62b
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ birdseed
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2
data/birdseed.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "webmock"
25
- spec.add_runtime_dependency "rest_client"
25
+ spec.add_runtime_dependency "rest-client"
26
26
  spec.add_runtime_dependency "json"
27
+ spec.add_runtime_dependency "hashie"
27
28
  end
@@ -1,3 +1,3 @@
1
1
  module Birdseed
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/birdseed.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "birdseed/version"
2
2
  require 'json'
3
- require 'rest_client'
3
+ require 'rest-client'
4
+ require 'hashie'
4
5
 
5
6
  module Birdseed
6
7
  @@api_key = "SET_YOUR_API_KEY"
@@ -20,11 +21,12 @@ module Birdseed
20
21
 
21
22
  # See https://github.com/edmodo/fatbird#send-emails-using-rest-api
22
23
  def self.deliver(options={})
23
- RestClient.post(
24
+ response = RestClient.post(
24
25
  "#{self.fatbird_host}/deliveries",
25
26
  JSON.generate(options),
26
27
  {"Authorization" => "api_key #{@@api_key}", :content_type => :json, :accept => :json}
27
28
  )
29
+ Hashie::Mash.new(JSON.parse(response))
28
30
  end
29
31
 
30
32
  end
@@ -9,7 +9,8 @@ describe Birdseed do
9
9
  stub_request(:post, "#{Birdseed.fatbird_host}/deliveries").
10
10
  with(:body => JSON.generate({template_id: 'test_template', recipient: {address: 'test@example.com'}}),
11
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'})
12
+ to_return(:status => 200, :body => "{\"url\":\"https://fatbird.edmodo.com/deliveries/10956571\",\"campaign_id\":\"fatbird-test\",\"template_id\":\"fatbird-test\",\"recipient\":{\"address\":\"jerry@edmodo.com\",\"name\":\"Jerry Luk\"},\"sender\":{\"address\":\"notifications@edmodo.com\",\"name\":\"Edmodo\",\"reply_to\":\"announcements@edmodo.com\"},\"locale\":\"en-US\",\"id\":10956571,\"send_at\":null,\"sent_at\":null,\"status\":\"created\",\"data\":null,\"created_at\":\"2015-04-21T22:36:28.786Z\",\"updated_at\":\"2015-04-21T22:36:28.786Z\"}", :headers => {})
13
+ result = Birdseed.deliver(template_id: 'test_template', recipient: {address: 'test@example.com'})
14
+ expect(result.id).to eq(10956571)
14
15
  end
15
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birdseed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Luk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rest_client
70
+ name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: hashie
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Send emails with FatBird
98
112
  email:
99
113
  - jerry@edmodo.com
@@ -102,6 +116,9 @@ extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
104
118
  - ".gitignore"
119
+ - ".rspec"
120
+ - ".ruby-gemset"
121
+ - ".ruby-version"
105
122
  - Gemfile
106
123
  - LICENSE.txt
107
124
  - README.md