data_kitten 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mjc1ZmZmMmFkOTcxZGYwMzI3ZTRiMzJlODU4ZmVlZDAxNTE0MzUwMA==
4
+ NDc5ZTUwMDA5OGJjMjg3YzI4MThmZWYzNTQ1NTkyNTNlN2JhZWU5Nw==
5
5
  data.tar.gz: !binary |-
6
- MDU3Yzc5YTU4OGQwY2Y5OWI2YThkODUzYzUyOGZlNWY5MTZmNDEyNA==
6
+ ZTkzNGQxYWIwOWU5NjliZThmZjE0Y2FkMWE1NmFhYTkwMTY2MGJhOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDM4ZmFmMDkxZmU4ZDQ5ZWY4YzdkODg5YzJhNjNjZjMzNTAxM2ExYmIyOTA4
10
- NTYyYmI0ZmJlNWFlYTI2OTk2MmE2YmY4MTg2MTkzOTliMGFiYjk3N2ZkYTE3
11
- ODIwZTM1MmI2OGU2ODcwODlhN2U1MmQxOTRkY2Q2YzZkNTNmZWU=
9
+ MGM1NjQ2ZDUzYzJiYjY5NzY1OTk1YzI0ZDZhZDQ3ZGIwZjdhNDVmYzRjNzM4
10
+ ODc2MTUyYzFiOGNmNmNjNzExZjFmMTllZmFiNDMyZThiY2VmYjEyYThkZWMz
11
+ ZmU2NjUyMDQ2MjVkYTNlYmNhNDBhOGYzYzE2Nzk3NjFmYTAyMTY=
12
12
  data.tar.gz: !binary |-
13
- M2MyYTYwZGE0ZTBkYzNhYWYwM2I5NjcxYjI1ODA4ZDlhYTgxZDFhZGYwNzAx
14
- NTU0MDQ5MjM2ZDViYzNkNmQzODk5NzEzYjZiMzNlZmEzN2YwZTM5MGM4NzYx
15
- OGQ2NTExNTc4ZWFmZWI2OWFlN2EyNzRiOWMwN2YzMTkzMDZlMTg=
13
+ ZWJhOTU2YTNkMmY3MzhiZjllNTY4YmY1MDFjNGZlZmY1MjIwODQ4ZDA5OGIz
14
+ N2YwMjk4YzM5ZWUyM2VhODJjZjgzM2QzY2JjYjA5ZDFhMTUzM2U0MGU4ZDYz
15
+ NjUxN2ExYTg0MTJlZTJkN2U2MTc1ZDZjMjBjOWQ5NzU3MWI1MGY=
@@ -33,6 +33,10 @@ module DataKitten
33
33
  attr_accessor :mbox
34
34
  alias_method :email, :mbox
35
35
 
36
+ def ==(agent)
37
+ agent.is_a?(Agent) && ([name, homepage, mbox] == [agent.name, agent.homepage, agent.mbox])
38
+ end
39
+
36
40
  end
37
41
 
38
- end
42
+ end
@@ -76,21 +76,27 @@ module DataKitten
76
76
  []
77
77
  end
78
78
 
79
+ def maintainers
80
+ extract_agent('maintainer', 'maintainer_email')
81
+ end
82
+
83
+ def contributors
84
+ extract_agent('author', 'author_email')
85
+ end
86
+
79
87
  # A list of licenses.
80
88
  #
81
89
  # @see Dataset#licenses
82
90
  def licenses
83
91
  extras = metadata["extras"] || {}
92
+ id = metadata["license_id"]
84
93
  uri = metadata["license_url"] || extras["licence_url"]
85
94
  name = metadata["license_title"] || extras["licence_url_title"]
86
- [
87
- License.new(:id => metadata["license_id"],
88
- :uri => uri,
89
- :name => name
90
- )
91
- ]
92
- rescue
93
- []
95
+ if [id, uri, name].any?
96
+ [License.new(:id => id, :uri => uri, :name => name)]
97
+ else
98
+ []
99
+ end
94
100
  end
95
101
 
96
102
  # A list of distributions, referred to as +resources+ by Datapackage.
@@ -183,6 +189,16 @@ module DataKitten
183
189
  URI(self.uri)
184
190
  end
185
191
 
192
+ def extract_agent(name_field, email_field)
193
+ name = metadata[name_field]
194
+ email = metadata[email_field]
195
+ if [name, email].any?
196
+ [Agent.new(name: name, mbox: email)]
197
+ else
198
+ []
199
+ end
200
+ end
201
+
186
202
  end
187
203
  end
188
204
  end
@@ -1,3 +1,3 @@
1
1
  module DataKitten
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_kitten
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-21 00:00:00.000000000 Z
12
+ date: 2015-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake