eventbrite_sdk 3.2.0 → 3.3.0
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/eventbrite_sdk/resource/operations/endpoint.rb +24 -10
- data/lib/eventbrite_sdk/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: b4a826c30316dbbbfff3b4944584433428451116
|
4
|
+
data.tar.gz: 23970a9c05222ecc9bf55ee6118db5294b2a9b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e62aa9e14122b877fa65dda9a06d516db8e3140543ffe6d7b3b7c9e90a7d70fba714e66becee1e9206eb3da3dad14e9aceb3ad8284e466cd4309d69f7e530f5c
|
7
|
+
data.tar.gz: c601ac21a8c439e13fde9459522e05da0a14888a65861ce2ed2e847fe30a9b6332b76796abf8a464334bc7db2380b3b98c939f07f7ba0c05c2da84cb9ef5e2ec
|
@@ -3,8 +3,6 @@ module EventbriteSDK
|
|
3
3
|
module Operations
|
4
4
|
module Endpoint
|
5
5
|
module ClassMethods
|
6
|
-
attr_reader :path, :path_opts
|
7
|
-
|
8
6
|
# Retrieve a resource.
|
9
7
|
#
|
10
8
|
# params: Hash of supported parameters. The keys and values are
|
@@ -30,8 +28,8 @@ module EventbriteSDK
|
|
30
28
|
# This tells the resource to replace the :id placeholder with the
|
31
29
|
# value 1234. It also will pass the :expand option with the
|
32
30
|
def retrieve(params, request = EventbriteSDK)
|
33
|
-
url_path = params.reduce(
|
34
|
-
|
31
|
+
url_path = params.reduce(path) do |path_config, (key, value)|
|
32
|
+
path_config.gsub(":#{key}", value.to_s)
|
35
33
|
end
|
36
34
|
|
37
35
|
api_token = params.fetch(:api_token, nil)
|
@@ -55,21 +53,37 @@ module EventbriteSDK
|
|
55
53
|
# requires those parameters to build the correct resource url path.
|
56
54
|
# See the retrieve method (above) for additional details.
|
57
55
|
def resource_path(path)
|
58
|
-
|
56
|
+
if path.is_a?(Hash)
|
57
|
+
@paths = path
|
58
|
+
else
|
59
|
+
@paths = { create: path, update: path }
|
60
|
+
end
|
61
|
+
|
62
|
+
define_path_methods
|
63
|
+
end
|
59
64
|
|
60
|
-
|
61
|
-
|
65
|
+
def define_path_methods
|
66
|
+
@paths.values.each do |path_config|
|
67
|
+
path_config.scan(/:\w+/).each do |path_attr|
|
68
|
+
attr = path_attr.delete(':').to_sym
|
62
69
|
|
63
|
-
|
64
|
-
@attrs[attr] if @attrs.respond_to?(attr)
|
70
|
+
define_method(attr) { @attrs[attr] if @attrs.respond_to?(attr) }
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
74
|
+
|
75
|
+
def path(is_create = false)
|
76
|
+
if is_create
|
77
|
+
@paths[:create]
|
78
|
+
else
|
79
|
+
@paths[:update]
|
80
|
+
end
|
81
|
+
end
|
68
82
|
end
|
69
83
|
|
70
84
|
module InstanceMethods
|
71
85
|
def path(postfixed_path = '')
|
72
|
-
resource_path = self.class.path.dup
|
86
|
+
resource_path = self.class.path(new?).dup
|
73
87
|
tokens = resource_path.scan(/:\w+/)
|
74
88
|
|
75
89
|
full_path = tokens.reduce(resource_path) do |path_frag, token|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventbrite_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinnie Franco
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-02-
|
13
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|