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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 718fdef9c71f82ad006a2b4b856a5eb524e04883
4
- data.tar.gz: 70decadb74b2b9e2d06e7b0ea9d5657fd345edb8
3
+ metadata.gz: b4a826c30316dbbbfff3b4944584433428451116
4
+ data.tar.gz: 23970a9c05222ecc9bf55ee6118db5294b2a9b3a
5
5
  SHA512:
6
- metadata.gz: ff82d5554fb2720e3f8484fd03ad95f6b2e23691397f7ff2b137cf3fb57e4bb7193f68465e95a2fa0255190a8752e3483d4902f12be5cbb1167cd7f037e33878
7
- data.tar.gz: 10bdecb1cb1357e297bdb6642ee7ba3eccfcc0da5b48a94aa1137a4acfbf0f6c21d532c2306064d526f2e5e8cf25e64aec709b997b15c09447faada2ce413271
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(@path) do |path, (key, value)|
34
- path.gsub(":#{key}", value.to_s)
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
- @path = path
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
- path.scan(/:\w+/).each do |path_attr|
61
- attr = path_attr.delete(':').to_sym
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
- define_method(attr) do
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|
@@ -1,5 +1,5 @@
1
1
  module EventbriteSDK
2
2
  # Major should always line up with the major point release of the public API
3
3
  # v3 => 3.x.x
4
- VERSION = '3.2.0'.freeze
4
+ VERSION = '3.3.0'.freeze
5
5
  end
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.2.0
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-02 00:00:00.000000000 Z
13
+ date: 2018-02-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client