tiltify 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -25
- data/README.md +9 -0
- data/lib/tiltify/client.rb +1 -3
- data/lib/tiltify/collection.rb +6 -4
- 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/resources/campaigns.rb +1 -1
- data/lib/tiltify/version.rb +1 -1
- data/lib/tiltify.rb +0 -1
- data/tiltify.gemspec +1 -2
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28e06050724f28a81000611903d2ed4916137cad9ea1a1386185a2fec6bd959c
|
4
|
+
data.tar.gz: c38a443d0dd4996d0c4eee0e32965770269e09fb2963c8e113174915b27a758e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc8c628b1b082b14a35dfa1a263c7370788eeabd4601ce70462a3d8fae40bc831fdcb3ecc3d0a3181ebc778a30847c95d39d8b9447a23fbd693c55d885a5b36
|
7
|
+
data.tar.gz: 8f2d6e29205d04103e7c2b4e04098539daebde34ee1b84a6f33cb4895782a76ed053279cd7cdbb881a38164150a5776b0175995f46cceacf9fbc309f45992826
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tiltify (0.1.
|
5
|
-
faraday (~>
|
6
|
-
faraday_middleware (~> 1.1)
|
4
|
+
tiltify (0.1.3)
|
5
|
+
faraday (~> 2.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
10
|
dotenv (2.7.6)
|
12
|
-
faraday (
|
13
|
-
faraday-
|
14
|
-
faraday-em_synchrony (~> 1.0)
|
15
|
-
faraday-excon (~> 1.1)
|
16
|
-
faraday-httpclient (~> 1.0.1)
|
17
|
-
faraday-net_http (~> 1.0)
|
18
|
-
faraday-net_http_persistent (~> 1.1)
|
19
|
-
faraday-patron (~> 1.0)
|
20
|
-
faraday-rack (~> 1.0)
|
21
|
-
multipart-post (>= 1.2, < 3)
|
11
|
+
faraday (2.2.0)
|
12
|
+
faraday-net_http (~> 2.0)
|
22
13
|
ruby2_keywords (>= 0.0.4)
|
23
|
-
faraday-
|
24
|
-
|
25
|
-
faraday-excon (1.1.0)
|
26
|
-
faraday-httpclient (1.0.1)
|
27
|
-
faraday-net_http (1.0.1)
|
28
|
-
faraday-net_http_persistent (1.2.0)
|
29
|
-
faraday-patron (1.0.0)
|
30
|
-
faraday-rack (1.0.0)
|
31
|
-
faraday_middleware (1.2.0)
|
32
|
-
faraday (~> 1.0)
|
33
|
-
minitest (5.14.4)
|
34
|
-
multipart-post (2.1.1)
|
14
|
+
faraday-net_http (2.0.2)
|
15
|
+
minitest (5.15.0)
|
35
16
|
rake (13.0.6)
|
36
17
|
ruby2_keywords (0.0.5)
|
37
18
|
|
data/README.md
CHANGED
@@ -92,3 +92,12 @@ Responses are created as objects like `Tiltify::Campaign`. Having types like `Ti
|
|
92
92
|
# Retrieves a list of a teams campaigns
|
93
93
|
@client.teams.campaigns(team_id: "id")
|
94
94
|
```
|
95
|
+
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/tiltify.
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/tiltify/client.rb
CHANGED
@@ -32,9 +32,7 @@ module Tiltify
|
|
32
32
|
@connection ||= Faraday.new(BASE_URL) do |conn|
|
33
33
|
conn.request :authorization, :Bearer, access_token
|
34
34
|
conn.request :json
|
35
|
-
|
36
|
-
conn.response :dates
|
37
|
-
conn.response :json, content_type: "application/json"
|
35
|
+
conn.response :json
|
38
36
|
|
39
37
|
conn.adapter adapter, @stubs
|
40
38
|
end
|
data/lib/tiltify/collection.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
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
|
@@ -8,14 +8,16 @@ module Tiltify
|
|
8
8
|
new(
|
9
9
|
data: body["data"].map { |attrs| type.new(attrs) },
|
10
10
|
total: body["data"].count,
|
11
|
-
|
11
|
+
has_prev: !body["links"]["prev"].blank?,
|
12
|
+
has_next: !body["links"]["next"].blank?
|
12
13
|
)
|
13
14
|
end
|
14
15
|
|
15
|
-
def initialize(data:, total:,
|
16
|
+
def initialize(data:, total:, has_prev:, has_next:)
|
16
17
|
@data = data
|
17
18
|
@total = total
|
18
|
-
@
|
19
|
+
@has_prev = has_prev
|
20
|
+
@has_next = has_next
|
19
21
|
end
|
20
22
|
end
|
21
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
|
@@ -6,7 +6,7 @@ module Tiltify
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def donations(campaign_id:, **params)
|
9
|
-
response = get_request("campaigns/#{campaign_id}/donations", params)
|
9
|
+
response = get_request("campaigns/#{campaign_id}/donations", params: params)
|
10
10
|
Collection.from_response(response, type: Donation)
|
11
11
|
end
|
12
12
|
|
data/lib/tiltify/version.rb
CHANGED
data/lib/tiltify.rb
CHANGED
data/tiltify.gemspec
CHANGED
@@ -28,6 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency "faraday", "~>
|
32
|
-
spec.add_dependency "faraday_middleware", "~> 1.1"
|
31
|
+
spec.add_dependency "faraday", "~> 2.0"
|
33
32
|
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.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.1'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.1'
|
26
|
+
version: '2.0'
|
41
27
|
description:
|
42
28
|
email:
|
43
29
|
- dean@deanpcmad.com
|
@@ -94,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
80
|
- !ruby/object:Gem::Version
|
95
81
|
version: '0'
|
96
82
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.3.7
|
98
84
|
signing_key:
|
99
85
|
specification_version: 4
|
100
86
|
summary: A Ruby library for the Tiltify v3 API
|