rapa 0.4.3 → 0.5.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
  SHA1:
3
- metadata.gz: 8bd38493bf8dc357c7e8f6a890e069e8984619a2
4
- data.tar.gz: 2ecbbcbfe1fa8247091cf0edc5a29d1da58b0dfe
3
+ metadata.gz: ba56ed4d0f79d06ce45915f60dc5ed2fd6ac38f3
4
+ data.tar.gz: 86c164c8995ab818595635f083ceaca0d35dda73
5
5
  SHA512:
6
- metadata.gz: 6b6c9e6f1949755b23a3eff5d16f5dd918efa57ba3914df14d6256fd44ee66aa84e6e621236982143306b8bd08dc70bd4b49f1e232b554cb802eb5c900fd5af0
7
- data.tar.gz: db6cf97ba37b5a9bc29e9e429a152bea61890f50366d58633d183d043cd088b7489103f7d2ddb8ae5327e653a954a9894d62f0caef300cfc910723c3ff116676
6
+ metadata.gz: f21d89d645bc4fd1946c65814c8d244c50f8a1e3e3c17a137e41e86853093b9e99e73f19f0a06ca0bb31eb37c05bf243a0f28658173238e9693b30649d241308
7
+ data.tar.gz: 529162027e85321d942ad5b792de862cc8c9044446d1cc05c0e23e082d3f81cd20c4549689f3f6ceca84533ec41d20abfd71004be4d755db2982f64648cd3b17
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.5.0
2
+
3
+ - Change `Rapa::Resources::ItemResource#browse_nodes` returned value type
4
+ - Add `Rapa::BrowseNode#ancestors`
5
+ - Add `Rapa::BrowseNode#self_or_ancestors`
6
+
1
7
  ## v0.4.3
2
8
 
3
9
  - Add `Rapa::Resources::ItemResource#ebook?`
@@ -8,12 +8,25 @@ module Rapa
8
8
  @source = source
9
9
  end
10
10
 
11
+ # @return [Array<Rapa::BrowseNode>]
12
+ def ancestors
13
+ array = []
14
+ current = self
15
+ while parent = current.parent do
16
+ array << parent
17
+ current = parent
18
+ end
19
+ array
20
+ end
21
+
11
22
  # @return [Array<Rapa::BrowseNode>, nil]
12
23
  def children
13
24
  if child_sources = source.dig("Children", "BrowseNode")
14
25
  child_sources.map do |child_source|
15
26
  ::Rapa::BrowseNode.new(child_source)
16
27
  end
28
+ else
29
+ []
17
30
  end
18
31
  end
19
32
 
@@ -34,6 +47,11 @@ module Rapa
34
47
  end
35
48
  end
36
49
 
50
+ # @return [Array<Rapa::BrowseNode>]
51
+ def self_or_ancestors
52
+ [self] + ancestors
53
+ end
54
+
37
55
  # @return [String]
38
56
  def title
39
57
  source["Title"]
@@ -38,7 +38,9 @@ module Rapa
38
38
 
39
39
  # @return [Array, nil]
40
40
  def browse_nodes
41
- source.dig("BrowseNodes", "BrowseNode")
41
+ source.dig("BrowseNodes", "BrowseNode").map do |browse_node_source|
42
+ ::Rapa::BrowseNode.new(browse_node_source)
43
+ end
42
44
  end
43
45
 
44
46
  # @return [String, nil]
data/lib/rapa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rapa
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5.0"
3
3
  end
data/rapa.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.13"
24
24
  spec.add_development_dependency "petitest", "~> 0.3.1"
25
25
  spec.add_development_dependency "petitest-power_assert"
26
- spec.add_development_dependency "petitest-spec"
26
+ spec.add_development_dependency "petitest-spec", ">= 0.3.2"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "timecop"
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-26 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.3.2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.3.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement