planvine 0.0.13 → 0.1

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: 6547d51f290be1c452bc78f4467fd924a950cdf5
4
- data.tar.gz: c8996cdc7663759b04e4a19a7fb0e3a867e1e9e3
3
+ metadata.gz: 0c8f3b8a1728cd516340852d1c44a2bdc184e91f
4
+ data.tar.gz: 58689f095df193ae112c1e4d08ea94c2e56cd994
5
5
  SHA512:
6
- metadata.gz: 36b82188885489677c799e7a2626ab537f2235267319cd90af6572ac9787194eb56c98756277e8041a7876c5ae606c90c13dace4385cc72ff0bae2f2a0ca67d0
7
- data.tar.gz: c7dc49b648fa4308acc5252ffb861ee1c506109d8c3d89814f01b1218ff823aad05107fb050c644223ba2aaa1dd42392ef84eadc4a90a339bb225fc702cb12b8
6
+ metadata.gz: 81540f7f65c366296627c433aa3a9cfed1b27b170c20ea7b810c39d1d7467814d6d257283fc59a332bf6a644d8602a9739f3f00f9431a5278067c6c8e8cbf11d
7
+ data.tar.gz: 1456b66c05d771e7e2af5799c44d172672acc473b4fe56c8c187717036913d99cfe6ca70aa18a07cc4d9efcab7c4385556f06e9238eb4528bdcdbcb43e5efcae
@@ -18,12 +18,9 @@ module Planvine
18
18
 
19
19
  def events
20
20
  return [] if api.category_events(id).nil?
21
- api.category_events(id).map do |events|
22
- events.map do |event|
23
- full_event = api.event(event["id"])
24
- EventsBuilder.build(full_event)
25
- end
26
- end.flatten
21
+ api.category_events(id).map do |event|
22
+ EventsBuilder.build(event)
23
+ end
27
24
  end
28
25
 
29
26
  def api
@@ -21,22 +21,8 @@ module Planvine
21
21
  end
22
22
  end
23
23
 
24
- def category_events(id)
25
- begin
26
- number_of_pages = self.class.get("/category/#{id}/events?api_key=#{@api_key}")["_metadata"]["total_pages"]
27
- rescue
28
- number_of_pages = 1
29
- end
30
- events = [self.class.get("/category/#{id}/events?api_key=#{@api_key}")["data"]]
31
- return events if number_of_pages == 1
32
-
33
- self.class.get("/category/#{id}/events?api_key=#{@api_key}")["_metadata"]["total_pages"].times do |i|
34
- next if (i+1) == 1
35
- page = self.class.get("/category/#{id}/events?api_key=#{@api_key}&page=#{i + 1}")["data"]
36
-
37
- events << page
38
- end
39
- events
24
+ def category_events(id, results_count=100)
25
+ self.class.get("/category/#{id}/events?api_key=#{@api_key}&results_per_page=#{results_count}")["data"]
40
26
  end
41
27
 
42
28
  def event(id)
@@ -1,3 +1,3 @@
1
1
  module Planvine
2
- VERSION = "0.0.13"
2
+ VERSION = "0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planvine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Patching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-27 00:00:00.000000000 Z
11
+ date: 2013-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty