readwise 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77088f2664c1f2d285ed893bd5ef67d313971e75bfafcd5eaebb6f2e05177e62
4
- data.tar.gz: 472f2d70b184549e9be6232399f821e5b7f99a24f964d716fcec913ec7cae5bb
3
+ metadata.gz: 3430c0062c1b93b7f57032195dd68953f5747fe221104c3f9d27edac52bc6fa2
4
+ data.tar.gz: 9436565954a21d0b34b8ae7896ded212801daf05512d1fb512207272547792c9
5
5
  SHA512:
6
- metadata.gz: 1fd02d43c7ee4d4e5a47582abc46eecd25c1df344bc848df2b56bac9f6290a5a6e814432443d8f6884a6066b04713f166a3db1b022122edbf9fc0e68fdfd413b
7
- data.tar.gz: 0e261d0744c012b2b0b9d80b77f1ee5b8e22f5e908681b41d8b0aef587771abc3d66244d4eb869ba1336dad4bf0ac3dd638c1d782f37ed18b9bcf82d1f2b6710
6
+ metadata.gz: e9d2cf349ca75d6b9a21dcf60c2c8ea2af9ddff6e3aace2ecb82c748b9a1845204e1ac7c9d72c23e5a6c4dbcd9bf682c455162d72ac56b62fb5348d32f958b6f
7
+ data.tar.gz: 4fdcdc6cca2bb5a7881ee8beceb1c3096f348776839fed87c330d8bb91abd004d1ab75bff9cd9e9ce5d23b0d57c3f1ed55b34738ae9888c3fd42e72c94447dd2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.3.0] - 2023-02-28
6
+
7
+ - Change `Tag` from hash to struct ([#6](https://github.com/andjosh/readwise-ruby/pull/6) from [@ajistrying](https://github.com/ajistrying))
8
+
5
9
  ## [0.2.0] - 2023-02-20
6
10
 
7
11
  - Add support for `Book.note` ([#4](https://github.com/andjosh/readwise-ruby/pull/4))
data/README.md CHANGED
@@ -37,7 +37,7 @@ puts books.first.highlights.map(&:text) # highlights are Readwise::Highlight str
37
37
 
38
38
  ## Development
39
39
 
40
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
41
41
 
42
42
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
43
 
@@ -1,7 +1,8 @@
1
1
  require 'json'
2
2
  require 'net/http'
3
- require_relative 'book.rb'
4
- require_relative 'highlight.rb'
3
+ require_relative 'book'
4
+ require_relative 'highlight'
5
+ require_relative 'tag'
5
6
 
6
7
  module Readwise
7
8
  class Client
@@ -48,7 +49,12 @@ module Readwise
48
49
  readwise_url: item['readwise_url'],
49
50
  source: item['source'],
50
51
  source_url: item['source_url'],
51
- tags: item['book_tags'],
52
+ tags: item['book_tags'].map do |tag|
53
+ Tag.new(
54
+ tag_id: tag['id'].to_s,
55
+ name: tag['name']
56
+ )
57
+ end,
52
58
  title: item['title'],
53
59
  unique_url: item['unique_url'],
54
60
  highlights: item['highlights'].map do |highlight|
@@ -66,7 +72,12 @@ module Readwise
66
72
  location_type: highlight['location_type'],
67
73
  note: highlight['note'],
68
74
  readwise_url: highlight['readwise_url'],
69
- tags: highlight['tags'],
75
+ tags: highlight['tags'].map do |tag|
76
+ Tag.new(
77
+ tag_id: tag['id'].to_s,
78
+ name: tag['name']
79
+ )
80
+ end,
70
81
  text: highlight['text'],
71
82
  updated_at: highlight['updated_at'],
72
83
  url: highlight['url'],
@@ -0,0 +1,8 @@
1
+ module Readwise
2
+ Tag = Struct.new(
3
+ 'ReadwiseTag',
4
+ :tag_id,
5
+ :name,
6
+ keyword_init: true
7
+ )
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Readwise
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readwise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Beckman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-20 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,6 +88,7 @@ files:
88
88
  - lib/readwise/book.rb
89
89
  - lib/readwise/client.rb
90
90
  - lib/readwise/highlight.rb
91
+ - lib/readwise/tag.rb
91
92
  - lib/readwise/version.rb
92
93
  - readwise.gemspec
93
94
  homepage: https://github.com/andjosh/readwise-ruby
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  - !ruby/object:Gem::Version
114
115
  version: '0'
115
116
  requirements: []
116
- rubygems_version: 3.4.2
117
+ rubygems_version: 3.4.7
117
118
  signing_key:
118
119
  specification_version: 4
119
120
  summary: Readwise API client