yandex-api-fotki 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/yandex/api/fotki/version.rb +1 -1
- data/lib/yandex/api/fotki.rb +23 -19
- data/yandex-api-fotki.gemspec +6 -1
- metadata +2 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ab522d9659c259073dffa48818759993dbb288a
|
4
|
+
data.tar.gz: ff12a874d1081f708b4d8b824ffef3de36230e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b55479237216b1f0ae21b2555001efbc6129f8d1a776e749d510d8c5337bb3c31faa01cca4be97fa7bcaa603e2b022bbf637ce1d1ad138639e8c61e47a3b4d
|
7
|
+
data.tar.gz: 572188f2e9369dae311f15e2118a11b9829a8b065357fd879871790bc33be89ea3d28a0ed852fb1d10886773e5b72f2a5d7ed8a407ccabffeaad5c84ca5f2bee
|
data/README.md
CHANGED
data/lib/yandex/api/fotki.rb
CHANGED
@@ -92,18 +92,24 @@ module Yandex
|
|
92
92
|
#
|
93
93
|
# List user albums
|
94
94
|
#
|
95
|
-
# @param [Hash]
|
96
|
-
# @option
|
97
|
-
# @option
|
98
|
-
# @option
|
95
|
+
# @param [Hash] options
|
96
|
+
# @option options [String] sort updated or rupdated or published or rpublished
|
97
|
+
# @option options [Integer] offset Not implemented
|
98
|
+
# @option options [Integer] limit 100 is max
|
99
99
|
#
|
100
100
|
# @return [Hash] Hash of Fotki::Album were keys is id of album
|
101
101
|
# @see https://tech.yandex.ru/fotki/doc/operations-ref/albums-collection-get-docpage/
|
102
102
|
#
|
103
|
-
def self.list(
|
104
|
-
|
103
|
+
def self.list(options = {})
|
104
|
+
options[:sort] ||= 'updated'
|
105
|
+
options[:offset] ||= 0
|
106
|
+
options[:limit] ||= 10
|
107
|
+
|
108
|
+
return @list_cache if !@list_cache.nil? && options === @list_options_cache
|
105
109
|
|
106
|
-
|
110
|
+
@list_options_cache = options
|
111
|
+
|
112
|
+
list = RestClient.get("#{Fotki.api_urls.album}#{options[:sort]}/?limit=#{options[:limit]}", Fotki.oauth_hash)
|
107
113
|
|
108
114
|
@list_cache = Fotki.xml_to_hash(list)['feed']['entry']
|
109
115
|
@list_cache = @list_cache.map { |i|
|
@@ -179,18 +185,16 @@ module Yandex
|
|
179
185
|
# puts JSON.pretty_generate(entry)
|
180
186
|
end
|
181
187
|
end
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
Hash.from_xml(xml)
|
193
|
-
end
|
188
|
+
#
|
189
|
+
# XML parser wrapper. Because I'm not sure if it be persistent.
|
190
|
+
#
|
191
|
+
# @param [String] xml XML input
|
192
|
+
#
|
193
|
+
# @return [Hash] Hash
|
194
|
+
#
|
195
|
+
def self.xml_to_hash(xml)
|
196
|
+
Hash.from_xml(xml)
|
197
|
+
end
|
194
198
|
end
|
195
199
|
end
|
196
200
|
end
|
data/yandex-api-fotki.gemspec
CHANGED
@@ -24,7 +24,12 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.required_ruby_version = '>= 2.0.0'
|
25
25
|
|
26
26
|
spec.add_runtime_dependency "rest-client", "~> 2.0", ">= 2.0.0"
|
27
|
-
|
27
|
+
|
28
|
+
if RUBY_VERSION < "2.2.2"
|
29
|
+
spec.add_runtime_dependency "activesupport", "~> 4.0", ">= 4.0.0"
|
30
|
+
else
|
31
|
+
spec.add_runtime_dependency "activesupport", ">= 4.0.0"
|
32
|
+
end
|
28
33
|
|
29
34
|
spec.add_development_dependency "bundler", "~> 1.13"
|
30
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yandex-api-fotki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- github.com/1v
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -34,9 +34,6 @@ dependencies:
|
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '4.0'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 4.0.0
|
@@ -44,9 +41,6 @@ dependencies:
|
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '4.0'
|
50
44
|
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
46
|
version: 4.0.0
|