vivid_seat_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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ed71d4aa4406ed96cc4be9e7d7d038b9d3a9071b
4
+ data.tar.gz: 03215ffd02ea6ac4d4622c1e952a94d2c170fe82
5
+ SHA512:
6
+ metadata.gz: 3c74abaf041a61123020457a96fa79e820af015e6e54a053afb9f8779ec229774308407b019a838f49bb18f3bb58126be75e31d776cbe1147de11d310f380f54
7
+ data.tar.gz: eabc1c8ade18071d62ae2d79ca2536053ab69dd70aa2571006720e557ab917f597f28aebe6d984a26bcdf7c03fbbd3e497263ea17079b7430906b952ff95dd47
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vivid_seat_api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 chebyte
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,41 @@
1
+ # VividSeatApi
2
+
3
+ This gem provides access to add, edit and delete listings appearing on Vivid Seats and it’s affiliates.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'vivid_seat_api'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install vivid_seat_api
18
+
19
+ ## Usage
20
+
21
+ client = VividSeatApi::Client.new("your-api-key")
22
+
23
+ client.list(options)
24
+
25
+ client.create(options)
26
+
27
+ client.update(options)
28
+
29
+ client.delete(options)
30
+
31
+ client.insert_or_update(options)
32
+
33
+ note: options params you can check here: https://brokers.vividseats.com/ListingWebServices_v1.pdf
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/hashdog/vivid_seat_api/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,38 @@
1
+ module VividSeatApi
2
+ class Base
3
+ def base_url
4
+ "https://brokers.vividseats.com/webservices/listings/v1/"
5
+ end
6
+
7
+ def make_request_url url, options
8
+ "#{url}?#{builder_options(options)}"
9
+ end
10
+
11
+ def builder_options options
12
+ options.merge!(apiToken: @token)
13
+ to_query(options)
14
+ end
15
+
16
+ def get_query_api url, options
17
+ puts make_request_url(url, options)
18
+ session.get(make_request_url(url, options)).body
19
+ end
20
+
21
+ def post_query_api url, options
22
+ builder_options(options)
23
+ session.post(url, builder_options(options)).body
24
+ end
25
+
26
+ def to_query(options)
27
+ Faraday::Utils.build_nested_query(options)
28
+ end
29
+
30
+ def session
31
+ @connection ||= ::Faraday.new base_url do |conn|
32
+ conn.use Faraday::Response::VividSeat
33
+ conn.adapter Faraday.default_adapter
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,7 @@
1
+ module VividSeatApi
2
+ class Client < Resource
3
+ def initialize(token)
4
+ @token = token
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ module VividSeatApi
2
+ class Resource < Base
3
+ def list(options = {})
4
+ get_query_api("getListings", options)
5
+ end
6
+
7
+ def update
8
+ post_query_api("updateListing", options)
9
+ end
10
+
11
+ def delete
12
+ get_query_api("deleteListing", options)
13
+ end
14
+
15
+ def create
16
+ post_query_api("insertListing", options)
17
+ end
18
+
19
+ def insert_or_update
20
+ post_query_api("insertOrUpdateListing", options)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ #api exception
2
+ class ApiException < StandardError;end
3
+
4
+ module Faraday
5
+ class Response::VividSeat < Response::Middleware
6
+ def parse_body(body)
7
+ Nokogiri::XML(body)
8
+ end
9
+
10
+ def check_status(env)
11
+ status = env[:status].to_s
12
+ if status =~ /^5/
13
+ raise ApiException.new("Bad Token, status #{status}")
14
+ elsif status =~ /^4/
15
+ raise ApiException.new("Error #{status}")
16
+ end
17
+ end
18
+
19
+ def call(environment)
20
+ @app.call(environment).on_complete do |env|
21
+ check_status(env)
22
+ env[:body] = parse_body(env[:body])
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module VividSeatApi
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,18 @@
1
+ #gems
2
+ require 'faraday'
3
+ require 'nokogiri'
4
+
5
+ #libs
6
+ require_relative "vivid_seat_api/version"
7
+ require_relative "vivid_seat_api/response"
8
+ require_relative "vivid_seat_api/base"
9
+ require_relative "vivid_seat_api/resource"
10
+ require_relative "vivid_seat_api/client"
11
+
12
+ module VividSeatApi;end
13
+
14
+ client = VividSeatApi::Client.new("b6a56d39-abc2-4d9c-aa22-06e5632c2ef8")
15
+
16
+
17
+ puts client.create()
18
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vivid_seat_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vivid_seat_api"
8
+ spec.version = VividSeatApi::VERSION
9
+ spec.authors = ["chebyte"]
10
+ spec.email = ["mauro@hashdog.com"]
11
+ spec.summary = %q{Ruby Gem API for vividseats.com.}
12
+ spec.description = %q{This gem provides access to add, edit and delete listings appearing on Vivid Seats and it’s affiliates.}
13
+ spec.homepage = "http://hashdog.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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.6"
22
+ spec.add_development_dependency 'rake', '~> 0'
23
+ spec.add_runtime_dependency 'faraday', '~> 0.9', '>= 0.9.0'
24
+ spec.add_runtime_dependency 'nokogiri', '~> 1.6', '>= 1.6.1'
25
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vivid_seat_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - chebyte
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
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
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.9.0
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.9'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.9.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: nokogiri
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.6'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.6.1
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.6'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.6.1
81
+ description: This gem provides access to add, edit and delete listings appearing on
82
+ Vivid Seats and it’s affiliates.
83
+ email:
84
+ - mauro@hashdog.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - Gemfile
91
+ - LICENSE.txt
92
+ - README.md
93
+ - Rakefile
94
+ - lib/vivid_seat_api.rb
95
+ - lib/vivid_seat_api/base.rb
96
+ - lib/vivid_seat_api/client.rb
97
+ - lib/vivid_seat_api/resource.rb
98
+ - lib/vivid_seat_api/response.rb
99
+ - lib/vivid_seat_api/version.rb
100
+ - vivid_seat_api.gemspec
101
+ homepage: http://hashdog.com
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.2.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Ruby Gem API for vividseats.com.
125
+ test_files: []