tindie_api 0.1.4 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/README.md +27 -22
- data/lib/tindie_api/version.rb +1 -1
- data/lib/tindie_api.rb +9 -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: 1779e3faf74733ae9d38c9e079b0cd48580d0b8d4d60524e653930b8bff4ba90
|
4
|
+
data.tar.gz: a030c9c6440f8ee5383ed0a9f7d41b1a29c9f569054aaa9d61c3d721df8cb52a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9805356be076b7d086d3ea557401ca2543f198f6ded69c5f858c1367c6620dee0936741e33a2c5c35dfbc22ebffe62b8036e552066fe662a821d0ac25feaccd6
|
7
|
+
data.tar.gz: 2d507819ce2ce35d0e910c283d513d04f62269af140bd260eaec0a5eb27311f0a410a327e0ccf07bf8cc2acd28b5be63c24ff010b28800089c4a984f3fe1ff53
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,44 @@
|
|
1
|
-
#
|
1
|
+
# tindie_api
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
3
|
+
## Description
|
8
4
|
|
5
|
+
tindie_api is a Ruby gem that provides a convenient interface for interacting with the Tindie API. This library simplifies the process of managing products, orders, and other Tindie-related operations programmatically.
|
6
|
+
### Installation
|
9
7
|
Add this line to your application's Gemfile:
|
10
|
-
|
11
8
|
```ruby
|
12
9
|
gem 'tindie_api'
|
13
10
|
```
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
Then execute:
|
12
|
+
```bash
|
13
|
+
bundle install
|
14
|
+
```
|
19
15
|
Or install it yourself as:
|
16
|
+
```bash
|
17
|
+
gem install tindie_api
|
18
|
+
```
|
19
|
+
## Usage
|
20
20
|
|
21
|
-
$ gem install tindie_api
|
22
21
|
|
23
|
-
|
22
|
+
Get unshipped orders
|
23
|
+
```ruby
|
24
24
|
|
25
|
-
|
25
|
+
get "/orders" do
|
26
|
+
@username = ENV['TINDIE_USERNAME']
|
27
|
+
@api_key = ENV['TINDIE_API_KEY']
|
28
|
+
@api = TindieApi::TindieOrdersAPI.new(@username, @api_key)
|
26
29
|
|
27
|
-
|
30
|
+
# false means unshipped
|
31
|
+
orders = @api.get_orders_json(false)
|
28
32
|
|
29
|
-
|
33
|
+
puts orders.inspect
|
30
34
|
|
31
|
-
|
35
|
+
erb :orders, locals: { orders: orders }
|
36
|
+
end
|
37
|
+
```
|
32
38
|
|
33
|
-
## Contributing
|
34
39
|
|
35
|
-
|
40
|
+
## Examples
|
36
41
|
|
37
|
-
|
42
|
+
See this git repo for additional examples
|
38
43
|
|
39
|
-
|
44
|
+
[spuder/packpoint](https://github.com/spuder/packpoint)
|
data/lib/tindie_api/version.rb
CHANGED
data/lib/tindie_api.rb
CHANGED
@@ -76,8 +76,16 @@ module TindieApi
|
|
76
76
|
url += "&shipped=#{shipped}" unless shipped.nil?
|
77
77
|
uri = URI(url)
|
78
78
|
response = Net::HTTP.get(uri)
|
79
|
+
|
80
|
+
if response.nil? || response.empty?
|
81
|
+
raise JSON::ParserError, "Empty response from Tindie API"
|
82
|
+
end
|
83
|
+
|
79
84
|
JSON.parse(response)
|
80
|
-
|
85
|
+
rescue JSON::ParserError => e
|
86
|
+
puts "Failed to parse JSON: #{response}"
|
87
|
+
raise e
|
88
|
+
end
|
81
89
|
|
82
90
|
def get_orders(shipped = nil)
|
83
91
|
raise ArgumentError, "shipped must be true, false, or nil" if !shipped.nil? && ![true, false].include?(shipped)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tindie_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|