organizer 0.0.1 → 0.0.3
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 +4 -4
- data/lib/organizer/config.rb +1 -1
- data/lib/organizer/event.rb +33 -0
- data/lib/organizer/request.rb +16 -5
- data/lib/organizer/response.rb +1 -1
- data/lib/organizer.rb +17 -9
- data/test/dummy/config/application.rb +1 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca281a34d89f13fad4cfac3e528c1eb4c8285ddd
|
4
|
+
data.tar.gz: 1d40c88ffeadf0a4d6f1f97faae0bb694dde5c63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f2b53a8a9d90329e51e0431fc0d6317d681af64f8e2ad59dc6fe7149b15f4b8d92e79b81d740306f77164f192ed4916834c9c2e4131e380ef54ed37f84caf8
|
7
|
+
data.tar.gz: 91345f89fc0ab2cdcf0f7cdce47c9f343be481b5859e47a89dd0888339506912d45f65b72c915e32ae12b81b824319f43dbcab0193ac93a0d84bab4e9493b82f
|
data/lib/organizer/config.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Organizer
|
2
|
+
class Event
|
3
|
+
attr_accessor :name, :description, :start, :end, :online_event, :hash
|
4
|
+
|
5
|
+
def initialize(params={})
|
6
|
+
params.each do |attr, value|
|
7
|
+
self.public_send("#{attr}=", value)
|
8
|
+
end
|
9
|
+
|
10
|
+
self.hash =
|
11
|
+
{
|
12
|
+
name: {
|
13
|
+
html: self.name
|
14
|
+
},
|
15
|
+
description: {
|
16
|
+
html: self.description
|
17
|
+
},
|
18
|
+
start: {
|
19
|
+
timezone: Time.zone.tzinfo.name,
|
20
|
+
utc: self.start.utc.iso8601
|
21
|
+
},
|
22
|
+
:end => {
|
23
|
+
timezone: Time.zone.tzinfo.name,
|
24
|
+
utc: self.end.utc.iso8601
|
25
|
+
},
|
26
|
+
currency: "MYR",
|
27
|
+
online_event: self.online_event
|
28
|
+
}
|
29
|
+
|
30
|
+
super()
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/organizer/request.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
module Organizer
|
2
2
|
class Request
|
3
3
|
attr_accessor :path, :query
|
4
4
|
|
@@ -8,17 +8,28 @@ class Organizer
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def get
|
11
|
-
response = api.get(path).body
|
11
|
+
response = api.get(path, query).body
|
12
12
|
Response.new(response)
|
13
13
|
end
|
14
14
|
|
15
15
|
def post
|
16
|
-
|
17
|
-
|
16
|
+
api.post do |req|
|
17
|
+
req.url path
|
18
|
+
req.headers['Content-Type'] = 'application/json'
|
19
|
+
req.body = query.to_json
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def put
|
24
|
+
api.put do |req|
|
25
|
+
req.url path
|
26
|
+
req.headers['Content-Type'] = 'application/json'
|
27
|
+
req.body = query.to_json
|
28
|
+
end
|
18
29
|
end
|
19
30
|
|
20
31
|
def delete
|
21
|
-
response = api.delete(path, query
|
32
|
+
response = api.delete(path, query).body
|
22
33
|
Response.new(response)
|
23
34
|
end
|
24
35
|
|
data/lib/organizer/response.rb
CHANGED
data/lib/organizer.rb
CHANGED
@@ -3,14 +3,22 @@ Dir[File.dirname(__FILE__) + '/organizer/*.rb'].each do |file|
|
|
3
3
|
require file
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
path = "#{method}/#{params.delete(:id)}/"
|
11
|
-
Request.new(path, params)
|
12
|
-
end
|
6
|
+
module Organizer
|
7
|
+
class Organize
|
8
|
+
def method_missing(method, *args)
|
9
|
+
params = args[0].is_a?(Hash) ? args[0] : {}
|
13
10
|
|
14
|
-
|
15
|
-
|
11
|
+
# raise MissingIdException.new("#{method.capitalize} id can not be empty.") unless params[:id]
|
12
|
+
path = "#{method}/"
|
13
|
+
|
14
|
+
if params[:id]
|
15
|
+
path = path + "#{params.delete(:id)}/"
|
16
|
+
end
|
17
|
+
|
18
|
+
Request.new(path, params)
|
19
|
+
end
|
20
|
+
|
21
|
+
class APIException < ::Exception; end
|
22
|
+
class MissingIdException < APIException; end
|
23
|
+
end
|
16
24
|
end
|
@@ -9,6 +9,7 @@ require "organizer"
|
|
9
9
|
module Dummy
|
10
10
|
class Application < Rails::Application
|
11
11
|
Organizer::Config.access_token=ENV['EVENTBRITEAPIKEY']
|
12
|
+
config.time_zone = 'Kuala Lumpur'
|
12
13
|
# Settings in config/environments/* take precedence over those specified here.
|
13
14
|
# Application configuration should go into files in config/initializers
|
14
15
|
# -- all .rb files in that directory are automatically loaded.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Imran Ismail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: An API consumer for Eventbrite APIV3 using Faraday
|
42
42
|
email:
|
43
43
|
- imran.codely@gmail.com
|
44
44
|
executables: []
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- lib/organizer.rb
|
51
51
|
- lib/organizer/config.rb
|
52
|
+
- lib/organizer/event.rb
|
52
53
|
- lib/organizer/request.rb
|
53
54
|
- lib/organizer/response.rb
|
54
55
|
- lib/tasks/organizer_tasks.rake
|
@@ -113,7 +114,7 @@ rubyforge_project:
|
|
113
114
|
rubygems_version: 2.2.2
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
|
-
summary:
|
117
|
+
summary: Eventbrite API Consumer
|
117
118
|
test_files:
|
118
119
|
- test/dummy/app/assets/javascripts/application.js
|
119
120
|
- test/dummy/app/assets/stylesheets/application.css
|