tiltify 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tiltify/collection.rb +7 -3
- data/lib/tiltify/objects/campaign.rb +8 -0
- data/lib/tiltify/objects/challenge.rb +9 -0
- data/lib/tiltify/objects/donation.rb +7 -0
- data/lib/tiltify/objects/reward.rb +12 -0
- data/lib/tiltify/objects/schedule.rb +8 -0
- data/lib/tiltify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e626fde14c3278806aadd0719cdb6631977473b782a92a02559f59f8f49b195
|
4
|
+
data.tar.gz: 220baf9df4cc88eb8100cb1496a2f68f609bc4d5dc5511268afc5dccff66439e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97dc974fb23bd29e84526673a46585866f590705c068a6be1db1fcefbcb2b349abddae767c94ee4ba009c73771ef4a665d0d1fb29fe590312b2ba664a5ccee8
|
7
|
+
data.tar.gz: f509d8dc3dd50e366f676802728bf68816a5b59d264d21f39801475c73be28c016af4824616205ed6c9f29fa5a981f5d3d259084d12dcfba855ead512fea37aa
|
data/Gemfile.lock
CHANGED
data/lib/tiltify/collection.rb
CHANGED
@@ -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,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
|
data/lib/tiltify/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|