evvnt 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 6fbf2109eb731d2fff7ed58d0bdfbdb870e9d858943e750d3851cc9f7e8c1fa8
4
- data.tar.gz: 5ea6252bb8fcbda420fad16d663c617e72f206b986a7ea2c19644ab902dad15a
3
+ metadata.gz: 428b43760f609c100d442ce25a18a651911292bf89e5cdf851d26922569a3d9c
4
+ data.tar.gz: 18f3341bff19d6523cc059f4dc80a91c7db6f55c1342ff745052b2382d845986
5
5
  SHA512:
6
- metadata.gz: 291cd38c9c02deca7d0343a90de1025dac83a0314ac94a805ecd6c8758765b61fd4e07cd4e232aa71a4e3a48f704f349692e82358e22f560c1cb6e89d0b27469
7
- data.tar.gz: 9c909e5592ded00962be89ff4e7ccec6a8d9666c5432ed53d513a9428b329aaf5bb63ff3da4dcff5cf7a0e5b8705bcaabab7488bb15259f78acb2d23d7cfb43d
6
+ metadata.gz: 8560654006b459e964f2be9a3d08c011cc8e88533396d9d25e97ef8b7f0c34b133acb82c48dfaed3e2d26cc5cd17661ccaeea2f225e05fb860c7065b026d458f
7
+ data.tar.gz: 0b334faffe395e92e6447cb9d1da2c24cd8818eae906f7d97f312504476241564273680d139cbbbf50a7c5db950a08f3d06f98db6ad21000d936651d957571d5
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evvnt (0.1.0)
4
+ evvnt (0.2.0)
5
5
  activesupport (>= 3.0)
6
6
  httparty (>= 0.16.0)
7
+ oj
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- abstract_class (1.0.1)
12
- activesupport (5.1.4)
12
+ activesupport (5.1.5)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (~> 0.7)
15
15
  minitest (~> 5.1)
@@ -17,7 +17,6 @@ GEM
17
17
  addressable (2.5.2)
18
18
  public_suffix (>= 2.0.2, < 4.0)
19
19
  ast (2.4.0)
20
- awesome_print (1.8.0)
21
20
  byebug (10.0.0)
22
21
  concurrent-ruby (1.0.5)
23
22
  crack (0.4.3)
@@ -31,6 +30,7 @@ GEM
31
30
  concurrent-ruby (~> 1.0)
32
31
  minitest (5.11.3)
33
32
  multi_xml (0.6.0)
33
+ oj (3.5.0)
34
34
  parallel (1.12.1)
35
35
  parser (2.5.0.3)
36
36
  ast (~> 2.4.0)
@@ -49,10 +49,6 @@ GEM
49
49
  rspec-expectations (3.7.0)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
51
  rspec-support (~> 3.7.0)
52
- rspec-json_matchers (0.1.0)
53
- abstract_class (~> 1.0, >= 1.0.1)
54
- awesome_print (~> 1.6)
55
- rspec (~> 3.0)
56
52
  rspec-mocks (3.7.0)
57
53
  diff-lcs (>= 1.2.0, < 2.0)
58
54
  rspec-support (~> 3.7.0)
@@ -82,16 +78,15 @@ PLATFORMS
82
78
 
83
79
  DEPENDENCIES
84
80
  bundler (~> 1.16)
85
- byebug
86
- dotenv
81
+ byebug (>= 10.0.0)
82
+ dotenv (>= 2.2.1)
87
83
  evvnt!
88
- rake (~> 10.0)
89
- rspec
90
- rspec-collection_matchers
91
- rspec-json_matchers
92
- rspec_junit_formatter
93
- rubocop
94
- webmock
84
+ rake
85
+ rspec (>= 3.7.0, < 4.0)
86
+ rspec-collection_matchers (>= 1.1.3)
87
+ rspec_junit_formatter (>= 0.3.0)
88
+ rubocop (>= 0.53.0)
89
+ webmock (>= 3.3.0)
95
90
 
96
91
  BUNDLED WITH
97
92
  1.16.1
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # evvnt
2
2
 
3
+ Provides a Ruby wrapper around the evvnt APIs
4
+
5
+ [![Latest Version](https://img.shields.io/gem/v/evvnt.svg)](https://img.shields.io/gem/v/evvnt.svg)
3
6
  [![CircleCI](https://circleci.com/gh/KatanaCode/evvnt.svg?style=svg)](https://circleci.com/gh/KatanaCode/evvnt)
7
+ [![Downloads](https://img.shields.io/github/downloads/katanacode/evvnt/total.svg)](https://img.shields.io/github/downloads/katanacode/evvnt/total.svg)
8
+ [![Maintainability](https://api.codeclimate.com/v1/badges/fdd8cffc25d6002a68df/maintainability)](https://codeclimate.com/github/KatanaCode/evvnt/maintainability)
4
9
 
5
- Provides a Ruby wrapper around the evvnt APIs
6
10
 
7
11
  ---
8
12
 
@@ -60,6 +64,12 @@ For example:
60
64
  @category = Evvnt::Category.first
61
65
  @category.name # => "Academic / Learning"
62
66
 
67
+ # Fetch one event from the API
68
+ @event = Evvnt::Event.find("....")
69
+
70
+ # The same as above, aliased
71
+ @event = Evvnt::Event.show("....")
72
+
63
73
  # Returns the last Category
64
74
  @category = Evvnt::Category.last
65
75
  @category.name # => "Alternative Investment"
@@ -73,6 +83,40 @@ For example:
73
83
  @user.save
74
84
  ```
75
85
 
86
+ ## Documentation
87
+
88
+ For a full list of the Evvnt _model_ classes and their endpoints, please check out the documentation in the models, or in the [auto-generated docs](http://www.rubydoc.info/gems/evvnt/)
89
+
90
+ - [Category](lib/evvnt/category.rb)
91
+ - index (GET /categories List categories)
92
+ - [Contract](lib/evvnt/contract.rb)
93
+ - index (GET /contract Get contract information)
94
+ - [Event](lib/evvnt/event.rb)
95
+ - index (GET /events List Events)
96
+ - create (POST /events Create an event)
97
+ - show (GET /events/:event_id Get one event)
98
+ - update (PUT /events/:event_id Update an event)
99
+ - ours (GET /events/ours(/:id) Get events of you and your created users)
100
+ - mine (GET /events/mine List my events)
101
+ - [Package](lib/evvnt/package.rb)
102
+ - index (GET /users/:user_id/packages Lists all of the packages belonging to a user)
103
+ - create (POST /packages Create a package)
104
+ - show (GET /packages/:package_id Get the details of a package)
105
+ - mine (GET /packages/mine List my packages)
106
+ - [PublishedEvent](lib/evvnt/published_event,rb)
107
+ - index (GET /events List Events)
108
+ - show (GET /events/:event_id Get one event)
109
+ - update (PUT /events/:event_id Update an event)
110
+ - [Publisher](lib/evvnt/publisher.rb)
111
+ - index (GET /publishers List my publishing sites)
112
+ - [Report](lib/evvnt/report.rb)
113
+ - show (/events/:event_id/report View report data for my event)
114
+ - [User](lib/evvnt/user.rb)
115
+ - create (POST /users Create a user)
116
+ - index (GET /users Get a list of all users created by you)
117
+ - show (GET /users/:user_id Get details of a user)
118
+ - update (PUT /users/:user_id Update a user)
119
+
76
120
  ## Development
77
121
 
78
122
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/evvnt.gemspec CHANGED
@@ -9,8 +9,9 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["bodacious@katanacode.com"]
10
10
 
11
11
  spec.summary = "A wrapper for the EVVNT API"
12
- spec.description = "Provides a wrapper and helper classes for the EVVNT rest API"
13
- spec.homepage = "https://github.com/katanacode.com/evvnt"
12
+ spec.description = "Unnoficial evvnt API gem provides a wrapper and helper classes "\
13
+ "for the EVVNT rest API"
14
+ spec.homepage = "https://github.com/katanacode/evvnt"
14
15
  spec.license = "MIT"
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -19,14 +20,14 @@ Gem::Specification.new do |spec|
19
20
  spec.require_paths = ["lib"]
20
21
  spec.add_dependency "activesupport", ">= 3.0"
21
22
  spec.add_dependency "httparty", ">= 0.16.0"
23
+ spec.add_dependency "oj"
22
24
  spec.add_development_dependency "bundler", "~> 1.16"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "rspec_junit_formatter"
26
- spec.add_development_dependency "rubocop"
27
- spec.add_development_dependency "webmock"
28
- spec.add_development_dependency "dotenv"
29
- spec.add_development_dependency "byebug"
30
- spec.add_development_dependency "rspec-json_matchers"
31
- spec.add_development_dependency "rspec-collection_matchers"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec", ">= 3.7.0", "< 4.0"
27
+ spec.add_development_dependency "rubocop", ">= 0.53.0"
28
+ spec.add_development_dependency "webmock", ">= 3.3.0"
29
+ spec.add_development_dependency "dotenv", ">= 2.2.1"
30
+ spec.add_development_dependency "byebug", ">= 10.0.0"
31
+ spec.add_development_dependency "rspec_junit_formatter", ">= 0.3.0"
32
+ spec.add_development_dependency "rspec-collection_matchers", ">= 1.1.3"
32
33
  end
data/lib/evvnt/actions.rb CHANGED
@@ -2,60 +2,76 @@ module Evvnt
2
2
  # Internal: Methods for defining API actions for each resource Class.
3
3
  #
4
4
  module Actions
5
+ ##
6
+ # The first record from the API index actions
7
+ #
8
+ # Returns {Evvnt::Base} subclass
9
+ def first
10
+ defined_actions.include?(:index) ? all.first : method_missing(:first)
11
+ end
12
+
13
+ ##
14
+ # The last record from the API index actions
15
+ #
16
+ # Returns {Evvnt::Base} subclass
17
+ def last
18
+ defined_actions.include?(:index) ? all.first : method_missing(:last)
19
+ end
20
+
5
21
  private
6
22
 
7
- ##
8
- # A list of the API actions defined on this class
9
- #
10
- # Returns Array
11
- def defined_actions
12
- @defined_actions ||= []
13
- end
23
+ ##
24
+ # A list of the API actions defined on this class
25
+ #
26
+ # Returns Array
27
+ def defined_actions
28
+ @defined_actions ||= []
29
+ end
14
30
 
15
- ##
16
- # Define an action for this class to map on to the Evvnt API for this class's
17
- # resource.
18
- #
19
- # action - A Symbol or String representing the action name. Should be one of the
20
- # template actions if block is not provided.
21
- # block - A Proc to be used as the action method definition when custom behaviour
22
- # is required.
23
- #
24
- # Examples
25
- #
26
- # class Package < Evvnt::Base
27
- # # Define using the template `all` method
28
- # define_action :all
29
- # define_action :mine do
30
- # # define the custom behaviour here
31
- # end
32
- # end
33
- #
34
- # Returns Symbol
35
- def define_action(action, &block)
36
- action = action.to_sym
37
- defined_actions << action unless defined_actions.include?(action)
38
- if action.in?(Evvnt::ClassTemplateMethods.instance_methods)
39
- define_class_action(action, &block)
40
- end
41
- if action.in?(Evvnt::InstanceTemplateMethods.instance_methods)
42
- define_instance_action(action, &block)
43
- end
44
- action
31
+ ##
32
+ # Define an action for this class to map on to the Evvnt API for this class's
33
+ # resource.
34
+ #
35
+ # action - A Symbol or String representing the action name. Should be one of the
36
+ # template actions if block is not provided.
37
+ # block - A Proc to be used as the action method definition when custom behaviour
38
+ # is required.
39
+ #
40
+ # Examples
41
+ #
42
+ # class Package < Evvnt::Base
43
+ # # Define using the template `all` method
44
+ # define_action :all
45
+ # define_action :mine do
46
+ # # define the custom behaviour here
47
+ # end
48
+ # end
49
+ #
50
+ # Returns Symbol
51
+ def define_action(action, &block)
52
+ action = action.to_sym
53
+ defined_actions << action unless defined_actions.include?(action)
54
+ if action.in?(Evvnt::ClassTemplateMethods.instance_methods)
55
+ define_class_action(action, &block)
45
56
  end
46
-
47
- # Define a class-level action on the current class. See {define_action}.
48
- def define_class_action(action, &block)
49
- body = block_given? ? block : ClassTemplateMethods.instance_method(action)
50
- define_singleton_method(action, body)
51
- singleton_class.send(:alias_method, :all, :index) if action == :index
52
- singleton_class.send(:alias_method, :find, :show) if action == :show
57
+ if action.in?(Evvnt::InstanceTemplateMethods.instance_methods)
58
+ define_instance_action(action, &block)
53
59
  end
60
+ action
61
+ end
54
62
 
55
- # Define an instance-level action on the current class. See {define_action}.
56
- def define_instance_action(action, &block)
57
- body = block_given? ? block : InstanceTemplateMethods.instance_method(action)
58
- define_method(action, body)
59
- end
63
+ # Define a class-level action on the current class. See {define_action}.
64
+ def define_class_action(action, &block)
65
+ body = block_given? ? block : ClassTemplateMethods.instance_method(action)
66
+ define_singleton_method(action, body)
67
+ singleton_class.send(:alias_method, :all, :index) if action == :index
68
+ singleton_class.send(:alias_method, :find, :show) if action == :show
69
+ end
70
+
71
+ # Define an instance-level action on the current class. See {define_action}.
72
+ def define_instance_action(action, &block)
73
+ body = block_given? ? block : InstanceTemplateMethods.instance_method(action)
74
+ define_method(action, body)
75
+ end
60
76
  end
61
77
  end
data/lib/evvnt/api.rb CHANGED
@@ -1,15 +1,25 @@
1
1
  module Evvnt
2
2
  # Internal: Handles requests to the EVVNT api and catches their responses.
3
3
  module Api
4
+ # frozen_string_literal: true
5
+ require 'oj'
4
6
  require "evvnt/api_error"
5
7
 
6
- # frozen_string_literal: true
7
8
  extend ActiveSupport::Concern
8
9
 
9
10
  ##
10
11
  # Allowed HTTP verbs
11
12
  HTTP_VERBS = %i[get post put].freeze
12
13
 
14
+ included do
15
+ if Evvnt.configuration.environment == :live
16
+ base_uri "https://api.evvnt.com"
17
+ else
18
+ base_uri "https://api.sandbox.evvnt.com"
19
+ end
20
+ end
21
+
22
+
13
23
  # Class methods to define on {Evvnt::Base}
14
24
  module ClassMethods
15
25
  private
@@ -69,7 +79,7 @@ module Evvnt
69
79
  # Returns Array
70
80
  # Returns Evvnt::Base subclass
71
81
  def parse_response(response, **options)
72
- json = JSON.parse(response.body)
82
+ json = Oj.load(response.body)
73
83
  json = json[options[:object]] if options.key?(:object)
74
84
  json.is_a?(Array) ? json.map { |a| new(a) } : new(json)
75
85
  end
@@ -0,0 +1,122 @@
1
+ module Evvnt
2
+ # Adds attributes hash plus getters and setters to inherited base class.
3
+ module Attributes
4
+ # frozen_string_literal: true
5
+
6
+ extend ActiveSupport::Concern
7
+
8
+
9
+ ##
10
+ # Test if a String is a date string.
11
+ DATE_STRING_REGEX = /^\d{4}-\d{2}-\d{2}$/
12
+
13
+ ##
14
+ # Test if a String is a datetime string.
15
+ DATETIME_STRING_REGEX = /^\d{4}-\d\d-\d\dT\d\d\:\d\d\:\d\d\+\d\d\:\d\d$/
16
+
17
+ ##
18
+ # The attributes for this given record
19
+ #
20
+ # Returns Hash
21
+ attr_reader :attributes
22
+
23
+
24
+ ##
25
+ # Initialize a new record
26
+ #
27
+ # attributes - A Hash of attributes for the given record. See {method_missing} for
28
+ # more info on how this is handled.
29
+ def initialize(attributes = {})
30
+ self.attributes = Hash[attributes.map { |k, v| [k, format_attribute(k, v)] }]
31
+ end
32
+
33
+ ##
34
+ # Set or change the attributes for this record
35
+ #
36
+ # hash - A Hash of attributes for this record.
37
+ #
38
+ # Returns Hash
39
+ def attributes=(hash)
40
+ @attributes = Hash(hash).with_indifferent_access
41
+ end
42
+
43
+ # The unique identifier for the given record. Tries +uuid+ followed by +id+.
44
+ #
45
+ # Returns String
46
+ def unique_identifier
47
+ attributes["uuid"] || attributes["id"]
48
+ end
49
+
50
+ private
51
+
52
+ def format_attribute(key, value)
53
+ case value
54
+ when String
55
+ format_string_attribute(value)
56
+ when Array
57
+ format_array_attribute(key, value)
58
+ when Hash
59
+ format_hash_attribute(key, value)
60
+ else
61
+ value
62
+ end
63
+ end
64
+
65
+ def format_hash_attribute(key, value)
66
+ unless Evvnt.const_defined?(key.singularize.classify)
67
+ raise ArgumentError, "Unknown object type: #{key}"
68
+ end
69
+ Evvnt.const_get(key.singularize.classify).new(value)
70
+ end
71
+
72
+ def format_array_attribute(key, value)
73
+ Array(value).map do |attributes|
74
+ unless Evvnt.const_defined?(key.singularize.classify)
75
+ raise ArgumentError, "Unknown object type: #{key}"
76
+ end
77
+ Evvnt.const_get(key.singularize.classify).new(attributes)
78
+ end
79
+ end
80
+
81
+ def format_string_attribute(value)
82
+ case value
83
+ when DATE_STRING_REGEX
84
+ value.to_date
85
+ when DATETIME_STRING_REGEX
86
+ value.to_datetime
87
+ else
88
+ value
89
+ end
90
+ end
91
+
92
+ ##
93
+ # Overrides method missing to catch undefined methods. If +method_name+ is one
94
+ # of the keys on +attributes+, returns the value of that attribute. If +method_name+
95
+ # is not one of +attributes+, passes up the chain to super.
96
+ #
97
+ # method_name - Symbol of the name of the method we're testing for.
98
+ # args - Array of arguments send with the original mesage.
99
+ # block - Proc of code passed with original message.
100
+ #
101
+ def method_missing(method_name, *args)
102
+ setter = method_name.to_s.ends_with?('=')
103
+ attr_name = method_name.to_s.gsub(/=$/, "")
104
+ if setter
105
+ attributes[attr_name] = args.first
106
+ else
107
+ attributes[attr_name]
108
+ end
109
+ end
110
+
111
+ ##
112
+ # Improve code instrospect. Allows `respond_to?` for dynamically added attribute
113
+ # methods.
114
+ #
115
+ # method - A Symbol with the method name
116
+ #
117
+ # Returns Boolean
118
+ def respond_to_missing?(method, *)
119
+ attributes.stringify_keys.keys.include?(method.to_s) || super
120
+ end
121
+ end
122
+ end
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class AudienceReach < Evvnt::Base
2
+ class AudienceReach < Evvnt::NestedObject
3
3
  end
4
4
  end
data/lib/evvnt/base.rb CHANGED
@@ -5,6 +5,7 @@ module Evvnt
5
5
  # frozen_string_literal: true
6
6
 
7
7
  require "evvnt/actions"
8
+ require "evvnt/attributes"
8
9
  require "evvnt/api"
9
10
  require "evvnt/class_template_methods"
10
11
  require "evvnt/instance_template_methods"
@@ -17,150 +18,9 @@ module Evvnt
17
18
  include Logging
18
19
  include Api
19
20
  include Persistence
21
+ include Attributes
20
22
  extend PathHelpers
21
23
  extend NestedResources
22
24
  extend Actions
23
-
24
- ##
25
- # Test if a String is a date string.
26
- DATE_STRING_REGEX = /^\d{4}-\d{2}-\d{2}$/
27
-
28
- ##
29
- # Test if a String is a datetime string.
30
- DATETIME_STRING_REGEX = /^\d{4}-\d\d-\d\dT\d\d\:\d\d\:\d\d\+\d\d\:\d\d$/
31
-
32
-
33
- if Evvnt.configuration.environment == :live
34
- base_uri "https://api.evvnt.com"
35
- else
36
- base_uri "https://api.sandbox.evvnt.com"
37
- end
38
-
39
- ##
40
- # The attributes for this given record
41
- #
42
- # Returns Hash
43
- attr_reader :attributes
44
-
45
- # =================
46
- # = Class Methods =
47
- # =================
48
-
49
- ##
50
- # The first record from the API index actions
51
- #
52
- # Returns {Evvnt::Base} subclass
53
- def self.first
54
- defined_actions.include?(:index) ? all.first : method_missing(:first)
55
- end
56
-
57
- ##
58
- # The last record from the API index actions
59
- #
60
- # Returns {Evvnt::Base} subclass
61
- def self.last
62
- defined_actions.include?(:index) ? all.first : method_missing(:last)
63
- end
64
-
65
-
66
- # ====================
67
- # = Instance methods =
68
- # ====================
69
-
70
- ##
71
- # Initialize a new record
72
- #
73
- # attributes - A Hash of attributes for the given record. See {method_missing} for
74
- # more info on how this is handled.
75
- def initialize(attributes = {})
76
- self.attributes = Hash[attributes.map { |k, v| [k, format_attribute(k, v)] }]
77
- end
78
-
79
- ##
80
- # Set or change the attributes for this record
81
- #
82
- # hash - A Hash of attributes for this record.
83
- #
84
- # Returns Hash
85
- def attributes=(hash)
86
- @attributes = Hash(hash).with_indifferent_access
87
- end
88
-
89
- # The unique identifier for the given record. Tries +uuid+ followed by +id+.
90
- #
91
- # Returns String
92
- def unique_identifier
93
- attributes["uuid"] || attributes["id"]
94
- end
95
-
96
- private
97
-
98
- def format_attribute(key, value)
99
- case value
100
- when String
101
- format_string_attribute(value)
102
- when Array
103
- format_array_attribute(key, value)
104
- when Hash
105
- format_hash_attribute(key, value)
106
- else
107
- value
108
- end
109
- end
110
-
111
- def format_hash_attribute(key, value)
112
- unless Evvnt.const_defined?(key.singularize.classify)
113
- raise ArgumentError, "Unknown object type: #{key}"
114
- end
115
- Evvnt.const_get(key.singularize.classify).new(value)
116
- end
117
-
118
- def format_array_attribute(key, value)
119
- Array(value).map do |attributes|
120
- unless Evvnt.const_defined?(key.singularize.classify)
121
- raise ArgumentError, "Unknown object type: #{key}"
122
- end
123
- Evvnt.const_get(key.singularize.classify).new(attributes)
124
- end
125
- end
126
-
127
- def format_string_attribute(value)
128
- case value
129
- when DATE_STRING_REGEX
130
- value.to_date
131
- when DATETIME_STRING_REGEX
132
- value.to_datetime
133
- else
134
- value
135
- end
136
- end
137
-
138
- ##
139
- # Overrides method missing to catch undefined methods. If +method_name+ is one
140
- # of the keys on +attributes+, returns the value of that attribute. If +method_name+
141
- # is not one of +attributes+, passes up the chain to super.
142
- #
143
- # method_name - Symbol of the name of the method we're testing for.
144
- # args - Array of arguments send with the original mesage.
145
- # block - Proc of code passed with original message.
146
- #
147
- def method_missing(method_name, *args)
148
- if method_name.to_s[/\=/]
149
- attributes[method_name.to_s.gsub(/\=+/, "")] = args.first
150
- else
151
- attributes[method_name.to_s.gsub(/\=+/, "")]
152
- end
153
- end
154
-
155
- ##
156
- # Improve code instrospect. Allows `respond_to?` for dynamically added attribute
157
- # methods.
158
- #
159
- # method - A Symbol with the method name
160
- #
161
- # Returns Boolean
162
- def respond_to_missing?(method, *)
163
- attributes.stringify_keys.keys.include?(method.to_s) || super
164
- end
165
25
  end
166
26
  end
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class Broadcast < Evvnt::Base
2
+ class Broadcast < Evvnt::NestedObject
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class BroadcastResult < Evvnt::Base
2
+ class BroadcastResult < Evvnt::NestedObject
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class ClicksByDay < Evvnt::Base
2
+ class ClicksByDay < Evvnt::NestedObject
3
3
  end
4
4
  end
data/lib/evvnt/contact.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class Contact < Evvnt::Base
2
+ class Contact < Evvnt::NestedObject
3
3
  end
4
4
  end
data/lib/evvnt/link.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Evvnt
2
- class Link < Evvnt::Base
2
+ class Link < Evvnt::NestedObject
3
3
 
4
4
  end
5
5
  end
@@ -0,0 +1,14 @@
1
+ module Evvnt
2
+ # Internal: NestedObject class for Evvnt API objects that don't map to a main
3
+ # resource.
4
+ #
5
+ class NestedObject
6
+ # frozen_string_literal: true
7
+
8
+ require "evvnt/attributes"
9
+ require "evvnt/logging"
10
+
11
+ include Logging
12
+ include Attributes
13
+ end
14
+ end
data/lib/evvnt/price.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Evvnt
2
- class Price < Evvnt::Base
2
+ class Price < Evvnt::NestedObject
3
3
 
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Evvnt
2
- class Referrer < Evvnt::Base
2
+ class Referrer < Evvnt::NestedObject
3
3
 
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class SearchIndexing < Evvnt::Base
2
+ class SearchIndexing < Evvnt::NestedObject
3
3
  end
4
4
  end
data/lib/evvnt/venue.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evvnt
2
- class Venue < Evvnt::Base
2
+ class Venue < Evvnt::NestedObject
3
3
  end
4
4
  end
data/lib/evvnt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Evvnt
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
data/lib/evvnt.rb CHANGED
@@ -24,7 +24,10 @@ module Evvnt
24
24
  @configuration ||= configure
25
25
  end
26
26
 
27
+ # Require the two main Base classes
27
28
  require "evvnt/base"
29
+ require "evvnt/nested_object"
30
+
28
31
  require "evvnt/audience_reach"
29
32
  require "evvnt/broadcast"
30
33
  require "evvnt/broadcast_result"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evvnt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodacious
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2018-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -39,35 +39,35 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.16.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: oj
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
48
- type: :development
47
+ version: '0'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '1.16'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '1.16'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,104 +81,111 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec_junit_formatter
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 3.7.0
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '4.0'
90
93
  type: :development
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
97
  - - ">="
95
98
  - !ruby/object:Gem::Version
96
- version: '0'
99
+ version: 3.7.0
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '4.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rubocop
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - ">="
102
108
  - !ruby/object:Gem::Version
103
- version: '0'
109
+ version: 0.53.0
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - ">="
109
115
  - !ruby/object:Gem::Version
110
- version: '0'
116
+ version: 0.53.0
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: webmock
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
121
  - - ">="
116
122
  - !ruby/object:Gem::Version
117
- version: '0'
123
+ version: 3.3.0
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - ">="
123
129
  - !ruby/object:Gem::Version
124
- version: '0'
130
+ version: 3.3.0
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: dotenv
127
133
  requirement: !ruby/object:Gem::Requirement
128
134
  requirements:
129
135
  - - ">="
130
136
  - !ruby/object:Gem::Version
131
- version: '0'
137
+ version: 2.2.1
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
142
  - - ">="
137
143
  - !ruby/object:Gem::Version
138
- version: '0'
144
+ version: 2.2.1
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: byebug
141
147
  requirement: !ruby/object:Gem::Requirement
142
148
  requirements:
143
149
  - - ">="
144
150
  - !ruby/object:Gem::Version
145
- version: '0'
151
+ version: 10.0.0
146
152
  type: :development
147
153
  prerelease: false
148
154
  version_requirements: !ruby/object:Gem::Requirement
149
155
  requirements:
150
156
  - - ">="
151
157
  - !ruby/object:Gem::Version
152
- version: '0'
158
+ version: 10.0.0
153
159
  - !ruby/object:Gem::Dependency
154
- name: rspec-json_matchers
160
+ name: rspec_junit_formatter
155
161
  requirement: !ruby/object:Gem::Requirement
156
162
  requirements:
157
163
  - - ">="
158
164
  - !ruby/object:Gem::Version
159
- version: '0'
165
+ version: 0.3.0
160
166
  type: :development
161
167
  prerelease: false
162
168
  version_requirements: !ruby/object:Gem::Requirement
163
169
  requirements:
164
170
  - - ">="
165
171
  - !ruby/object:Gem::Version
166
- version: '0'
172
+ version: 0.3.0
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: rspec-collection_matchers
169
175
  requirement: !ruby/object:Gem::Requirement
170
176
  requirements:
171
177
  - - ">="
172
178
  - !ruby/object:Gem::Version
173
- version: '0'
179
+ version: 1.1.3
174
180
  type: :development
175
181
  prerelease: false
176
182
  version_requirements: !ruby/object:Gem::Requirement
177
183
  requirements:
178
184
  - - ">="
179
185
  - !ruby/object:Gem::Version
180
- version: '0'
181
- description: Provides a wrapper and helper classes for the EVVNT rest API
186
+ version: 1.1.3
187
+ description: Unnoficial evvnt API gem provides a wrapper and helper classes for the
188
+ EVVNT rest API
182
189
  email:
183
190
  - bodacious@katanacode.com
184
191
  executables: []
@@ -201,6 +208,7 @@ files:
201
208
  - lib/evvnt/actions.rb
202
209
  - lib/evvnt/api.rb
203
210
  - lib/evvnt/api_error.rb
211
+ - lib/evvnt/attributes.rb
204
212
  - lib/evvnt/audience_reach.rb
205
213
  - lib/evvnt/base.rb
206
214
  - lib/evvnt/broadcast.rb
@@ -215,6 +223,7 @@ files:
215
223
  - lib/evvnt/instance_template_methods.rb
216
224
  - lib/evvnt/link.rb
217
225
  - lib/evvnt/logging.rb
226
+ - lib/evvnt/nested_object.rb
218
227
  - lib/evvnt/nested_resources.rb
219
228
  - lib/evvnt/package.rb
220
229
  - lib/evvnt/path_helpers.rb
@@ -228,7 +237,7 @@ files:
228
237
  - lib/evvnt/user.rb
229
238
  - lib/evvnt/venue.rb
230
239
  - lib/evvnt/version.rb
231
- homepage: https://github.com/katanacode.com/evvnt
240
+ homepage: https://github.com/katanacode/evvnt
232
241
  licenses:
233
242
  - MIT
234
243
  metadata: {}