tiltify 0.1.1 → 0.1.4

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: de4b0ac4ba6b988eca685054c25fc6f1e8579ceec00d1d7cdc6091bf06b1ace6
4
- data.tar.gz: d88687edb6753f9a3b34bf3936740646322eea8be82b2ae18a2589763eda1c55
3
+ metadata.gz: 4e626fde14c3278806aadd0719cdb6631977473b782a92a02559f59f8f49b195
4
+ data.tar.gz: 220baf9df4cc88eb8100cb1496a2f68f609bc4d5dc5511268afc5dccff66439e
5
5
  SHA512:
6
- metadata.gz: bfa30019176b28a06b42e2bab140d33cf1b7d4ba06a160a0a44f0e15dedc46798aa8f4e2108dc074c9400161ef988b518112b058ec13d939d1d8b8161e5ea84d
7
- data.tar.gz: ea13d6f2ace92776824adbbb3f1532a77d754860f50fac5b47c223659281a04315ea0eb92a55dbb81272a63495154bdeb702b45c423670d739f0dec506cf9761
6
+ metadata.gz: d97dc974fb23bd29e84526673a46585866f590705c068a6be1db1fcefbcb2b349abddae767c94ee4ba009c73771ef4a665d0d1fb29fe590312b2ba664a5ccee8
7
+ data.tar.gz: f509d8dc3dd50e366f676802728bf68816a5b59d264d21f39801475c73be28c016af4824616205ed6c9f29fa5a981f5d3d259084d12dcfba855ead512fea37aa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tiltify (0.1.1)
4
+ tiltify (0.1.4)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
@@ -1,19 +1,23 @@
1
1
  module Tiltify
2
2
  class Collection
3
- attr_reader :data, :total
3
+ attr_reader :data, :total, :has_prev, :has_next
4
4
 
5
5
  def self.from_response(response, type:)
6
6
  body = response.body
7
7
 
8
8
  new(
9
9
  data: body["data"].map { |attrs| type.new(attrs) },
10
- total: body["data"].count
10
+ total: body["data"].count,
11
+ has_prev: body["links"] && !body["links"]["prev"].blank?,
12
+ has_next: body["links"] && !body["links"]["next"].blank?
11
13
  )
12
14
  end
13
15
 
14
- def initialize(data:, total:)
16
+ def initialize(data:, total:, has_prev:, has_next:)
15
17
  @data = data
16
18
  @total = total
19
+ @has_prev = has_prev
20
+ @has_next = has_next
17
21
  end
18
22
  end
19
23
  end
@@ -1,4 +1,12 @@
1
1
  module Tiltify
2
2
  class Campaign < Object
3
+
4
+ def initialize(options = {})
5
+ super options
6
+
7
+ self.starts_at = Time.at(options["startsAt"].to_s[0..-4].to_i) if options["startsAt"]
8
+ self.ends_at = Time.at(options["endsAt"].to_s[0..-4].to_i) if options["endsAt"]
9
+ end
10
+
3
11
  end
4
12
  end
@@ -1,4 +1,13 @@
1
1
  module Tiltify
2
2
  class Challenge < Object
3
+
4
+ def initialize(options = {})
5
+ super options
6
+
7
+ self.ends_at = Time.at(options["endsAt"].to_s[0..-4].to_i) if options["endsAt"]
8
+ self.created_at = Time.at(options["createdAt"].to_s[0..-4].to_i) if options["createdAt"]
9
+ self.updated_at = Time.at(options["updatedAt"].to_s[0..-4].to_i) if options["updatedAt"]
10
+ end
11
+
3
12
  end
4
13
  end
@@ -1,4 +1,11 @@
1
1
  module Tiltify
2
2
  class Donation < Object
3
+
4
+ def initialize(options = {})
5
+ super options
6
+
7
+ self.completed_at = Time.at(options["completedAt"].to_s[0..-4].to_i)
8
+ end
9
+
3
10
  end
4
11
  end
@@ -1,4 +1,16 @@
1
1
  module Tiltify
2
2
  class Reward < Object
3
+
4
+ def initialize(options = {})
5
+ super options
6
+
7
+ self.retired_at = Time.at(options["retiredAt"].to_s[0..-4].to_i) if options["retiredAt"]
8
+ self.activated_at = Time.at(options["activatedAt"].to_s[0..-4].to_i) if options["activatedAt"]
9
+ self.deactivated_at = Time.at(options["deactivatedAt"].to_s[0..-4].to_i) if options["deactivatedAt"]
10
+ self.ends_at = Time.at(options["endsAt"].to_s[0..-4].to_i) if options["endsAt"]
11
+ self.created_at = Time.at(options["createdAt"].to_s[0..-4].to_i) if options["createdAt"]
12
+ self.updated_at = Time.at(options["updatedAt"].to_s[0..-4].to_i) if options["updatedAt"]
13
+ end
14
+
3
15
  end
4
16
  end
@@ -1,4 +1,12 @@
1
1
  module Tiltify
2
2
  class Schedule < Object
3
+
4
+ def initialize(options = {})
5
+ super options
6
+
7
+ self.starts_at = Time.at(options["startsAt"].to_s[0..-4].to_i) if options["startsAt"]
8
+ self.ends_at = Time.at(options["endsAt"].to_s[0..-4].to_i) if options["endsAt"]
9
+ end
10
+
3
11
  end
4
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tiltify
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiltify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday