tickethub 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tickethub.rb +1 -0
- data/lib/tickethub/collection.rb +3 -1
- data/lib/tickethub/endpoint.rb +4 -0
- data/lib/tickethub/resource.rb +9 -0
- data/lib/tickethub/response.rb +1 -0
- data/lib/tickethub/supplier/booking.rb +4 -0
- data/lib/tickethub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e06af3a67998ddcbe1b041bd3d27afc3ced49e4
|
4
|
+
data.tar.gz: 306960e80996af72bb4954319fe39b0e69890509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8beb3438d3dff5382987d705e29077da85eeda4985c0b12c0c5978366d5f2df07b104e7cf2b8495fe96a0a8675b0a6682b5fa232d6b5eac2d91b6ba44541406b
|
7
|
+
data.tar.gz: 5acc3e4bd03fd3454d52f4ef20d577b82b89725fb0091e31a527f7fcffd5baa0ba2053af1233a3e4382779234194c6330838884dd227f15d49f41d1cf26ecaad
|
data/lib/tickethub.rb
CHANGED
data/lib/tickethub/collection.rb
CHANGED
@@ -22,7 +22,7 @@ module Tickethub
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
klass.scopes.each do |key, block|
|
25
|
+
klass.collection_methods.merge(klass.scopes).each do |key, block|
|
26
26
|
define_singleton_method key, &block
|
27
27
|
end
|
28
28
|
|
@@ -139,6 +139,8 @@ module Tickethub
|
|
139
139
|
self.filter(search).first
|
140
140
|
when Range
|
141
141
|
self.offset(search.min).first(search.max)
|
142
|
+
when Array
|
143
|
+
self.filter(id: search)
|
142
144
|
when String
|
143
145
|
endpoint = self.endpoint[@klass.path, CGI::escape(search)]
|
144
146
|
@klass.load endpoint, endpoint.get(params)
|
data/lib/tickethub/endpoint.rb
CHANGED
@@ -24,6 +24,10 @@ module Tickethub
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def url(params = {})
|
28
|
+
params.any?? "#{@url}?#{Helpers.to_param(params)}" : @url
|
29
|
+
end
|
30
|
+
|
27
31
|
def request(params, options)
|
28
32
|
raise 'this endpoint is readonly' if frozen?
|
29
33
|
Tickethub::Request.new(url, options.merge(params: params)).execute
|
data/lib/tickethub/resource.rb
CHANGED
@@ -35,6 +35,14 @@ module Tickethub
|
|
35
35
|
def descendants
|
36
36
|
@descendants ||= []
|
37
37
|
end
|
38
|
+
|
39
|
+
def collection_methods
|
40
|
+
@collection_methods ||= {}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.collection_method(key, &block)
|
45
|
+
collection_methods[key] = block
|
38
46
|
end
|
39
47
|
|
40
48
|
def self.inherited(descendant)
|
@@ -145,6 +153,7 @@ module Tickethub
|
|
145
153
|
|
146
154
|
def self.load(endpoint, attributes = nil)
|
147
155
|
attributes ||= endpoint.get
|
156
|
+
return attributes if attributes.is_a? Tickethub::Job
|
148
157
|
|
149
158
|
klass = registered_types.find do |type, options|
|
150
159
|
attributes[options[:attribute].to_s] == type
|
data/lib/tickethub/response.rb
CHANGED
@@ -16,6 +16,10 @@ module Tickethub
|
|
16
16
|
require_relative 'extra'
|
17
17
|
require_relative 'fee'
|
18
18
|
|
19
|
+
collection_method :broadcast do |params|
|
20
|
+
Tickethub::Job.load self.endpoint, post(:broadcast, params)
|
21
|
+
end
|
22
|
+
|
19
23
|
collection :answers, Supplier::Answer
|
20
24
|
collection :messages, Supplier::Message
|
21
25
|
collection :extras, Supplier::Extra
|
data/lib/tickethub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tickethub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|