tiltify 0.1.0 → 0.1.3

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: d05abbdc1199dbe6d1b6fb133619734a3915e1d6e48825fc9f3a304b4bcc55f5
4
- data.tar.gz: e2132fcabf47210fc09f515ae40e2b197ef9c22ee25118ba90a70bc3c3f1034a
3
+ metadata.gz: 28e06050724f28a81000611903d2ed4916137cad9ea1a1386185a2fec6bd959c
4
+ data.tar.gz: c38a443d0dd4996d0c4eee0e32965770269e09fb2963c8e113174915b27a758e
5
5
  SHA512:
6
- metadata.gz: 04451dc33eff2f13fde623cafa8e0a1d248d10b36faf7c467f71a5dab1b93eb29cbc01a619f4981794d1017c3db79676af83e07bd1a2b637dedf7526426cae76
7
- data.tar.gz: fe89308b9dbe265c8a0ffc87725874cb1c91d244bb79ef5b0e31c68edc8d5894b6328eccb13b7f37ed29f55ffe48d631a6aa323eff8e3b693c997497c58366e1
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.0)
5
- faraday (~> 1.7)
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 (1.8.0)
13
- faraday-em_http (~> 1.0)
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-em_http (1.0.0)
24
- faraday-em_synchrony (1.0.0)
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).
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Tiltify
2
2
  class Collection
3
- attr_reader :data, :total, :cursor
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
- cursor: body.dig("pagination", "cursor")
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:, cursor:)
16
+ def initialize(data:, total:, has_prev:, has_next:)
16
17
  @data = data
17
18
  @total = total
18
- @cursor = cursor.nil? ? nil : cursor
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,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
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tiltify
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/tiltify.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
- require "faraday_middleware"
5
4
 
6
5
  require_relative "tiltify/version"
7
6
 
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", "~> 1.7"
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.0
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: 2021-10-24 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
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
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: '1.7'
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.1.6
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