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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c281bfedf04744b27ddaf85f0c96037f1b2aae6
4
- data.tar.gz: 8d678713a9f12d6d7071ac2bd0e6e3b4303b0c0c
3
+ metadata.gz: ca281a34d89f13fad4cfac3e528c1eb4c8285ddd
4
+ data.tar.gz: 1d40c88ffeadf0a4d6f1f97faae0bb694dde5c63
5
5
  SHA512:
6
- metadata.gz: ec9702110334c2228caeee3bbbe7387c7bf1d1707ed19b4da8451b156aa84abab28dafc0e1ba3be3d879b986dcc55244d1b242195d4c3983d32e0186f4e526ea
7
- data.tar.gz: 0dda21187118053a3603b6409883ce18644c04712d793eca6ba97ffc6840f388a2c96a7c338a7796a6bc9d676d24371fe3f9240148290089db8fcd6b16901807
6
+ metadata.gz: 76f2b53a8a9d90329e51e0431fc0d6317d681af64f8e2ad59dc6fe7149b15f4b8d92e79b81d740306f77164f192ed4916834c9c2e4131e380ef54ed37f84caf8
7
+ data.tar.gz: 91345f89fc0ab2cdcf0f7cdce47c9f343be481b5859e47a89dd0888339506912d45f65b72c915e32ae12b81b824319f43dbcab0193ac93a0d84bab4e9493b82f
@@ -1,4 +1,4 @@
1
- class Organizer
1
+ module Organizer
2
2
  class Config
3
3
  class << self
4
4
  attr_accessor :access_token
@@ -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
@@ -1,4 +1,4 @@
1
- class Organizer
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
- response = api.post(path, query: query).body
17
- Response.new(response)
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: query).body
32
+ response = api.delete(path, query).body
22
33
  Response.new(response)
23
34
  end
24
35
 
@@ -1,4 +1,4 @@
1
- class Organizer
1
+ module Organizer
2
2
  class Response
3
3
  attr_accessor :body
4
4
 
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
- class Organizer
7
- def method_missing(method, *args)
8
- params = args[0].is_a?(Hash) ? args[0] : {}
9
- raise MissingIdException.new("#{method.capitalize} id can not be empty.") unless params[:id]
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
- class APIException < ::Exception; end
15
- class MissingIdException < APIException; end
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.1
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-14 00:00:00.000000000 Z
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.6
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.6
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: An api consumer gem for Eventbrite V3 API using Faraday
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