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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b6440a98288968d23998989e8ba33a7ebd70bd9
4
- data.tar.gz: 44cbe838eaec3c3566a035dee1410e002a7953be
3
+ metadata.gz: 0ab522d9659c259073dffa48818759993dbb288a
4
+ data.tar.gz: ff12a874d1081f708b4d8b824ffef3de36230e2e
5
5
  SHA512:
6
- metadata.gz: 7a01291d16ccef99aa2d288a19cd5a530ddc631072d888a34f898807ecd14ae1fb98035551eda3d315d16e4b9856784c94d7bcd752db8916e33c29b1fb930cdd
7
- data.tar.gz: a72be54dd10c097632f66f8a86fb0b319f8d749480cdfbf182f0b5a9487b8db5a9c0a0d23f6effe6d3c6ea3fc1837ca3765163abd1edec61178525aa25db292b
6
+ metadata.gz: f5b55479237216b1f0ae21b2555001efbc6129f8d1a776e749d510d8c5337bb3c31faa01cca4be97fa7bcaa603e2b022bbf637ce1d1ad138639e8c61e47a3b4d
7
+ data.tar.gz: 572188f2e9369dae311f15e2118a11b9829a8b065357fd879871790bc33be89ea3d28a0ed852fb1d10886773e5b72f2a5d7ed8a407ccabffeaad5c84ca5f2bee
data/README.md CHANGED
@@ -8,6 +8,10 @@
8
8
 
9
9
  API wrapper for Yandex Fotki
10
10
 
11
+ ## Requirements
12
+
13
+ * Ruby >= 2.0.0 (create [new issue](https://github.com/1v/yandex-api-fotki/issues/new) if you need 1.9.3)
14
+
11
15
  ## Installation
12
16
 
13
17
  Add this line to your application's Gemfile:
@@ -1,7 +1,7 @@
1
1
  module Yandex
2
2
  module API
3
3
  module Fotki
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
@@ -92,18 +92,24 @@ module Yandex
92
92
  #
93
93
  # List user albums
94
94
  #
95
- # @param [Hash] hash
96
- # @option hash [String] sort updated or rupdated or published or rpublished
97
- # @option hash [Integer] offset Not implemented
98
- # @option hash [Integer] limit 100 is max
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(hash = { :sort => 'updated', :offset => 0, :limit => 10 })
104
- return @list_cache unless @list_cache.nil?
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
- list = RestClient.get("#{Fotki.api_urls.album}#{hash[:sort]}/?limit=#{hash[:limit]}", Fotki.oauth_hash)
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
- private
184
- #
185
- # XML parser wrapper. Because I'm not sure if it be persistent.
186
- #
187
- # @param [String] xml XML input
188
- #
189
- # @return [Hash] Hash
190
- #
191
- def self.xml_to_hash(xml)
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
@@ -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
- spec.add_runtime_dependency "activesupport", "~> 4.0", ">= 4.0.0"
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.2
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-12 00:00:00.000000000 Z
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