affiliation-api-client 0.1.6 → 0.1.7

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: 9a548ec12b5b6cab2ee44c0281dd022a8757c06c
4
- data.tar.gz: 2b80aae0b0e2a82da50016658a3bc8f6577f566b
3
+ metadata.gz: 87d7a4e8b41aaf159e6ed22ae6d65e28f9125343
4
+ data.tar.gz: 55822f453599ae315c501fe56bc483b78de159b1
5
5
  SHA512:
6
- metadata.gz: 10121529ba3fc241ea35c3d07df0bab49ea6c537886819b18b390acbd9cfed349da23a73314aecabe0f2fe2a287e62b0319b8315c0e87bdaf571eda1beb11256
7
- data.tar.gz: 6a0697a864d3d64c79574b78b4bf057fe43b6773e5a0133783693e1b383ce098046c6655fe28284c9cadc5253af7377df414c650bdfb3bcffc752648af17aee5
6
+ metadata.gz: aab67f45a54209efcc7b7810c5e166b35f623b35b0b8d8c341d6e95bd84c475739a818099e39285d8be85e9857705378e15864b79ef2feb38956ff7563a75153
7
+ data.tar.gz: 9cc9185b1e954969be65bb4023529c30a51ce43847cb9a88a277c24090a6d98d4346b7afcd896e11fcf782e417597d5c4d692fa76f4c8a2c414e5c1830221684
@@ -13,7 +13,10 @@ module AffiliationApi
13
13
  :category_ids,
14
14
  :reward_percentage,
15
15
  :reward_fixed,
16
- :reward_details
16
+ :reward_details,
17
+ :primary_ad,
18
+ :primary_ad_id,
19
+ :ads
17
20
 
18
21
  def network_updated_at
19
22
  return nil unless @network_updated_at.present?
@@ -22,8 +25,22 @@ module AffiliationApi
22
25
 
23
26
  def categories
24
27
  @categories['data'].map do |cat_data|
25
- Category.new id: cat_data['id'], name: cat_data['name']
28
+ Category.new cat_data
26
29
  end
27
30
  end
31
+
32
+ def primary_ad
33
+ Ad.new @primary_ad['data']
34
+ end
35
+
36
+ def ads
37
+ @ads['data'].map do |ad_data|
38
+ Ad.new ad_data
39
+ end
40
+ end
41
+
42
+ def primary_ad_id
43
+ @primary_ad_id || primary_ad.id || ads.first.try(:id)
44
+ end
28
45
  end
29
46
  end
@@ -1,3 +1,3 @@
1
1
  module AffiliationApi
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affiliation-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chaker Nakhli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api-resource