simple_eventick_api 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47cfe48612a6f10e5c0fbffd0641576cca515123
4
+ data.tar.gz: 05e0bd07649b762b61907b6eed708d67df45743f
5
+ SHA512:
6
+ metadata.gz: 0c5f6dab1bf1161879648a133f94f15f7a354cd2c448d101c6cf177703a3337c3cf8c5a0b390660a0340d935ceec6e23ff49ca29dc9a6efc3252d5a1ac42c8ca
7
+ data.tar.gz: 59e2839b3a4ecfc6fba5f9630cdad1b8583ef340731ae001f09271bae15e54d4a56d9f311b49f9dac5219a8490c91531e33981353c1f3c0cacf3e1b8f587e369
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in simple_eventick_api.gemspec
4
+ gemspec
5
+ gem 'httparty'
data/Gemfile.lock ADDED
@@ -0,0 +1,23 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ simple_eventick_api (0.0.3)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ httparty (0.12.0)
10
+ json (~> 1.8)
11
+ multi_xml (>= 0.5.2)
12
+ json (1.8.0)
13
+ multi_xml (0.5.5)
14
+ rake (10.1.0)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ bundler (~> 1.3)
21
+ httparty
22
+ rake
23
+ simple_eventick_api!
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Gustavo Porpino
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # SimpleEventickApi
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'simple_eventick_api'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install simple_eventick_api
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,13 @@
1
+ module SimpleEventickApi
2
+ class Base
3
+
4
+ def self.resource(res)
5
+ @resource = res
6
+ end
7
+
8
+ def self.get(opts)
9
+ SimpleEventickApi.get(@resource, opts)
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,38 @@
1
+ require_relative 'base'
2
+
3
+ module SimpleEventickApi
4
+ class Event < Base
5
+ resource "events"
6
+
7
+ attr_accessor :id, :start_at, :title, :tickets, :venue, :slug
8
+ attr_reader :attendees, :all
9
+
10
+ # constructors
11
+ def initialize(args={})
12
+ links = args.delete('links')
13
+ args.each do |key, value|
14
+ self.public_send("#{key}=", value)
15
+ end
16
+
17
+ # self.tickets = links['tickets'].map { |o| Ticket.new(o) } if links
18
+ end
19
+
20
+ def self.all (token)
21
+ opts = {
22
+ basic_auth: {
23
+ username: token
24
+ }
25
+ }
26
+ response = get(opts)
27
+
28
+ events = Array.new
29
+ response['events'].map { |r|
30
+ e = self.new (r)
31
+ events << e
32
+ }
33
+ events
34
+ end
35
+
36
+
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleEventickApi
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,22 @@
1
+ require "simple_eventick_api/version"
2
+ require 'simple_eventick_api/base'
3
+ require 'simple_eventick_api/event'
4
+
5
+ module SimpleEventickApi
6
+
7
+ BASE_URL = 'www.eventick.com.br/api'
8
+ API_VERSION = 'v1'
9
+
10
+ def self.get(resource, opts)
11
+ url = "https://#{BASE_URL}/#{API_VERSION}/#{resource}.json"
12
+
13
+ response = HTTParty.get(url, opts)
14
+ parse(response.body)
15
+ end
16
+
17
+ private
18
+ def self.parse (body)
19
+ JSON.parse(body)
20
+ end
21
+
22
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'simple_eventick_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "simple_eventick_api"
8
+ spec.version = SimpleEventickApi::VERSION
9
+ spec.authors = ["Gustavo Porpino"]
10
+ spec.email = ["gporpino@gmail.com"]
11
+ spec.description = %q{It`s a very simple api to use eventick services}
12
+ spec.summary = %q{It`s a very simple api to use eventick services}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_eventick_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Gustavo Porpino
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-16 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: It`s a very simple api to use eventick services
42
+ email:
43
+ - gporpino@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .DS_Store
49
+ - .gitignore
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/simple_eventick_api.rb
56
+ - lib/simple_eventick_api/base.rb
57
+ - lib/simple_eventick_api/event.rb
58
+ - lib/simple_eventick_api/version.rb
59
+ - simple_eventick_api.gemspec
60
+ homepage: ''
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.0.6
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: It`s a very simple api to use eventick services
84
+ test_files: []