oh-my-embed 1.0.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/lib/oh_my_embed.rb +1 -1
- data/lib/oh_my_embed/response.rb +9 -0
- data/lib/oh_my_embed/version.rb +1 -1
- data/spec/oh_my_embed/response_spec.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc9fdd71585f31eadeae70930224680ff2d7030
|
4
|
+
data.tar.gz: 1d3e73bc091acbcf845e4912ab3982d96d0b25b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2159a9328a5782f1723db6ab0537a07f96de5f659955bd4d4f2d0343180344557f72d8ecaf37eeceffdb567031cc4f960a2f3b21511c2e086658d9f5ae1fe1b
|
7
|
+
data.tar.gz: c2c999a481588d788947bdbb743837d654f2487e9a566f082efdd75e65352cc1a4d7304bf25f6c5a761cc02088d7d4be53f2bc9c45fd88590450c9700695a90c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
OhMyEmbed
|
2
2
|
=================
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/oh-my-embed)
|
4
4
|
[](https://travis-ci.org/dino115/oh-my-embed)
|
5
5
|
[](https://codeclimate.com/github/dino115/oh-my-embed)
|
6
6
|
[](https://codeclimate.com/github/dino115/oh-my-embed/coverage)
|
@@ -8,8 +8,6 @@ VERSION BADGE
|
|
8
8
|
|
9
9
|
Simple gem to interact with oembed providers. Read specs at http://www.oembed.com
|
10
10
|
|
11
|
-
** WORK IN PROGRESS, not finshed yet **
|
12
|
-
|
13
11
|
## Installation
|
14
12
|
|
15
13
|
Add this line to your application's Gemfile:
|
@@ -157,8 +155,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
157
155
|
|
158
156
|
Bug reports and pull requests are welcome on GitHub at https://github.com/dino115/oh-my-embed. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
159
157
|
|
160
|
-
|
161
158
|
## License
|
162
159
|
|
163
160
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
164
|
-
|
data/lib/oh_my_embed.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_support/all'
|
2
2
|
|
3
3
|
Dir.glob(File.join(__dir__, 'oh_my_embed', '*.rb'), &method(:require))
|
4
|
-
Dir.glob(File.join(__dir__, 'oh_my_embed', '
|
4
|
+
Dir.glob(File.join(__dir__, 'oh_my_embed', 'providers', '*.rb'), &method(:require))
|
5
5
|
|
6
6
|
module OhMyEmbed
|
7
7
|
# All OhMyEmbed errors inherits from a generic OhMyEmbed::Error class
|
data/lib/oh_my_embed/response.rb
CHANGED
@@ -106,5 +106,14 @@ module OhMyEmbed
|
|
106
106
|
height: attribute(mapping['embed.height']),
|
107
107
|
}.compact
|
108
108
|
end
|
109
|
+
|
110
|
+
# Return the Hash representation of this response
|
111
|
+
#
|
112
|
+
# @return [Hash] :type, :provider_name, :provider_url, :url, :author, :thumbnail, :embed
|
113
|
+
def to_h
|
114
|
+
%i{ type provider_name provider_url url title author thumbnail embed }.map do |key|
|
115
|
+
[key, self.send(key)]
|
116
|
+
end.to_h
|
117
|
+
end
|
109
118
|
end
|
110
119
|
end
|
data/lib/oh_my_embed/version.rb
CHANGED
@@ -171,4 +171,36 @@ describe OhMyEmbed::Response do
|
|
171
171
|
expect(response.embed[:url]).to eq 'http://www.example.com/my/content'
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
describe '#to_h' do
|
176
|
+
it 'returns a hash' do
|
177
|
+
expect(response.to_h).to be_a Hash
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'includes the required fields' do
|
181
|
+
hash = response.to_h
|
182
|
+
|
183
|
+
expect(hash).to eq({
|
184
|
+
type: :rich,
|
185
|
+
provider_name: 'My awesome example provider',
|
186
|
+
provider_url: 'http://www.example.com',
|
187
|
+
url: 'http://www.example.com/my/content',
|
188
|
+
title: 'My content',
|
189
|
+
author: {
|
190
|
+
name: 'John Doe',
|
191
|
+
url: 'http://www.example.com/users/john.doe',
|
192
|
+
},
|
193
|
+
thumbnail: {
|
194
|
+
url: 'http://www.example.com/images/my-content.png',
|
195
|
+
width: 200,
|
196
|
+
height: 200,
|
197
|
+
},
|
198
|
+
embed: {
|
199
|
+
html: '<iframe src="http://www.example.com/embed/my-content" />',
|
200
|
+
width: 640,
|
201
|
+
height: 480,
|
202
|
+
},
|
203
|
+
})
|
204
|
+
end
|
205
|
+
end
|
174
206
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oh-my-embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Axel Wahlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|