wes-data-api 11.2.1 → 11.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: 1f4d1dd0670c2dcdd8db7482a4a57fb7a796ce23
4
- data.tar.gz: 05a9b62c331cd69aeae10c572762ae0e216278b8
3
+ metadata.gz: cdedabd47215b662434a0143e9f7fcc585228a29
4
+ data.tar.gz: 29561ca971eb389b7cbcbe9169ef8f4cd6492e79
5
5
  SHA512:
6
- metadata.gz: 5ab8f8fca62222579d36f03d5f23d9cdbd05f04035a6d9dc91865d19cec12dbe079987aab41d9d8a32e02362a3e5316ed4f6b51e7fa6963bc20b29d32fe460ee
7
- data.tar.gz: 532cfddefdf48193e3b2f883a331a6406ce288e24c12c128f8b62392963fef479ab93d9179dec70dbbdf4947909134e9905c4616fc8629e228b9b0a791274ddf
6
+ metadata.gz: da6369b37e707e772b072fe7af2921825a5f433d36822f4c88bdf64e5b0ba0e864f683805118b2d4ecea8338a8c7f2bb8eafea981319e8a37ce483b77c422889
7
+ data.tar.gz: 61ddd784dca9b326f3b607981060cc3d60b1a1a0e8b84ef7d249163bc680b2e2ffcfec699a4f1fdbe2f7821b09901b5e5cb2589e55f86c76cf6535c62600b283
@@ -46,6 +46,20 @@ module Wes
46
46
  configuration.routes
47
47
  end
48
48
 
49
+ def apply_pagination(route, limit, offset)
50
+ delimiter = route.include?("?") ? '&' : '?'
51
+ route = format(
52
+ '%s%slimit=%s',
53
+ route, delimiter, limit
54
+ )
55
+
56
+ if offset != nil
57
+ route = format('%s&offset=%s', route, offset)
58
+ end
59
+
60
+ route
61
+ end
62
+
49
63
  private
50
64
 
51
65
  def id_set?
@@ -3,6 +3,7 @@ require 'wes/data/api/model/reward'
3
3
  require 'wes/data/api/model/creator_user'
4
4
  require 'wes/data/api/model/video'
5
5
  require 'wes/data/api/model/brief_answer'
6
+ require 'wes/data/api/model/transaction'
6
7
 
7
8
  module Wes
8
9
  module Data
@@ -66,6 +67,18 @@ module Wes
66
67
  JSON.parse(data)
67
68
  end
68
69
 
70
+ def transactions(limit = 50, offset = nil)
71
+ route = apply_pagination(
72
+ [routes.brief, id, routes.transactions].join('/'),
73
+ limit,
74
+ offset
75
+ )
76
+ records = client.get(route)
77
+ map_objects(
78
+ records, Wes::Data::API::Model::Transaction
79
+ )
80
+ end
81
+
69
82
  private
70
83
 
71
84
  def insight_data(type)
@@ -3,6 +3,7 @@ require 'wes/data/api/model/collective'
3
3
  require 'wes/data/api/model/submission'
4
4
  require 'wes/data/api/model/address'
5
5
  require 'wes/data/api/model/video'
6
+ require 'wes/data/api/model/transaction'
6
7
 
7
8
  module Wes
8
9
  module Data
@@ -54,6 +55,18 @@ module Wes
54
55
  map_objects(records, Wes::Data::API::Model::Video)
55
56
  end
56
57
 
58
+ def transactions(limit = 50, offset = nil)
59
+ route = apply_pagination(
60
+ [routes.creator_user, id, routes.transactions].join('/'),
61
+ limit,
62
+ offset
63
+ )
64
+ records = client.get(route)
65
+ map_objects(
66
+ records, Wes::Data::API::Model::Transaction
67
+ )
68
+ end
69
+
57
70
  protected
58
71
 
59
72
  def create_collectives(collective_ids)
@@ -0,0 +1,15 @@
1
+ require 'wes/data/api/model/base'
2
+
3
+ module Wes
4
+ module Data
5
+ module API
6
+ module Model
7
+ class Transaction < Base
8
+ def id
9
+ attributes.guid
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -26,7 +26,8 @@ module Wes
26
26
  transcoding_state: 'transcoding-state',
27
27
  version: 'version',
28
28
  questions: 'questions',
29
- answers: 'answers'
29
+ answers: 'answers',
30
+ transactions: 'transactions'
30
31
  )
31
32
  end
32
33
  end
data/lib/wes/data/api.rb CHANGED
@@ -5,7 +5,7 @@ require 'wes/data/api/configuration'
5
5
  module Wes
6
6
  module Data
7
7
  module API
8
- VERSION = '11.2.1'.freeze
8
+ VERSION = '11.3.0'.freeze
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wes-data-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.2.1
4
+ version: 11.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,6 +142,7 @@ files:
142
142
  - lib/wes/data/api/model/submission.rb
143
143
  - lib/wes/data/api/model/tag.rb
144
144
  - lib/wes/data/api/model/tag_video_version.rb
145
+ - lib/wes/data/api/model/transaction.rb
145
146
  - lib/wes/data/api/model/video.rb
146
147
  - lib/wes/data/api/model/video_transcoding_state.rb
147
148
  - lib/wes/data/api/model/video_version.rb