event_finda_ruby 0.2.6 → 0.2.7

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: 5b16403f1677b990d73b7626076b15670704a6ee
4
- data.tar.gz: 1be862fca0253479c7088abb9ab38002fe773b43
3
+ metadata.gz: 370fab0d58c70a894b970858689a8883b346aa22
4
+ data.tar.gz: ffcb7d109696f48fe02f56132c404440f5619302
5
5
  SHA512:
6
- metadata.gz: b1b56c82fcd5d2bbd3bf62bf01e5762eac95d08145d7eeb54c9ccd29a7c9eaf7ed1b932aeb96567545c33d402c0c94fe8ff8c07518f40fcd5f2d58bd0aacaade
7
- data.tar.gz: bca8d54b72e7071041456981399c28880268ffdae7f5c0434f88494a4ef5f9d700df3865e7c818df787680ab9c1c5ef2b914ef631264e9a9effdc3ab988bd531
6
+ metadata.gz: f287bd45e692acb7290be55a867b00bed7cf200bc18ce1f1e4ddadd1aaaab9dc1ea7b7b8141f509245b1ef232d8190fa8aa69520e2ebbabc1138684ff3504efe
7
+ data.tar.gz: 3245ba5182d826a616b50bdcd14e736edc89da775a56ed15f8ed0d05c90a94dc2331a49748f10734f4ba9835fee4dbe88cfd5c1cd039cb2234df782b17d6c9fb
@@ -1,6 +1,8 @@
1
1
  module EventFindaRuby
2
2
  class Artists < Base
3
3
 
4
+ RESOURCE_SLUG = "artists".freeze
5
+
4
6
  def by_category(category)
5
7
  apply_filter "category", category
6
8
 
@@ -13,17 +15,5 @@ module EventFindaRuby
13
15
  self
14
16
  end
15
17
 
16
- def results
17
- response = HTTParty.get("#{url}", basic_auth: auth)
18
-
19
- @results = response["artists"]
20
- end
21
-
22
- private
23
-
24
- def base_url
25
- "http://api.eventfinda.co.nz/v2/artists"
26
- end
27
-
28
18
  end
29
19
  end
@@ -3,6 +3,9 @@ require "httparty"
3
3
  class Base
4
4
  include HTTParty
5
5
 
6
+ BASE_URL = "http://api.eventfinda.co.nz/v2/".freeze
7
+ RESOURCE_SLUG = "base"
8
+
6
9
  attr_reader :api_extension
7
10
  attr_reader :auth
8
11
  attr_reader :filters
@@ -37,8 +40,12 @@ class Base
37
40
  self
38
41
  end
39
42
 
43
+ def results
44
+ @results = response["#{self.class::RESOURCE_SLUG}"]
45
+ end
46
+
40
47
  def url
41
- "#{base_url}.#{api_extension}?#{get_filters}"
48
+ "#{BASE_URL}#{self.class::RESOURCE_SLUG}.#{api_extension}?#{get_filters}"
42
49
  end
43
50
 
44
51
  def with_extension(extension)
@@ -55,14 +62,14 @@ class Base
55
62
  filters[filter_name] = value
56
63
  end
57
64
 
58
- def base_url
59
- "http://api.eventfinda.co.nz/v2/base"
60
- end
61
-
62
65
  def get_filters
63
66
  filters.map { |k,v| "#{k}=#{v}" }.join("&")
64
67
  end
65
68
 
69
+ def response
70
+ HTTParty.get("#{url}", basic_auth: auth)
71
+ end
72
+
66
73
  def set_keywords_or(keywords)
67
74
  keywords.join("+OR+")
68
75
  end
@@ -1,17 +1,7 @@
1
1
  module EventFindaRuby
2
2
  class Categories < Artists
3
3
 
4
- def results
5
- response = HTTParty.get("#{url}", basic_auth: auth)
6
-
7
- @results = response["categories"]
8
- end
9
-
10
- private
11
-
12
- def base_url
13
- "http://api.eventfinda.co.nz/v2/categories"
14
- end
4
+ RESOURCE_SLUG = "categories".freeze
15
5
 
16
6
  end
17
7
  end
@@ -1,6 +1,8 @@
1
1
  module EventFindaRuby
2
2
  class Events < Base
3
3
 
4
+ RESOURCE_SLUG = "events".freeze
5
+
4
6
  def by_end_date(end_date)
5
7
  apply_filter "end_date", end_date
6
8
 
@@ -49,17 +51,5 @@ module EventFindaRuby
49
51
  self
50
52
  end
51
53
 
52
- def results
53
- response = HTTParty.get("#{url}", basic_auth: auth)
54
-
55
- @results = response["events"]
56
- end
57
-
58
- private
59
-
60
- def base_url
61
- "http://api.eventfinda.co.nz/v2/events"
62
- end
63
-
64
54
  end
65
55
  end
@@ -1,6 +1,8 @@
1
1
  module EventFindaRuby
2
2
  class Locations < Base
3
3
 
4
+ RESOURCE_SLUG = "locations".freeze
5
+
4
6
  def by_featured
5
7
  apply_filter "featured", 1
6
8
 
@@ -39,12 +41,6 @@ module EventFindaRuby
39
41
  self
40
42
  end
41
43
 
42
- def results
43
- response = HTTParty.get("#{url}", basic_auth: auth)
44
-
45
- @results = response["locations"]
46
- end
47
-
48
44
  def sort_by(option)
49
45
  apply_filter "order", option
50
46
 
@@ -57,11 +53,5 @@ module EventFindaRuby
57
53
  self
58
54
  end
59
55
 
60
- private
61
-
62
- def base_url
63
- "http://api.eventfinda.co.nz/v2/locations"
64
- end
65
-
66
56
  end
67
57
  end
@@ -1,3 +1,3 @@
1
1
  module EventFindaRuby
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
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.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Roldan