fizzy-api-client 0.1.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 +7 -0
- data/CHANGELOG.md +45 -0
- data/LICENSE.txt +21 -0
- data/README.md +469 -0
- data/examples/README.md +102 -0
- data/examples/demo.rb +636 -0
- data/examples/sydney.jpg +0 -0
- data/fizzy-api-client.gemspec +31 -0
- data/lib/fizzy_api_client/client.rb +125 -0
- data/lib/fizzy_api_client/colors.rb +91 -0
- data/lib/fizzy_api_client/configuration.rb +34 -0
- data/lib/fizzy_api_client/connection.rb +215 -0
- data/lib/fizzy_api_client/error.rb +59 -0
- data/lib/fizzy_api_client/multipart.rb +59 -0
- data/lib/fizzy_api_client/pagination.rb +9 -0
- data/lib/fizzy_api_client/request.rb +50 -0
- data/lib/fizzy_api_client/resources/boards.rb +51 -0
- data/lib/fizzy_api_client/resources/cards.rb +212 -0
- data/lib/fizzy_api_client/resources/columns.rb +78 -0
- data/lib/fizzy_api_client/resources/comments.rb +45 -0
- data/lib/fizzy_api_client/resources/direct_uploads.rb +88 -0
- data/lib/fizzy_api_client/resources/identity.rb +12 -0
- data/lib/fizzy_api_client/resources/notifications.rb +29 -0
- data/lib/fizzy_api_client/resources/reactions.rb +31 -0
- data/lib/fizzy_api_client/resources/steps.rb +51 -0
- data/lib/fizzy_api_client/resources/tags.rb +11 -0
- data/lib/fizzy_api_client/resources/users.rb +75 -0
- data/lib/fizzy_api_client/response.rb +61 -0
- data/lib/fizzy_api_client/version.rb +5 -0
- data/lib/fizzy_api_client.rb +51 -0
- metadata +117 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FizzyApiClient
|
|
4
|
+
class Response
|
|
5
|
+
attr_reader :status, :headers, :body, :raw_body
|
|
6
|
+
|
|
7
|
+
def initialize(status:, headers:, raw_body:)
|
|
8
|
+
@status = status
|
|
9
|
+
@headers = normalize_headers(headers)
|
|
10
|
+
@raw_body = raw_body
|
|
11
|
+
@body = parse_body(raw_body)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def success?
|
|
15
|
+
status >= 200 && status < 300
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def no_content?
|
|
19
|
+
status == 204
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def not_modified?
|
|
23
|
+
status == 304
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def etag
|
|
27
|
+
headers["etag"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def location
|
|
31
|
+
headers["location"]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def created_with_location?
|
|
35
|
+
status == 201 && location && (raw_body.nil? || raw_body.empty?)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def next_page_url
|
|
39
|
+
link_header = headers["link"]
|
|
40
|
+
return nil unless link_header
|
|
41
|
+
|
|
42
|
+
match = link_header.match(/<([^>]+)>;\s*rel="next"/)
|
|
43
|
+
match ? match[1] : nil
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def normalize_headers(headers)
|
|
49
|
+
headers.transform_keys(&:downcase)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def parse_body(raw_body)
|
|
53
|
+
return nil if raw_body.nil? || raw_body.empty?
|
|
54
|
+
return nil if no_content? || not_modified?
|
|
55
|
+
|
|
56
|
+
JSON.parse(raw_body)
|
|
57
|
+
rescue JSON::ParserError
|
|
58
|
+
nil
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "uri"
|
|
5
|
+
require "json"
|
|
6
|
+
require "digest"
|
|
7
|
+
require "base64"
|
|
8
|
+
require "securerandom"
|
|
9
|
+
require "ostruct"
|
|
10
|
+
require "logger"
|
|
11
|
+
|
|
12
|
+
require_relative "fizzy_api_client/version"
|
|
13
|
+
require_relative "fizzy_api_client/configuration"
|
|
14
|
+
require_relative "fizzy_api_client/colors"
|
|
15
|
+
require_relative "fizzy_api_client/error"
|
|
16
|
+
require_relative "fizzy_api_client/response"
|
|
17
|
+
require_relative "fizzy_api_client/pagination"
|
|
18
|
+
require_relative "fizzy_api_client/multipart"
|
|
19
|
+
require_relative "fizzy_api_client/request"
|
|
20
|
+
require_relative "fizzy_api_client/connection"
|
|
21
|
+
|
|
22
|
+
# Resources must be loaded before Client
|
|
23
|
+
require_relative "fizzy_api_client/resources/identity"
|
|
24
|
+
require_relative "fizzy_api_client/resources/boards"
|
|
25
|
+
require_relative "fizzy_api_client/resources/cards"
|
|
26
|
+
require_relative "fizzy_api_client/resources/columns"
|
|
27
|
+
require_relative "fizzy_api_client/resources/comments"
|
|
28
|
+
require_relative "fizzy_api_client/resources/steps"
|
|
29
|
+
require_relative "fizzy_api_client/resources/reactions"
|
|
30
|
+
require_relative "fizzy_api_client/resources/tags"
|
|
31
|
+
require_relative "fizzy_api_client/resources/users"
|
|
32
|
+
require_relative "fizzy_api_client/resources/notifications"
|
|
33
|
+
require_relative "fizzy_api_client/resources/direct_uploads"
|
|
34
|
+
|
|
35
|
+
require_relative "fizzy_api_client/client"
|
|
36
|
+
|
|
37
|
+
module FizzyApiClient
|
|
38
|
+
class << self
|
|
39
|
+
def configuration
|
|
40
|
+
@configuration ||= Configuration.new
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def configure
|
|
44
|
+
yield(configuration)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def reset_configuration!
|
|
48
|
+
@configuration = Configuration.new
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fizzy-api-client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Fizzy Team
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-12-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: base64
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: ostruct
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: logger
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: A clean, idiomatic Ruby interface to the Fizzy API with minimal dependencies
|
|
56
|
+
email:
|
|
57
|
+
- support@fizzy.do
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- CHANGELOG.md
|
|
63
|
+
- LICENSE.txt
|
|
64
|
+
- README.md
|
|
65
|
+
- examples/README.md
|
|
66
|
+
- examples/demo.rb
|
|
67
|
+
- examples/sydney.jpg
|
|
68
|
+
- fizzy-api-client.gemspec
|
|
69
|
+
- lib/fizzy_api_client.rb
|
|
70
|
+
- lib/fizzy_api_client/client.rb
|
|
71
|
+
- lib/fizzy_api_client/colors.rb
|
|
72
|
+
- lib/fizzy_api_client/configuration.rb
|
|
73
|
+
- lib/fizzy_api_client/connection.rb
|
|
74
|
+
- lib/fizzy_api_client/error.rb
|
|
75
|
+
- lib/fizzy_api_client/multipart.rb
|
|
76
|
+
- lib/fizzy_api_client/pagination.rb
|
|
77
|
+
- lib/fizzy_api_client/request.rb
|
|
78
|
+
- lib/fizzy_api_client/resources/boards.rb
|
|
79
|
+
- lib/fizzy_api_client/resources/cards.rb
|
|
80
|
+
- lib/fizzy_api_client/resources/columns.rb
|
|
81
|
+
- lib/fizzy_api_client/resources/comments.rb
|
|
82
|
+
- lib/fizzy_api_client/resources/direct_uploads.rb
|
|
83
|
+
- lib/fizzy_api_client/resources/identity.rb
|
|
84
|
+
- lib/fizzy_api_client/resources/notifications.rb
|
|
85
|
+
- lib/fizzy_api_client/resources/reactions.rb
|
|
86
|
+
- lib/fizzy_api_client/resources/steps.rb
|
|
87
|
+
- lib/fizzy_api_client/resources/tags.rb
|
|
88
|
+
- lib/fizzy_api_client/resources/users.rb
|
|
89
|
+
- lib/fizzy_api_client/response.rb
|
|
90
|
+
- lib/fizzy_api_client/version.rb
|
|
91
|
+
homepage: https://github.com/robzolkos/fizzy-api-client
|
|
92
|
+
licenses:
|
|
93
|
+
- MIT
|
|
94
|
+
metadata:
|
|
95
|
+
homepage_uri: https://github.com/robzolkos/fizzy-api-client
|
|
96
|
+
source_code_uri: https://github.com/robzolkos/fizzy-api-client
|
|
97
|
+
changelog_uri: https://github.com/robzolkos/fizzy-api-client/blob/main/CHANGELOG.md
|
|
98
|
+
post_install_message:
|
|
99
|
+
rdoc_options: []
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: 3.0.0
|
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubygems_version: 3.5.22
|
|
114
|
+
signing_key:
|
|
115
|
+
specification_version: 4
|
|
116
|
+
summary: Ruby client for the Fizzy API
|
|
117
|
+
test_files: []
|