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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d85ce6fb09a8b3f3d37a9afd8ebe76cb0e8a690
4
- data.tar.gz: d6767ac4f0be24979004f084c3f34152511b46f3
3
+ metadata.gz: 99ed3be38678e776627a35aa4fc57870ce0dd92c
4
+ data.tar.gz: cf99f8c301b374ff2c7f6b3779cb35452a753ee5
5
5
  SHA512:
6
- metadata.gz: a1b2d3a45ca1cf95bd7237aec31d8616d459d9d77c7adcf9d36c343b2f39e463cceeb07d984b120691eef7c1a324a99e572531b6f37ca95b66c801293ea65eaa
7
- data.tar.gz: 7618adc31fc435ef1382aaf3342d49b31a0b8fc0990c568748d853d68257a74d6869649127c67f75bd39f517c515ae6f7e67c30f821918e4fbffa4c986a079f1
6
+ metadata.gz: 2517be5c5d1d57199c597ab8b7c213cb87124b855b1f1557bd6de4450e292f7aa86f7558ccd02d25bad66d48685ad5f0f34e7a4fe4c093f530cfe579085e176a
7
+ data.tar.gz: de700e43c206848d2d0f1079851c7cef2cbf01d42e54c4892cb13e6496d776f8f4a068654b107d3e2433db4608766e7a4a130124644aa3dfffa0ca0bc6bc1226
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'faraday'
7
- gem 'hashie'
7
+ gem 'hashie', '~> 2.0'
8
8
 
9
9
  #group :development do
10
10
  #gem 'minitest'
@@ -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"
@@ -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 :html, required: true
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
+
@@ -33,7 +33,7 @@ module Iframely
33
33
  if json.has_key? 'error'
34
34
  raise Iframely::Error, json['error']
35
35
  else
36
- Iframely::Model.new json
36
+ Iframely::Model.build json
37
37
  end
38
38
  end
39
39
 
@@ -1,3 +1,3 @@
1
1
  module Iframely
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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-07-12 00:00:00.000000000 Z
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: