access 2.0.55 → 2.1.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: 07e6ed089ead044c8c3dfa63eea7ec6cf997544a
4
- data.tar.gz: bbe5539862490367823110b9226223fb1a5d3a15
3
+ metadata.gz: 190c815f0a7b20f8a5d4619fe2313adaff7e6de4
4
+ data.tar.gz: f9992621bf7b304a81c76ead57b5e97453dd113a
5
5
  SHA512:
6
- metadata.gz: 0d3906bf1b1e534908e90cce560daf7974e85cc34e2c857470209504c28ba3edeea2187552028bc0bdc232e6c818836e8a86ccf0d9a25a977e0ea5c41399da7f
7
- data.tar.gz: 1c2133f6cab3235380039dcf0421dfe440f7aa1c2b3bd4a7284d9fab0b3898c80eba8bb1cc875fcedc1f6e8b9fbf3514247d527aab53877db580b6c594835822
6
+ metadata.gz: 6887426697922b8dce90212dbbd9607ec4d6628b191be94de508da481edd022893c9d054b48c40e6601fbe8c45ad648901317c2c8d8fad1f80384f94559f9f85
7
+ data.tar.gz: bae6eceac3ee10cad3b2ae9b1cf5f7373d236ddf996c0f5c41c32ca179073bd13100ccc1b58b3e21f1be7db834c6e84e13612fec454adab888a38bb263b0796c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- access (2.0.55)
4
+ access (2.1.0)
5
5
  hashie (~> 3.3.1)
6
6
  httparty (~> 0.13.3)
7
7
 
data/lib/access.rb CHANGED
@@ -25,6 +25,7 @@ require "access/oauth_application"
25
25
  require "access/offer"
26
26
  require "access/organization"
27
27
  require "access/product_group"
28
+ require "access/product"
28
29
  require "access/program"
29
30
  require "access/redeem"
30
31
  require "access/redemption"
@@ -0,0 +1,32 @@
1
+ module Access
2
+ class Product
3
+ include Access::MuchMeta
4
+
5
+ attr_reader :store, :location
6
+
7
+ def self.process_batch(chunk)
8
+ chunk.map { |product| new(product) }
9
+ end
10
+
11
+ def initialize(values)
12
+ @used_fields = []
13
+ set_up_methods(values)
14
+ set_values(values)
15
+ @offer = Access::Offer.new(@offer) if @offer
16
+ @offer_store = Access::Store.new(@offer_store) if @offer_store
17
+ @categories = Access::Category.process_batch(@categories) if @categories
18
+ @links = Access::Link.new(@links) if @links
19
+ @offer_store = Access::Store.new(@offer_store) if @offer_store
20
+ @offer_uses_remaining = Access::Redemption.new(@offer_uses_remaining) if @offer_uses_remaining
21
+ end
22
+
23
+ def location
24
+ @offer_store.physical_location
25
+ end
26
+
27
+ def store
28
+ @offer_store
29
+ end
30
+
31
+ end
32
+ end
@@ -2,17 +2,6 @@ module Access
2
2
  class ProductGroup
3
3
  include Access::MuchMeta
4
4
 
5
- def initialize(values)
6
- @used_fields = []
7
- set_up_methods(values)
8
- set_values(values)
9
- # @categories = Access::Category.process_batch(@categories) if @categories
10
- # @links = Access::Link.new(@links) if @links
11
- # @offer_store = Access::Store.new(@offer_store) if @offer_store
12
- # @offer_uses_remaining = Access::Redemption.new(@offer_uses_remaining) if @offer_uses_remaining
13
- end
14
-
15
-
16
5
  def self.search(options = {})
17
6
  Access::Api.new.search_product_groups options
18
7
  end
@@ -21,6 +10,12 @@ module Access
21
10
  chunk.map { |product_group| new(product_group) }
22
11
  end
23
12
 
13
+ def initialize(values)
14
+ @used_fields = []
15
+ set_up_methods(values)
16
+ set_values(values)
17
+ @products = Access::Product.process_batch(@products) if @products
18
+ end
24
19
 
25
20
  end
26
21
  end
@@ -4,7 +4,7 @@ module Access
4
4
  #basics
5
5
  attr_reader :info, :links, :message, :status, :success, :error, :response_status, :dev_node, :internal_details, :response
6
6
  #resources
7
- attr_reader :offers, :stores, :locations, :categories, :suggestions, :oauth_applications, :access_tokens, :oauth_tokens, :oauth_token, :verify, :reports, :members, :filters, :oauth_access_token, :users, :offer_redemptions, :favorites, :campaigns, :channels, :spots, :programs, :devices, :product_groups
7
+ attr_reader :offers, :stores, :locations, :categories, :suggestions, :oauth_applications, :access_tokens, :oauth_tokens, :oauth_token, :verify, :reports, :members, :filters, :oauth_access_token, :users, :offer_redemptions, :favorites, :campaigns, :channels, :spots, :programs, :devices, :product_groups, :products
8
8
  #aggregations
9
9
  attr_reader :offer_count_in_categories, :offer_count_by_redemption_method, :offer_count_by_facet, :custom_aggregation
10
10
  #redemptions
@@ -64,7 +64,8 @@ module Access
64
64
 
65
65
  class ProductGroupResponse < Response
66
66
  def process_data
67
-
67
+ (@product_groups = []; create_error) if @message
68
+ @product_groups = Access::ProductGroup.process_batch(@product_groups) if @product_groups
68
69
  end
69
70
  end
70
71
 
@@ -1,4 +1,4 @@
1
1
  module Access
2
- VERSION = "2.0.55"
2
+ VERSION = "2.1.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.55
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-01-13 00:00:00.000000000 Z
13
+ date: 2017-01-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -255,6 +255,7 @@ files:
255
255
  - lib/access/oauth_application.rb
256
256
  - lib/access/offer.rb
257
257
  - lib/access/organization.rb
258
+ - lib/access/product.rb
258
259
  - lib/access/product_group.rb
259
260
  - lib/access/program.rb
260
261
  - lib/access/redeem.rb