iframely 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 +4 -4
- data/Gemfile +1 -1
- data/iframely.gemspec +1 -1
- data/lib/iframely/model.rb +28 -1
- data/lib/iframely/requester.rb +1 -1
- data/lib/iframely/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ed3be38678e776627a35aa4fc57870ce0dd92c
|
4
|
+
data.tar.gz: cf99f8c301b374ff2c7f6b3779cb35452a753ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2517be5c5d1d57199c597ab8b7c213cb87124b855b1f1557bd6de4450e292f7aa86f7558ccd02d25bad66d48685ad5f0f34e7a4fe4c093f530cfe579085e176a
|
7
|
+
data.tar.gz: de700e43c206848d2d0f1079851c7cef2cbf01d42e54c4892cb13e6496d776f8f4a068654b107d3e2433db4608766e7a4a130124644aa3dfffa0ca0bc6bc1226
|
data/Gemfile
CHANGED
data/iframely.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'hashie'
|
21
|
+
spec.add_dependency 'hashie', '~> 2.0'
|
22
22
|
spec.add_dependency 'faraday'
|
23
23
|
|
24
24
|
spec.add_development_dependency "minitest"
|
data/lib/iframely/model.rb
CHANGED
@@ -2,12 +2,39 @@ require 'hashie'
|
|
2
2
|
|
3
3
|
module Iframely
|
4
4
|
class Model < Hashie::Dash
|
5
|
+
|
5
6
|
property :id, required: true
|
6
7
|
property :url, required: true
|
7
8
|
|
8
9
|
property :meta
|
9
10
|
property :links
|
10
11
|
|
11
|
-
property :
|
12
|
+
property :rel
|
13
|
+
|
14
|
+
# Может не быть. Например по ссылке:
|
15
|
+
# https://github.com/imakewebthings/jquery-waypoints
|
16
|
+
property :html
|
17
|
+
|
18
|
+
def self.build json
|
19
|
+
if json.is_a? Hash
|
20
|
+
if json.include?('error')
|
21
|
+
Iframely::ErrorModel.new json
|
22
|
+
else
|
23
|
+
new json
|
24
|
+
end
|
25
|
+
else
|
26
|
+
Iframely::ErrorModel.new error: 'no data'
|
27
|
+
end
|
28
|
+
rescue StandardError => e
|
29
|
+
Iframely::ErrorModel.new error: e.message
|
30
|
+
end
|
31
|
+
|
12
32
|
end
|
33
|
+
|
34
|
+
class ErrorModel < Hashie::Dash
|
35
|
+
# Если он установлен, значит это ошибка и больше смотреть нечего
|
36
|
+
property :error, required: true
|
37
|
+
end
|
38
|
+
|
13
39
|
end
|
40
|
+
|
data/lib/iframely/requester.rb
CHANGED
data/lib/iframely/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iframely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danil Pismenny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,3 +143,4 @@ summary: iframe.ly ruby client
|
|
143
143
|
test_files:
|
144
144
|
- test/iframely_requester_test.rb
|
145
145
|
- test/test_helper.rb
|
146
|
+
has_rdoc:
|