event_finda_ruby 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71803acdd2a022f323cbe805482b8f1fcbab2edc
4
- data.tar.gz: 5a7f5736c027be91794b7a263566458a4b27fe27
3
+ metadata.gz: 55465f7dd941064b81c3478a028ea817407680e5
4
+ data.tar.gz: 631f14f495ba55f6e19a640db2e7016c34ede19f
5
5
  SHA512:
6
- metadata.gz: 26bf303b040b28e039d88b2d89ddf8abbd3c7108450b80b79f50f4821a4f5acc4bf393a384cffd6033e8dc632f0198738ea81fb459b097223412890567cdc89c
7
- data.tar.gz: 1d184025885c34402d79ced0c15205a494937ba351aa11999ca1c2388f1d1096140a10ae2471430bb44c8421dbadfa10a9522fc3cc18c886e280016c5b68ac22
6
+ metadata.gz: eb0ae829950d7b52724ca1297fbb6e02e8f98c3b791cc80b75b260ccd2233e85ffb40c297bc27a5a445466c2c55a1ddfecc2933ddd6def93219e6b64f7580cf6
7
+ data.tar.gz: 84592aa39d573b4f36b9fba580a597aa89493e8d4094fd9185c354fdefcb9ac6c86d6ba6622c5c45ac60bf0def0c5e7f258926fd700c006bac7d948b728ce0f0
@@ -1,8 +1,6 @@
1
1
  module EventFindaRuby
2
2
  class Artists < Base
3
3
 
4
- BASE_URL = "http://api.eventfinda.co.nz/v2/artists".freeze
5
-
6
4
  def by_category(category)
7
5
  apply_filter "category", category
8
6
 
@@ -21,5 +19,11 @@ module EventFindaRuby
21
19
  @results = response["artists"]
22
20
  end
23
21
 
22
+ private
23
+
24
+ def base_url
25
+ "http://api.eventfinda.co.nz/v2/artists"
26
+ end
27
+
24
28
  end
25
29
  end
@@ -3,8 +3,6 @@ require "httparty"
3
3
  class Base
4
4
  include HTTParty
5
5
 
6
- BASE_URL = "http://api.eventfinda.co.nz/v2/events".freeze
7
-
8
6
  attr_reader :api_extension
9
7
  attr_reader :auth
10
8
  attr_reader :filters
@@ -40,7 +38,7 @@ class Base
40
38
  end
41
39
 
42
40
  def url
43
- "#{BASE_URL}.#{api_extension}?#{get_filters}"
41
+ "#{base_url}.#{api_extension}?#{get_filters}"
44
42
  end
45
43
 
46
44
  def with_extension(extension)
@@ -57,6 +55,10 @@ class Base
57
55
  filters[filter_name] = value
58
56
  end
59
57
 
58
+ def base_url
59
+ "http://api.eventfinda.co.nz/v2/base"
60
+ end
61
+
60
62
  def get_filters
61
63
  filters.map { |k,v| "#{k}=#{v}" }.join("&")
62
64
  end
@@ -1,13 +1,17 @@
1
1
  module EventFindaRuby
2
2
  class Categories < Artists
3
3
 
4
- BASE_URL = "http://api.eventfinda.co.nz/v2/categories".freeze
5
-
6
4
  def results
7
5
  response = HTTParty.get("#{url}", basic_auth: auth)
8
6
 
9
7
  @results = response["categories"]
10
8
  end
11
9
 
10
+ private
11
+
12
+ def base_url
13
+ "http://api.eventfinda.co.nz/v2/categories"
14
+ end
15
+
12
16
  end
13
17
  end
@@ -1,8 +1,6 @@
1
1
  module EventFindaRuby
2
2
  class Events < Base
3
3
 
4
- BASE_URL = "http://api.eventfinda.co.nz/v2/events".freeze
5
-
6
4
  def by_end_date(end_date)
7
5
  apply_filter "end_date", end_date
8
6
 
@@ -21,14 +19,12 @@ module EventFindaRuby
21
19
  self
22
20
  end
23
21
 
24
- # price_max format "35.0" or "35"
25
22
  def by_price_max(price_max)
26
23
  apply_filter "price_max", price_max
27
24
 
28
25
  self
29
26
  end
30
27
 
31
- # price_min format "35.0" or "35"
32
28
  def by_price_min(price_min)
33
29
  apply_filter "price_min", price_min
34
30
 
@@ -59,5 +55,11 @@ module EventFindaRuby
59
55
  @results = response["events"]
60
56
  end
61
57
 
58
+ private
59
+
60
+ def base_url
61
+ "http://api.eventfinda.co.nz/v2/events"
62
+ end
63
+
62
64
  end
63
65
  end
@@ -0,0 +1,46 @@
1
+ module EventFindaRuby
2
+ class Locations < Base
3
+
4
+ def by_featured
5
+ apply_filter "featured", 1
6
+
7
+ self
8
+ end
9
+
10
+ def sort_by(option)
11
+ case option
12
+ when "popularity"
13
+ apply_filter "order", option
14
+ when "distance"
15
+ end
16
+
17
+ self
18
+ end
19
+
20
+ def child_locations_from(location_id)
21
+ apply_filter "location", location_id
22
+
23
+ self
24
+ end
25
+
26
+ def with_level(level)
27
+ apply_filter "levels", level
28
+
29
+ self
30
+ end
31
+
32
+
33
+ def results
34
+ response = HTTParty.get("#{url}", basic_auth: auth)
35
+
36
+ @results = response["locations"]
37
+ end
38
+
39
+ private
40
+
41
+ def base_url
42
+ "http://api.eventfinda.co.nz/v2/locations"
43
+ end
44
+
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module EventFindaRuby
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "event_finda_ruby/version"
2
2
  require "event_finda_ruby/base"
3
- require "event_finda_ruby/events"
4
3
  require "event_finda_ruby/artists"
5
4
  require "event_finda_ruby/categories"
5
+ require "event_finda_ruby/events"
6
+ require "event_finda_ruby/locations"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_finda_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Roldan
@@ -35,6 +35,7 @@ files:
35
35
  - lib/event_finda_ruby/base.rb
36
36
  - lib/event_finda_ruby/categories.rb
37
37
  - lib/event_finda_ruby/events.rb
38
+ - lib/event_finda_ruby/locations.rb
38
39
  - lib/event_finda_ruby/version.rb
39
40
  homepage: http://rubygems.org/gems/event_finda_ruby
40
41
  licenses: