evtfl 0.1.1
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/evtfl.gemspec +28 -0
- data/lib/evtfl.rb +19 -0
- data/lib/evtfl/artist.rb +32 -0
- data/lib/evtfl/concerts.rb +24 -0
- data/lib/evtfl/version.rb +3 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c26c1bcdb7ad67121137afaca7bd66358a9847f
|
4
|
+
data.tar.gz: abeac6bbb70b38c8d051674e1ee6e3518d2fc8d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc92d923506a755ed83d86e68558f986142af6338be13a907417b1646cbe454c120d0ca33c53799374b8acd3290a165bbaff41e95a19d3f5535f1b9860add44e
|
7
|
+
data.tar.gz: e87ae9ad789be6fa75bb4c1f80ca06728fd8834ba0f2e571ad2a39620cab172214c6c76b6c01058d3c872f0ac4a1f416615cc9a1221bba2ae47aa007da49636c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Evtfl
|
2
|
+
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'evtfl'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install evtfl
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```rb
|
23
|
+
# add your api key from Eventful
|
24
|
+
|
25
|
+
Eventful.configure('my_api_key')
|
26
|
+
|
27
|
+
# then search a band
|
28
|
+
|
29
|
+
radiohead = Eventful::Artist.search('radiohead')
|
30
|
+
|
31
|
+
# will return "A valid application key is required." if there is no valid api_key
|
32
|
+
# otherwise will return an Artist class with the following attributes:
|
33
|
+
# name
|
34
|
+
# short_bio
|
35
|
+
# id
|
36
|
+
# url
|
37
|
+
|
38
|
+
# now search concerts
|
39
|
+
|
40
|
+
radiohead.concerts
|
41
|
+
|
42
|
+
# the concerts will be in an array you can loop over
|
43
|
+
# concerts have the following attributes:
|
44
|
+
# country
|
45
|
+
# city
|
46
|
+
# url
|
47
|
+
# title
|
48
|
+
# id
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
The artist fetched will be the most popular with the name provided. There are rare circumstances where it won't be your desired artist.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "evtfl"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/evtfl.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "evtfl/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "evtfl"
|
8
|
+
spec.version = Evtfl::VERSION
|
9
|
+
spec.authors = ["tobyond"]
|
10
|
+
spec.email = [""]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby gem for accessiong Eventful api}
|
13
|
+
spec.description = %q{Search bands and concerts}
|
14
|
+
spec.homepage = "https://github.com/tobyond/evtfl"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "webmock"
|
28
|
+
end
|
data/lib/evtfl.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require 'evtfl/version'
|
5
|
+
require 'evtfl/artist'
|
6
|
+
require 'evtfl/concerts'
|
7
|
+
|
8
|
+
|
9
|
+
module Evtfl
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :api_key
|
13
|
+
|
14
|
+
def configure(key)
|
15
|
+
@api_key = key
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/evtfl/artist.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Evtfl
|
2
|
+
|
3
|
+
PRE = 'https://api.eventful.com/json/performers'
|
4
|
+
|
5
|
+
class Artist
|
6
|
+
|
7
|
+
def self.search(name)
|
8
|
+
url = "#{PRE}/search?app_key=#{Evtfl.api_key}&keywords=#{name}"
|
9
|
+
uri = URI(url)
|
10
|
+
response = Net::HTTP.get(uri)
|
11
|
+
result = JSON.parse(response)
|
12
|
+
# "A valid application key is required."
|
13
|
+
return result['description'] if result['status'] == 'Authentication Error'
|
14
|
+
return result['description'] if result['status'] == 'Missing parameter'
|
15
|
+
new(result['performers']['performer'][0])
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :name, :short_bio, :id, :url
|
19
|
+
|
20
|
+
def initialize(args = {})
|
21
|
+
@name = args['name']
|
22
|
+
@short_bio = args['short_bio']
|
23
|
+
@id = args['id']
|
24
|
+
@url = args['url']
|
25
|
+
end
|
26
|
+
|
27
|
+
def concerts
|
28
|
+
Evtfl::Concerts.list(id)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Evtfl
|
2
|
+
|
3
|
+
class Concerts
|
4
|
+
|
5
|
+
def self.list(id)
|
6
|
+
url = "#{PRE}/events/list?app_key=#{Evtfl.api_key}&id=#{id}&page_size=100"
|
7
|
+
uri = URI(url)
|
8
|
+
response = Net::HTTP.get(uri)
|
9
|
+
result = JSON.parse(response)
|
10
|
+
result['event'].map { |show| new(show) }
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :country, :city, :url, :title, :id
|
14
|
+
|
15
|
+
def initialize(args = {})
|
16
|
+
@country = args['country']
|
17
|
+
@city = args['city']
|
18
|
+
@url = args['url']
|
19
|
+
@title = args['title']
|
20
|
+
@id = args['id']
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: evtfl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tobyond
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Search bands and concerts
|
70
|
+
email:
|
71
|
+
- ''
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- evtfl.gemspec
|
86
|
+
- lib/evtfl.rb
|
87
|
+
- lib/evtfl/artist.rb
|
88
|
+
- lib/evtfl/concerts.rb
|
89
|
+
- lib/evtfl/version.rb
|
90
|
+
homepage: https://github.com/tobyond/evtfl
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.5.1
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Ruby gem for accessiong Eventful api
|
114
|
+
test_files: []
|