eventbrite_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjI5Mjg0ZmM3OTY3ZjZjMmI3YThkY2ZiYWVjYTVlOTc1NDRiYjE2Ng==
5
+ data.tar.gz: !binary |-
6
+ MGU4Y2YwZjdhYzIyYmQxYWVkODRmZTE1MGJmYmQ2NmQ0Nzc2NTYyOQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ M2YxYzNhNmY0YmMzNTA0NmQ3MGU1MzRlNWM3NzQwZTZlNzE0Nzg5ZTlhMzg2
10
+ Njg3MGM1MTJkZDBmZGUzMThmYTYzN2MwZTFjZTZlYThmNmI0NDQ2NjE0NDFh
11
+ ZTA3MzI2NGU3ZDQwZGM4NmQxYmI4ZGJlN2RmZGRhMTk5NGUzNTA=
12
+ data.tar.gz: !binary |-
13
+ MjY5Y2M1MDMyM2RjYWIyNjljNDUyNGJkMTA5MTM0NDNiZWM0ZjQ4MzZkNWE4
14
+ ZTY3YWJkYWZlN2YyYmY4ZjYyZTA3ODhiMWNkNzExYWIyNDY4NTEwNzAyZmM4
15
+ NWE5MTJlNDVlN2U4ZTM5MmNkYmY4MzRkNTRmNzc5MTA1MTU0NmI=
data/ReadMe.md ADDED
@@ -0,0 +1,54 @@
1
+ This gem is for Eventbrite V3 API only.
2
+
3
+ # Get Started
4
+
5
+ gem install eventbrite-api
6
+
7
+ For Rails project:
8
+
9
+ add gem 'eventbrite-api' to your Gemfile.
10
+ add ``EventbriteAPI::Configuration.access_token="your-oauth-token"`` in initializers.
11
+
12
+ ## Quick examples
13
+
14
+ ``@eb = EventbriteAPI.new``
15
+
16
+ ### For Event API call:
17
+ ``@event = @eb.events(id: 123456)``
18
+
19
+ Get event details: ``@event.get``
20
+
21
+ Get event attendees: ``@event.attendees.get``
22
+
23
+ For a specific attendee: ``@event.attendees(id: 1234567).get``
24
+
25
+ Use options: ``@event.attendees(status: "attending").get``
26
+
27
+ Get event teams: ``@event.teams.get``
28
+
29
+ Get event team attendees: ``@event.teams(id: 123456).attendees.get``
30
+
31
+ ### For User API call:
32
+
33
+ When using personal OAuth token:
34
+ ``@user = @eb.users(id: "me")``
35
+
36
+ When using a third party OAuth token:
37
+ ``@user = @eb.users(id: third_party_user_id)``
38
+
39
+ OAuth token needs to be updated before making an API call on behalf of a third party:
40
+ ``EventbriteAPI::Configuration.access_token="third-party-user-oauth-token"``
41
+
42
+ Get user details: ``@user.get``
43
+
44
+ Get user team attendees: ``@user.owned_event_attendees.get``
45
+
46
+ ### For Order API call:
47
+
48
+ ``@order = @eb.orders(id: 123456)``
49
+ ``@order.get``
50
+
51
+ This gem also provides ``.post`` request as well as the ``.get`` above, but the V3 API is still in preview status and doesn't seem to recognize the arguments in the documentation for POST request.
52
+
53
+ For more information about V3 API, please visit http://developer.eventbrite.com/docs/.
54
+
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "eventbrite_api"
3
+ s.authors = ["Xin Fan (Fred)"]
4
+ s.version = "0.0.1"
5
+ s.email = "fredxinfan@gmail.com"
6
+ s.summary = "A simple API wrapper for Eventbrite V3."
7
+ s.files = [
8
+ "ReadMe.md",
9
+ "eventbrite_api.gemspec",
10
+ "lib/eventbrite_api.rb",
11
+ "lib/eventbrite_api/configuration.rb",
12
+ "lib/eventbrite_api/request.rb",
13
+ "lib/eventbrite_api/response.rb"
14
+ ]
15
+
16
+ s.add_dependency("httparty",[">= 0"])
17
+ s.add_dependency("json",[">= 0"])
18
+ end
@@ -0,0 +1,18 @@
1
+ require "httparty"
2
+ require "json"
3
+ require "eventbrite_api/configuration"
4
+ require "eventbrite_api/response"
5
+ require "eventbrite_api/request"
6
+
7
+ class EventbriteAPI
8
+
9
+ def method_missing(method, *args)
10
+ params = args[0].is_a?(Hash) ? args[0] : {}
11
+ raise MissingIdException.new("#{method.capitalize} id can not be empty.") unless params[:id]
12
+ path = "/#{method}/#{params.delete(:id)}?token=#{Configuration.access_token}"
13
+ Request.new(path, params)
14
+ end
15
+
16
+ class APIException < ::Exception; end
17
+ class MissingIdException < APIException; end
18
+ end
@@ -0,0 +1,11 @@
1
+ class EventbriteAPI
2
+ class Configuration
3
+ class << self
4
+ attr_accessor :access_token
5
+
6
+ def end_point
7
+ "https://www.eventbriteapi.com/v3"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,35 @@
1
+ class EventbriteAPI
2
+ class Request
3
+ include HTTParty
4
+ base_uri Configuration.end_point
5
+
6
+ attr_accessor :path, :query
7
+
8
+ def initialize(path = "", query = {})
9
+ @path = path
10
+ @query = query
11
+ end
12
+
13
+ def get
14
+ response = self.class.get(path, query: query).body
15
+ Response.new(response)
16
+ end
17
+
18
+ def post
19
+ response = self.class.post(path, query: query).body
20
+ Response.new(response)
21
+ end
22
+
23
+ def method_missing(method, *args)
24
+ params = args[0].is_a?(Hash) ? args[0] : {}
25
+ route, token = path.split("?")
26
+ id = params.delete(:id)
27
+ route += "/#{method}/#{id}?#{token}"
28
+ Request.new(route, params)
29
+ end
30
+
31
+ # def call(path, params)
32
+ # JSON.parse(self.class.send(params.delete(:method), path, query: params).body)
33
+ # end
34
+ end
35
+ end
@@ -0,0 +1,9 @@
1
+ class EventbriteAPI
2
+ class Response
3
+ attr_accessor :body
4
+
5
+ def initialize(json)
6
+ @body = JSON.parse(json)
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eventbrite_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Xin Fan (Fred)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email: fredxinfan@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ReadMe.md
48
+ - eventbrite_api.gemspec
49
+ - lib/eventbrite_api.rb
50
+ - lib/eventbrite_api/configuration.rb
51
+ - lib/eventbrite_api/request.rb
52
+ - lib/eventbrite_api/response.rb
53
+ homepage:
54
+ licenses: []
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.1.11
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: A simple API wrapper for Eventbrite V3.
76
+ test_files: []