noun-project-api 0.2.1 → 3.0.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 +5 -5
- data/lib/noun-project-api.rb +14 -9
- data/lib/noun-project-api/base_item.rb +26 -0
- data/lib/noun-project-api/collection.rb +34 -0
- data/lib/noun-project-api/collection_retriever.rb +12 -0
- data/lib/noun-project-api/connection.rb +1 -1
- data/lib/noun-project-api/errors.rb +12 -0
- data/lib/noun-project-api/icon.rb +8 -21
- data/lib/noun-project-api/icon_retriever.rb +4 -12
- data/lib/noun-project-api/icons_retriever.rb +30 -18
- data/lib/noun-project-api/reporter.rb +8 -4
- data/lib/noun-project-api/retriever.rb +10 -0
- data/spec/lib/noun-project-api/base_item_spec.rb +11 -0
- data/spec/lib/noun-project-api/collection_retriever_spec.rb +85 -0
- data/spec/lib/noun-project-api/collection_spec.rb +64 -0
- data/spec/lib/noun-project-api/icon_retriever_spec.rb +15 -15
- data/spec/lib/noun-project-api/icon_spec.rb +16 -16
- data/spec/lib/noun-project-api/icons_retriever_spec.rb +20 -20
- data/spec/lib/noun-project-api/reporter_spec.rb +24 -21
- data/spec/lib/noun-project-api/retriever_spec.rb +8 -8
- data/spec/lib/nount_project_api_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -4
- data/spec/support/fakes.rb +81 -0
- metadata +73 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc6c2457656761dd7e1bed16e52f00c5558a4f632a354f3fa7c626b90664b09b
|
4
|
+
data.tar.gz: 184f196a2a7d1da39cc8988d0f7384374220a12a66cb495c06d52a53a3ee74ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf73f5f81a56f940567d2bff8b9dbeb0631d9e7f32f973bf5a29a2f541356420e5651a3c2d48705cd6823890a18d9f71ca2b45c4ad709fe80fad72c8ae41e473
|
7
|
+
data.tar.gz: ae830b9869b6b10dea4b2287d511f7274692b6875776074d9c46eb5a706f0f63e984088eccb07b938087bbe943904ef4cc68762b74eee195db6c883985245bcf
|
data/lib/noun-project-api.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
1
|
+
require "oauth"
|
2
|
+
require "active_support"
|
3
|
+
require "json"
|
4
|
+
require "noun-project-api/errors"
|
5
|
+
require "noun-project-api/connection"
|
6
|
+
require "noun-project-api/icon_retriever"
|
7
|
+
require "noun-project-api/reporter"
|
8
|
+
require "noun-project-api/icons_retriever"
|
9
|
+
require "noun-project-api/icon"
|
10
|
+
require "noun-project-api/collection_retriever"
|
11
|
+
require "noun-project-api/collection"
|
8
12
|
|
9
13
|
# Top level name space for the entire Gem.
|
10
14
|
module NounProjectApi
|
11
|
-
API_BASE =
|
15
|
+
API_BASE = "http://api.thenounproject.com".freeze
|
12
16
|
|
13
17
|
def self.configuration
|
14
18
|
@configuration ||= Configuration.new
|
@@ -21,10 +25,11 @@ module NounProjectApi
|
|
21
25
|
|
22
26
|
# Main configuration class.
|
23
27
|
class Configuration
|
24
|
-
attr_accessor :public_domain
|
28
|
+
attr_accessor :public_domain, :cache
|
25
29
|
|
26
30
|
def initialize
|
27
31
|
@public_domain = false
|
32
|
+
@cache = ActiveSupport::Cache::NullStore.new
|
28
33
|
end
|
29
34
|
end
|
30
35
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module NounProjectApi
|
2
|
+
# A basis to Items returned by the noun project.
|
3
|
+
class BaseItem
|
4
|
+
attr_accessor :original_hash
|
5
|
+
ITEM_NAME = nil
|
6
|
+
|
7
|
+
def initialize(origin)
|
8
|
+
raise NotImplementedError.new("Must use a subclass") if self.class::ITEM_NAME.nil?
|
9
|
+
|
10
|
+
origin = JSON.parse(origin) if origin.is_a? String
|
11
|
+
origin = origin.delete(
|
12
|
+
self.class::ITEM_NAME
|
13
|
+
) if origin.key? self.class::ITEM_NAME
|
14
|
+
|
15
|
+
@original_hash = origin
|
16
|
+
end
|
17
|
+
|
18
|
+
def id
|
19
|
+
original_hash["id"].to_i
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json
|
23
|
+
JSON.dump(to_hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "noun-project-api/base_item"
|
2
|
+
|
3
|
+
module NounProjectApi
|
4
|
+
# A single Collection as an abstracted ruby object.
|
5
|
+
class Collection < BaseItem
|
6
|
+
ITEM_NAME = "collection".freeze
|
7
|
+
|
8
|
+
def author_id
|
9
|
+
original_hash["author_id"].to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
def author_name
|
13
|
+
original_hash["author"]["name"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def icon_count
|
17
|
+
original_hash["icon_count"].to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
def is_published?
|
21
|
+
original_hash["is_published"].to_i == 1
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
{
|
26
|
+
id: id,
|
27
|
+
author_id: author_id,
|
28
|
+
author_name: author_name,
|
29
|
+
icon_count: icon_count,
|
30
|
+
is_published: is_published?
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "noun-project-api/collection"
|
2
|
+
require "noun-project-api/retriever"
|
3
|
+
|
4
|
+
module NounProjectApi
|
5
|
+
# Retrieve a collection.
|
6
|
+
class CollectionRetriever < Retriever
|
7
|
+
API_PATH = "/collection/".freeze
|
8
|
+
ITEM_CLASS = Collection
|
9
|
+
|
10
|
+
alias_method :find_by_slug, :find
|
11
|
+
end
|
12
|
+
end
|
@@ -6,7 +6,7 @@ module NounProjectApi
|
|
6
6
|
def initialize(token, secret)
|
7
7
|
@token = token
|
8
8
|
@secret = secret
|
9
|
-
|
9
|
+
raise ArgumentError.new("Missing token or secret") unless @token && @secret
|
10
10
|
|
11
11
|
@access_token = OAuth::AccessToken.new(OAuth::Consumer.new(token, secret))
|
12
12
|
end
|
@@ -1,36 +1,27 @@
|
|
1
|
+
require "noun-project-api/base_item"
|
2
|
+
|
1
3
|
module NounProjectApi
|
2
4
|
# A single Icon as an abstracted ruby object.
|
3
|
-
class Icon
|
5
|
+
class Icon < BaseItem
|
4
6
|
PREVIEW_SIZE_200 = 200
|
5
7
|
PREVIEW_SIZE_42 = 42
|
6
8
|
PREVIEW_SIZE_84 = 84
|
7
9
|
|
8
|
-
PUBLIC_DOMAIN_LICENSE =
|
9
|
-
|
10
|
-
attr_accessor :original_hash
|
11
|
-
|
12
|
-
def initialize(origin)
|
13
|
-
origin = JSON.parse(origin) if origin.is_a? String
|
14
|
-
origin = origin.delete('icon') if origin.key? 'icon'
|
15
|
-
|
16
|
-
@original_hash = origin
|
17
|
-
end
|
10
|
+
PUBLIC_DOMAIN_LICENSE = "public-domain".freeze
|
18
11
|
|
19
|
-
|
20
|
-
original_hash['id'].to_i
|
21
|
-
end
|
12
|
+
ITEM_NAME = "icon".freeze
|
22
13
|
|
23
14
|
def public_domain?
|
24
|
-
original_hash[
|
15
|
+
original_hash["license_description"] == PUBLIC_DOMAIN_LICENSE
|
25
16
|
end
|
26
17
|
|
27
18
|
def svg_url
|
28
|
-
original_hash[
|
19
|
+
original_hash["icon_url"]
|
29
20
|
end
|
30
21
|
|
31
22
|
def preview_url(size = PREVIEW_SIZE_200)
|
32
23
|
if size == PREVIEW_SIZE_200
|
33
|
-
original_hash[
|
24
|
+
original_hash["preview_url"]
|
34
25
|
else
|
35
26
|
original_hash["preview_url_#{size}"]
|
36
27
|
end
|
@@ -44,9 +35,5 @@ module NounProjectApi
|
|
44
35
|
preview_url_42: preview_url(PREVIEW_SIZE_42)
|
45
36
|
}
|
46
37
|
end
|
47
|
-
|
48
|
-
def to_json
|
49
|
-
JSON.dump(to_hash)
|
50
|
-
end
|
51
38
|
end
|
52
39
|
end
|
@@ -1,19 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "noun-project-api/icon"
|
2
|
+
require "noun-project-api/retriever"
|
2
3
|
|
3
4
|
module NounProjectApi
|
4
5
|
# Retrieve an icon.
|
5
6
|
class IconRetriever < Retriever
|
6
|
-
API_PATH =
|
7
|
-
|
8
|
-
# Find an icon based on it's id.
|
9
|
-
def find(id)
|
10
|
-
fail(ArgumentError, 'Missing id/slug') unless id
|
11
|
-
|
12
|
-
result = access_token.get("#{API_BASE}#{API_PATH}#{id}")
|
13
|
-
fail(ArgumentError, 'Bad request') unless result.code == '200'
|
14
|
-
|
15
|
-
Icon.new(result.body)
|
16
|
-
end
|
7
|
+
API_PATH = "/icon/".freeze
|
8
|
+
ITEM_CLASS = Icon
|
17
9
|
|
18
10
|
alias_method :find_by_slug, :find
|
19
11
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "noun-project-api/retriever"
|
2
2
|
|
3
3
|
module NounProjectApi
|
4
4
|
# Retrieve icons.
|
5
5
|
class IconsRetriever < Retriever
|
6
|
-
API_PATH =
|
6
|
+
API_PATH = "/icons/".freeze
|
7
7
|
|
8
8
|
# Finds multiple icons based on the term
|
9
9
|
# * term - search term
|
@@ -11,21 +11,29 @@ module NounProjectApi
|
|
11
11
|
# * offset - offset the results
|
12
12
|
# * page - page number
|
13
13
|
def find(term, limit = nil, offset = nil, page = nil)
|
14
|
-
|
14
|
+
cache_key = Digest::MD5.hexdigest("#{term}+#{limit}+#{offset}+#{page}")
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
NounProjectApi.configuration.cache.fetch(cache_key) do
|
17
|
+
raise ArgumentError.new("Missing search term") unless term
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
search = OAuth::Helper.escape(term)
|
20
|
+
search += "?limit_to_public_domain=#{NounProjectApi.configuration.public_domain ? 1 : 0}"
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
args = {
|
23
|
+
"limit" => limit,
|
24
|
+
"offset" => offset,
|
25
|
+
"page" => page
|
26
|
+
}.reject { |_, v| v.nil? }
|
27
|
+
args.each { |k, v| search += "&#{k}=#{v}" } if args.size > 0
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
result = access_token.get("#{API_BASE}#{API_PATH}#{search}")
|
30
|
+
raise ServiceError.new(result.code, result.body) unless %w(200 404).include? result.code
|
31
|
+
|
32
|
+
if result.code == "200"
|
33
|
+
JSON.parse(result.body)["icons"].map { |icon| Icon.new(icon) }
|
34
|
+
else
|
35
|
+
[]
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
39
|
|
@@ -34,18 +42,22 @@ module NounProjectApi
|
|
34
42
|
# * offset - offset the results
|
35
43
|
# * page - page number
|
36
44
|
def recent_uploads(limit = nil, offset = nil, page = nil)
|
37
|
-
args = {
|
45
|
+
args = {
|
46
|
+
"limit" => limit,
|
47
|
+
"offset" => offset,
|
48
|
+
"page" => page
|
49
|
+
}.reject { |_, v| v.nil? }
|
38
50
|
if args.size > 0
|
39
|
-
search =
|
51
|
+
search = "?"
|
40
52
|
args.each { |k, v| search += "#{k}=#{v}&" }
|
41
53
|
else
|
42
|
-
search =
|
54
|
+
search = ""
|
43
55
|
end
|
44
56
|
|
45
57
|
result = access_token.get("#{API_BASE}#{API_PATH}recent_uploads#{search}")
|
46
|
-
|
58
|
+
raise ServiceError.new(result.code, result.body) unless result.code == "200"
|
47
59
|
|
48
|
-
JSON.parse(result.body)[
|
60
|
+
JSON.parse(result.body)["recent_uploads"].map { |icon| Icon.new(icon) }
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
@@ -3,14 +3,18 @@ module NounProjectApi
|
|
3
3
|
class Reporter
|
4
4
|
include Connection
|
5
5
|
|
6
|
-
API_PATH =
|
6
|
+
API_PATH = "/notify/publish".freeze
|
7
7
|
|
8
8
|
def report_used(ids)
|
9
9
|
ids = [ids] if ids.is_a?(String) || ids.is_a?(Fixnum)
|
10
|
-
|
10
|
+
raise ArgumentError.new("Missing ids") if ids.nil? || ids.empty?
|
11
11
|
|
12
|
-
result = access_token.post(
|
13
|
-
|
12
|
+
result = access_token.post(
|
13
|
+
"#{API_BASE}#{API_PATH}",
|
14
|
+
{ icons: ids.join(",") }.to_json,
|
15
|
+
"Accept" => "application/json", "Content-Type" => "application/json"
|
16
|
+
)
|
17
|
+
result.code == "200"
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -2,5 +2,15 @@ module NounProjectApi
|
|
2
2
|
# A base class for different retriever classes.
|
3
3
|
class Retriever
|
4
4
|
include Connection
|
5
|
+
|
6
|
+
# Find an item based on it's id.
|
7
|
+
def find(id)
|
8
|
+
raise ArgumentError.new("Missing id/slug") unless id
|
9
|
+
|
10
|
+
result = access_token.get("#{API_BASE}#{self.class::API_PATH}#{id}")
|
11
|
+
raise ServiceError.new(result.code, result.body) unless result.code == "200"
|
12
|
+
|
13
|
+
self.class::ITEM_CLASS.new(result.body)
|
14
|
+
end
|
5
15
|
end
|
6
16
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
RSpec.describe NounProjectApi::BaseItem do
|
5
|
+
it "raises an error on direct initialization" do
|
6
|
+
data = JSON.parse(Fakes::Results::ICON_VALID)
|
7
|
+
expect {
|
8
|
+
NounProjectApi::BaseItem.new(JSON.dump(data["icon"]))
|
9
|
+
}.to raise_error(NotImplementedError)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
RSpec.describe NounProjectApi::CollectionRetriever do
|
5
|
+
before :each do
|
6
|
+
@collection = NounProjectApi::CollectionRetriever.new(Faker::Internet.password(min_length: 16), Faker::Internet.password(min_length: 16))
|
7
|
+
@valid_hash = JSON.parse(Fakes::Results::COLLECTION_VALID)
|
8
|
+
@valid_response = OpenStruct.new(
|
9
|
+
body: Fakes::Results::COLLECTION_VALID,
|
10
|
+
code: "200"
|
11
|
+
)
|
12
|
+
|
13
|
+
@missing_response = OpenStruct.new(
|
14
|
+
code: "404"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
context "id" do
|
19
|
+
it "raises an error when no id is provided" do
|
20
|
+
expect { @collection.find(nil) }.to raise_error(ArgumentError)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns a proper result with a correct id" do
|
24
|
+
id = 1
|
25
|
+
expect(@collection.access_token).to receive(
|
26
|
+
:get
|
27
|
+
).with(
|
28
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::CollectionRetriever::API_PATH}#{id}"
|
29
|
+
).and_return(
|
30
|
+
@valid_response
|
31
|
+
)
|
32
|
+
|
33
|
+
result = @collection.find(id)
|
34
|
+
expect(result).to be_a(NounProjectApi::Collection)
|
35
|
+
expect(result.original_hash).to eq(@valid_hash["collection"])
|
36
|
+
end
|
37
|
+
|
38
|
+
it "raises an error with a missing id" do
|
39
|
+
id = 1
|
40
|
+
expect(@collection.access_token).to receive(
|
41
|
+
:get
|
42
|
+
).with(
|
43
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::CollectionRetriever::API_PATH}#{id}"
|
44
|
+
).and_return(
|
45
|
+
@missing_response
|
46
|
+
)
|
47
|
+
|
48
|
+
expect { @collection.find(id) }.to raise_error(NounProjectApi::ServiceError)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "slug" do
|
53
|
+
it "raises an error when no slug is provided" do
|
54
|
+
expect { @collection.find_by_slug(nil) }.to raise_error(ArgumentError)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns a proper result with a correct slug" do
|
58
|
+
slug = "existing_slug"
|
59
|
+
expect(@collection.access_token).to receive(
|
60
|
+
:get
|
61
|
+
).with(
|
62
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::CollectionRetriever::API_PATH}#{slug}"
|
63
|
+
).and_return(
|
64
|
+
@valid_response
|
65
|
+
)
|
66
|
+
|
67
|
+
result = @collection.find(slug)
|
68
|
+
expect(result).to be_a(NounProjectApi::Collection)
|
69
|
+
expect(result.original_hash).to eq(@valid_hash["collection"])
|
70
|
+
end
|
71
|
+
|
72
|
+
it "raises an error with a missing slug" do
|
73
|
+
slug = "missing_slug"
|
74
|
+
expect(@collection.access_token).to receive(
|
75
|
+
:get
|
76
|
+
).with(
|
77
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::CollectionRetriever::API_PATH}#{slug}"
|
78
|
+
).and_return(
|
79
|
+
@missing_response
|
80
|
+
)
|
81
|
+
|
82
|
+
expect { @collection.find_by_slug(slug) }.to raise_error(NounProjectApi::ServiceError)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
RSpec.describe NounProjectApi::CollectionRetriever do
|
5
|
+
it "raises an error on empty initialization input" do
|
6
|
+
expect { NounProjectApi::Collection.new }.to raise_error(ArgumentError)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "accepts JSON string input" do
|
10
|
+
data = JSON.parse(Fakes::Results::COLLECTION_VALID)
|
11
|
+
expect { NounProjectApi::Collection.new(JSON.dump(data["collection"])) }.to_not raise_error
|
12
|
+
end
|
13
|
+
|
14
|
+
it "accepts JSON string input with collection encapsulation" do
|
15
|
+
expect { NounProjectApi::Collection.new(Fakes::Results::COLLECTION_VALID) }.to_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it "accepts hash input" do
|
19
|
+
data = JSON.parse(Fakes::Results::COLLECTION_VALID)
|
20
|
+
expect { NounProjectApi::Collection.new(data) }.to_not raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
context "exposed attributes" do
|
24
|
+
before :each do
|
25
|
+
@json = JSON.parse(Fakes::Results::COLLECTION_VALID)
|
26
|
+
@valid_collection = NounProjectApi::Collection.new(Fakes::Results::COLLECTION_VALID)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "id as number" do
|
30
|
+
expect(@valid_collection.id).to be_a(Fixnum)
|
31
|
+
expect(@valid_collection.id).to eq(@json["collection"]["id"].to_i)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "author id as number" do
|
35
|
+
expect(@valid_collection.author_id).to eq(@json["collection"]["author_id"].to_i)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "author name" do
|
39
|
+
expect(@valid_collection.author_name).to eq(@json["collection"]["author"]["name"])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "icon count as number" do
|
43
|
+
expect(@valid_collection.icon_count).to eq(@json["collection"]["icon_count"].to_i)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "is published" do
|
47
|
+
expect(@valid_collection.is_published?).to eq(@json["collection"]["is_published"].to_i == 1)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "builds a simple hash" do
|
51
|
+
expect(@valid_collection.to_hash).to eq({
|
52
|
+
id: @valid_collection.id,
|
53
|
+
author_id: @valid_collection.author_id,
|
54
|
+
author_name: @valid_collection.author_name,
|
55
|
+
icon_count: @valid_collection.icon_count,
|
56
|
+
is_published: @valid_collection.is_published?
|
57
|
+
})
|
58
|
+
end
|
59
|
+
|
60
|
+
it "json formats the hash" do
|
61
|
+
expect(@valid_collection.to_json).to eq JSON.dump @valid_collection.to_hash
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
3
|
|
4
4
|
RSpec.describe NounProjectApi::IconRetriever do
|
5
5
|
before :each do
|
6
|
-
@icon = NounProjectApi::IconRetriever.new(Faker::Internet.password(16), Faker::Internet.password(16))
|
6
|
+
@icon = NounProjectApi::IconRetriever.new(Faker::Internet.password(min_length: 16), Faker::Internet.password(min_length: 16))
|
7
7
|
@valid_hash = JSON.parse(Fakes::Results::ICON_VALID)
|
8
8
|
@valid_response = OpenStruct.new(
|
9
9
|
body: Fakes::Results::ICON_VALID,
|
10
|
-
code:
|
10
|
+
code: "200"
|
11
11
|
)
|
12
12
|
|
13
13
|
@missing_response = OpenStruct.new(
|
14
|
-
code:
|
14
|
+
code: "404"
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
18
18
|
context "id" do
|
19
|
-
it
|
19
|
+
it "raises an error when no id is provided" do
|
20
20
|
expect { @icon.find(nil) }.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it "returns a proper result with a correct id" do
|
24
24
|
id = 1
|
25
25
|
expect(@icon.access_token).to receive(
|
26
26
|
:get
|
@@ -35,7 +35,7 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
35
35
|
expect(result.original_hash).to eq(@valid_hash["icon"])
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "raises an error with a missing id" do
|
39
39
|
id = 1
|
40
40
|
expect(@icon.access_token).to receive(
|
41
41
|
:get
|
@@ -45,17 +45,17 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
45
45
|
@missing_response
|
46
46
|
)
|
47
47
|
|
48
|
-
expect { @icon.find(id) }.to raise_error(
|
48
|
+
expect { @icon.find(id) }.to raise_error(NounProjectApi::ServiceError)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
context "slug" do
|
53
|
-
it
|
53
|
+
it "raises an error when no slug is provided" do
|
54
54
|
expect { @icon.find_by_slug(nil) }.to raise_error(ArgumentError)
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
58
|
-
slug =
|
57
|
+
it "returns a proper result with a correct slug" do
|
58
|
+
slug = "existing_slug"
|
59
59
|
expect(@icon.access_token).to receive(
|
60
60
|
:get
|
61
61
|
).with(
|
@@ -69,8 +69,8 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
69
69
|
expect(result.original_hash).to eq(@valid_hash["icon"])
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
slug =
|
72
|
+
it "raises an error with a missing slug" do
|
73
|
+
slug = "missing_slug"
|
74
74
|
expect(@icon.access_token).to receive(
|
75
75
|
:get
|
76
76
|
).with(
|
@@ -79,7 +79,7 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
79
79
|
@missing_response
|
80
80
|
)
|
81
81
|
|
82
|
-
expect { @icon.find_by_slug(slug) }.to raise_error(
|
82
|
+
expect { @icon.find_by_slug(slug) }.to raise_error(NounProjectApi::ServiceError)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
3
|
|
4
4
|
RSpec.describe NounProjectApi::IconRetriever do
|
5
|
-
it
|
5
|
+
it "raises an error on empty initialization input" do
|
6
6
|
expect { NounProjectApi::Icon.new }.to raise_error(ArgumentError)
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
9
|
+
it "accepts JSON string input" do
|
10
10
|
data = JSON.parse(Fakes::Results::ICON_VALID)
|
11
11
|
expect { NounProjectApi::Icon.new(JSON.dump(data["icon"])) }.to_not raise_error
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it "accepts JSON string input with icon encapsulation" do
|
15
15
|
expect { NounProjectApi::Icon.new(Fakes::Results::ICON_VALID) }.to_not raise_error
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it "accepts hash input" do
|
19
19
|
data = JSON.parse(Fakes::Results::ICON_VALID)
|
20
20
|
expect { NounProjectApi::Icon.new(data) }.to_not raise_error
|
21
21
|
end
|
@@ -26,42 +26,42 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
26
26
|
@valid_icon = NounProjectApi::Icon.new(Fakes::Results::ICON_VALID)
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it "public domain" do
|
30
30
|
expect(@valid_icon.public_domain?).to eq(@json["icon"]["license_description"] == "public-domain")
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it "SVG url" do
|
34
34
|
expect(@valid_icon.svg_url).to eq(@json["icon"]["icon_url"])
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
37
|
+
it "nil on missing SVG url" do
|
38
38
|
@json["icon"].delete("icon_url")
|
39
39
|
icon = NounProjectApi::Icon.new(@json)
|
40
40
|
expect(icon.svg_url).to be_nil
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it "preview url defaults at 200 size" do
|
44
44
|
expect(@valid_icon.preview_url).to eq(@json["icon"]["preview_url"])
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
47
|
+
it "preview url for 200 size" do
|
48
48
|
expect(@valid_icon.preview_url(NounProjectApi::Icon::PREVIEW_SIZE_200)).to eq(@json["icon"]["preview_url"])
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
51
|
+
it "preview url for 84 size" do
|
52
52
|
expect(@valid_icon.preview_url(NounProjectApi::Icon::PREVIEW_SIZE_84)).to eq(@json["icon"]["preview_url_84"])
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
55
|
+
it "preview url for 42 size" do
|
56
56
|
expect(@valid_icon.preview_url(NounProjectApi::Icon::PREVIEW_SIZE_42)).to eq(@json["icon"]["preview_url_42"])
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
59
|
+
it "id as number" do
|
60
60
|
expect(@valid_icon.id).to be_a(Fixnum)
|
61
61
|
expect(@valid_icon.id).to eq(@json["icon"]["id"].to_i)
|
62
62
|
end
|
63
63
|
|
64
|
-
it
|
64
|
+
it "builds a simple hash" do
|
65
65
|
expect(@valid_icon.to_hash).to eq({
|
66
66
|
id: @valid_icon.id,
|
67
67
|
preview_url_200: @valid_icon.preview_url(NounProjectApi::Icon::PREVIEW_SIZE_200),
|
@@ -70,7 +70,7 @@ RSpec.describe NounProjectApi::IconRetriever do
|
|
70
70
|
})
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
73
|
+
it "json formats the hash" do
|
74
74
|
expect(@valid_icon.to_json).to eq JSON.dump @valid_icon.to_hash
|
75
75
|
end
|
76
76
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe NounProjectApi::IconsRetriever do
|
4
4
|
before :each do
|
5
|
-
@icons = NounProjectApi::IconsRetriever.new(Faker::Internet.password(16), Faker::Internet.password(16))
|
5
|
+
@icons = NounProjectApi::IconsRetriever.new(Faker::Internet.password(min_length: 16), Faker::Internet.password(min_length: 16))
|
6
6
|
end
|
7
7
|
|
8
8
|
context "recent uploads" do
|
@@ -10,7 +10,7 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
10
10
|
valid_hash = JSON.parse(Fakes::Results::ICONS_RECENT_VALID)
|
11
11
|
valid_response = OpenStruct.new(
|
12
12
|
body: Fakes::Results::ICONS_RECENT_VALID,
|
13
|
-
code:
|
13
|
+
code: "200"
|
14
14
|
)
|
15
15
|
|
16
16
|
expect(@icons.access_token).to receive(
|
@@ -31,7 +31,7 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
31
31
|
it "returns the recent uploads and passes limit when passed" do
|
32
32
|
valid_response = OpenStruct.new(
|
33
33
|
body: Fakes::Results::ICONS_RECENT_VALID,
|
34
|
-
code:
|
34
|
+
code: "200"
|
35
35
|
)
|
36
36
|
|
37
37
|
limit = 3
|
@@ -53,18 +53,18 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
context "Icons search" do
|
56
|
-
it
|
56
|
+
it "raises an error when no phrase is provided" do
|
57
57
|
expect { @icons.find(nil) }.to raise_error(ArgumentError)
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it "properly URI encodes search patterns" do
|
61
61
|
valid_hash = JSON.parse(Fakes::Results::ICONS_VALID)
|
62
62
|
valid_response = OpenStruct.new(
|
63
63
|
body: Fakes::Results::ICONS_VALID,
|
64
|
-
code:
|
64
|
+
code: "200"
|
65
65
|
)
|
66
66
|
|
67
|
-
term =
|
67
|
+
term = "some search with \",] bad chars"
|
68
68
|
expect(@icons.access_token).to receive(
|
69
69
|
:get
|
70
70
|
).with(
|
@@ -80,14 +80,14 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
it
|
83
|
+
it "returns a proper result with a correct phrase" do
|
84
84
|
valid_hash = JSON.parse(Fakes::Results::ICONS_VALID)
|
85
85
|
valid_response = OpenStruct.new(
|
86
86
|
body: Fakes::Results::ICONS_VALID,
|
87
|
-
code:
|
87
|
+
code: "200"
|
88
88
|
)
|
89
89
|
|
90
|
-
term =
|
90
|
+
term = "some search"
|
91
91
|
expect(@icons.access_token).to receive(
|
92
92
|
:get
|
93
93
|
).with(
|
@@ -103,14 +103,14 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
it
|
106
|
+
it "properly handles public domain only config" do
|
107
107
|
valid_hash = JSON.parse(Fakes::Results::ICONS_VALID)
|
108
108
|
valid_response = OpenStruct.new(
|
109
109
|
body: Fakes::Results::ICONS_VALID,
|
110
|
-
code:
|
110
|
+
code: "200"
|
111
111
|
)
|
112
112
|
|
113
|
-
term =
|
113
|
+
term = "some search"
|
114
114
|
expect(@icons.access_token).to receive(
|
115
115
|
:get
|
116
116
|
).with(
|
@@ -128,13 +128,13 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
128
128
|
NounProjectApi.configuration.public_domain = false
|
129
129
|
end
|
130
130
|
|
131
|
-
it
|
131
|
+
it "returns a proper result with a correct phrase and passes the args" do
|
132
132
|
valid_response = OpenStruct.new(
|
133
133
|
body: Fakes::Results::ICONS_VALID,
|
134
|
-
code:
|
134
|
+
code: "200"
|
135
135
|
)
|
136
136
|
|
137
|
-
term =
|
137
|
+
term = "some search"
|
138
138
|
limit = 4
|
139
139
|
expect(@icons.access_token).to receive(
|
140
140
|
:get
|
@@ -151,12 +151,12 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
it
|
154
|
+
it "returns an empty array for no result" do
|
155
155
|
missing_response = OpenStruct.new(
|
156
|
-
code:
|
156
|
+
code: "404"
|
157
157
|
)
|
158
158
|
|
159
|
-
term =
|
159
|
+
term = "missing search"
|
160
160
|
expect(@icons.access_token).to receive(
|
161
161
|
:get
|
162
162
|
).with(
|
@@ -1,34 +1,34 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe NounProjectApi::Reporter do
|
4
|
-
it
|
5
|
-
expect { NounProjectApi::Reporter.new(nil, Faker::Internet.password(16)) }.to raise_error(ArgumentError)
|
4
|
+
it "raises an error when initialized without token" do
|
5
|
+
expect { NounProjectApi::Reporter.new(nil, Faker::Internet.password(min_length: 16)) }.to raise_error(ArgumentError)
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
9
|
-
expect { NounProjectApi::Reporter.new(Faker::Internet.password(16), nil) }.to raise_error(ArgumentError)
|
8
|
+
it "raises an error when initialized without secret" do
|
9
|
+
expect { NounProjectApi::Reporter.new(Faker::Internet.password(min_length: 16), nil) }.to raise_error(ArgumentError)
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
token = Faker::Internet.password(16)
|
14
|
-
secret = Faker::Internet.password(16)
|
12
|
+
it "initializes the values properly" do
|
13
|
+
token = Faker::Internet.password(min_length: 16)
|
14
|
+
secret = Faker::Internet.password(min_length: 16)
|
15
15
|
reporter = NounProjectApi::Reporter.new(token, secret)
|
16
16
|
|
17
17
|
expect(reporter.token).to eq(token)
|
18
18
|
expect(reporter.secret).to eq(secret)
|
19
19
|
end
|
20
20
|
|
21
|
-
context
|
21
|
+
context "reports ids usage" do
|
22
22
|
before :each do
|
23
|
-
token = Faker::Internet.password(16)
|
24
|
-
secret = Faker::Internet.password(16)
|
23
|
+
token = Faker::Internet.password(min_length: 16)
|
24
|
+
secret = Faker::Internet.password(min_length: 16)
|
25
25
|
@reporter = NounProjectApi::Reporter.new(token, secret)
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
28
|
+
it "reports a singular id" do
|
29
29
|
valid_response = OpenStruct.new(
|
30
30
|
body: Fakes::Results::REPORTED_ONE,
|
31
|
-
code:
|
31
|
+
code: "200"
|
32
32
|
)
|
33
33
|
|
34
34
|
id = 122
|
@@ -37,7 +37,8 @@ RSpec.describe NounProjectApi::Reporter do
|
|
37
37
|
:post
|
38
38
|
).with(
|
39
39
|
"#{NounProjectApi::API_BASE}#{NounProjectApi::Reporter::API_PATH}",
|
40
|
-
icons: id.to_s
|
40
|
+
{ icons: id.to_s }.to_json,
|
41
|
+
"Accept" => "application/json", "Content-Type" => "application/json"
|
41
42
|
).and_return(
|
42
43
|
valid_response
|
43
44
|
)
|
@@ -46,19 +47,20 @@ RSpec.describe NounProjectApi::Reporter do
|
|
46
47
|
expect(result).to be true
|
47
48
|
end
|
48
49
|
|
49
|
-
it
|
50
|
+
it "reports a singular id for a string" do
|
50
51
|
valid_response = OpenStruct.new(
|
51
52
|
body: Fakes::Results::REPORTED_ONE,
|
52
|
-
code:
|
53
|
+
code: "200"
|
53
54
|
)
|
54
55
|
|
55
|
-
id =
|
56
|
+
id = "122"
|
56
57
|
|
57
58
|
expect(@reporter.access_token).to receive(
|
58
59
|
:post
|
59
60
|
).with(
|
60
61
|
"#{NounProjectApi::API_BASE}#{NounProjectApi::Reporter::API_PATH}",
|
61
|
-
icons: id
|
62
|
+
{ icons: id }.to_json,
|
63
|
+
"Accept" => "application/json", "Content-Type" => "application/json"
|
62
64
|
).and_return(
|
63
65
|
valid_response
|
64
66
|
)
|
@@ -69,10 +71,10 @@ RSpec.describe NounProjectApi::Reporter do
|
|
69
71
|
|
70
72
|
|
71
73
|
|
72
|
-
it
|
74
|
+
it "reports multiple ids" do
|
73
75
|
valid_response = OpenStruct.new(
|
74
76
|
body: Fakes::Results::REPORTED_ONE,
|
75
|
-
code:
|
77
|
+
code: "200"
|
76
78
|
)
|
77
79
|
|
78
80
|
ids = [122, 4541, 342_11, 4352]
|
@@ -81,7 +83,8 @@ RSpec.describe NounProjectApi::Reporter do
|
|
81
83
|
:post
|
82
84
|
).with(
|
83
85
|
"#{NounProjectApi::API_BASE}#{NounProjectApi::Reporter::API_PATH}",
|
84
|
-
icons: ids.join(
|
86
|
+
{ icons: ids.join(",") }.to_json,
|
87
|
+
"Accept" => "application/json", "Content-Type" => "application/json"
|
85
88
|
).and_return(
|
86
89
|
valid_response
|
87
90
|
)
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe NounProjectApi::Retriever do
|
4
|
-
it
|
5
|
-
expect { NounProjectApi::Retriever.new(nil, Faker::Internet.password(16)) }.to raise_error(ArgumentError)
|
4
|
+
it "raises an error when initialized without token" do
|
5
|
+
expect { NounProjectApi::Retriever.new(nil, Faker::Internet.password(min_length: 16)) }.to raise_error(ArgumentError)
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
9
|
-
expect { NounProjectApi::Retriever.new(Faker::Internet.password(16), nil) }.to raise_error(ArgumentError)
|
8
|
+
it "raises an error when initialized without secret" do
|
9
|
+
expect { NounProjectApi::Retriever.new(Faker::Internet.password(min_length: 16), nil) }.to raise_error(ArgumentError)
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
token = Faker::Internet.password(16)
|
14
|
-
secret = Faker::Internet.password(16)
|
12
|
+
it "initializes the values properly" do
|
13
|
+
token = Faker::Internet.password(min_length: 16)
|
14
|
+
secret = Faker::Internet.password(min_length: 16)
|
15
15
|
retriever = NounProjectApi::Retriever.new(token, secret)
|
16
16
|
|
17
17
|
expect(retriever.token).to eq(token)
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe NounProjectApi do
|
4
|
-
it
|
4
|
+
it "has the correct default" do
|
5
5
|
expect(NounProjectApi.configuration.public_domain).to be false
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
8
|
+
it "sets the correct configuration" do
|
9
9
|
expect(NounProjectApi.configuration.public_domain).to be false
|
10
10
|
|
11
11
|
NounProjectApi.configure do |config|
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/fakes.rb
CHANGED
@@ -308,5 +308,86 @@ module Fakes
|
|
308
308
|
"licenses_consumed": 1,
|
309
309
|
"result": "success"
|
310
310
|
}'''
|
311
|
+
|
312
|
+
COLLECTION_VALID = '''
|
313
|
+
{
|
314
|
+
"collection": {
|
315
|
+
"author": {
|
316
|
+
"location": "US",
|
317
|
+
"name": "irene hoffman",
|
318
|
+
"permalink": "/i",
|
319
|
+
"username": "i"
|
320
|
+
},
|
321
|
+
"author_id": "5562",
|
322
|
+
"date_created": "2014-06-27 00:22:22",
|
323
|
+
"date_updated": "2014-06-27 00:22:22",
|
324
|
+
"description": "",
|
325
|
+
"icon_count": "4",
|
326
|
+
"id": "321",
|
327
|
+
"is_collaborative": "",
|
328
|
+
"is_featured": "0",
|
329
|
+
"is_published": "1",
|
330
|
+
"is_store_item": "0",
|
331
|
+
"name": "genetics",
|
332
|
+
"permalink": "/i/collection/genetics",
|
333
|
+
"slug": "genetics",
|
334
|
+
"sponsor": {},
|
335
|
+
"sponsor_campaign_link": "",
|
336
|
+
"sponsor_id": "",
|
337
|
+
"tags": [
|
338
|
+
"genetics",
|
339
|
+
"chromosome",
|
340
|
+
"gene",
|
341
|
+
"heredity",
|
342
|
+
"genetic code",
|
343
|
+
"nucleic acid",
|
344
|
+
"RNA",
|
345
|
+
"DNA",
|
346
|
+
"deoxyribonucleic acid",
|
347
|
+
"reproduction",
|
348
|
+
"genome",
|
349
|
+
"human",
|
350
|
+
"chemistry",
|
351
|
+
"Allele",
|
352
|
+
"Amelogenin",
|
353
|
+
"bases",
|
354
|
+
"building blocks",
|
355
|
+
"cytosine",
|
356
|
+
"guanine",
|
357
|
+
"thymine",
|
358
|
+
"adenine",
|
359
|
+
"c",
|
360
|
+
"G",
|
361
|
+
"T",
|
362
|
+
"CGTA",
|
363
|
+
"A",
|
364
|
+
"biological",
|
365
|
+
"cell",
|
366
|
+
"CODIS",
|
367
|
+
"blueprint of life",
|
368
|
+
"life",
|
369
|
+
"material",
|
370
|
+
"nucleus",
|
371
|
+
"inherited",
|
372
|
+
"parent",
|
373
|
+
"unique",
|
374
|
+
"analysis",
|
375
|
+
"double helix",
|
376
|
+
"helix",
|
377
|
+
"forensic",
|
378
|
+
"loci",
|
379
|
+
"genotype",
|
380
|
+
"haplotype",
|
381
|
+
"junk DNA",
|
382
|
+
"match",
|
383
|
+
"nuclear",
|
384
|
+
"paternal",
|
385
|
+
"sequence",
|
386
|
+
"sequencing"
|
387
|
+
],
|
388
|
+
"template": "24"
|
389
|
+
}
|
390
|
+
}
|
391
|
+
'''
|
311
392
|
end
|
312
393
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noun-project-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nadav Shatz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|
@@ -16,12 +16,26 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
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
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
@@ -30,62 +44,84 @@ dependencies:
|
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
47
|
+
version: '13.0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
54
|
+
version: '13.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 3.1.0
|
61
|
+
version: '3.9'
|
51
62
|
type: :development
|
52
63
|
prerelease: false
|
53
64
|
version_requirements: !ruby/object:Gem::Requirement
|
54
65
|
requirements:
|
55
66
|
- - "~>"
|
56
67
|
- !ruby/object:Gem::Version
|
57
|
-
version: '3.
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 3.1.0
|
68
|
+
version: '3.9'
|
61
69
|
- !ruby/object:Gem::Dependency
|
62
70
|
name: faker
|
63
71
|
requirement: !ruby/object:Gem::Requirement
|
64
72
|
requirements:
|
65
73
|
- - "~>"
|
66
74
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
75
|
+
version: '2.13'
|
68
76
|
type: :development
|
69
77
|
prerelease: false
|
70
78
|
version_requirements: !ruby/object:Gem::Requirement
|
71
79
|
requirements:
|
72
80
|
- - "~>"
|
73
81
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
82
|
+
version: '2.13'
|
75
83
|
- !ruby/object:Gem::Dependency
|
76
84
|
name: semver
|
77
85
|
requirement: !ruby/object:Gem::Requirement
|
78
86
|
requirements:
|
79
87
|
- - "~>"
|
80
88
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
89
|
+
version: '1.0'
|
82
90
|
type: :development
|
83
91
|
prerelease: false
|
84
92
|
version_requirements: !ruby/object:Gem::Requirement
|
85
93
|
requirements:
|
86
94
|
- - "~>"
|
87
95
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec_junit_formatter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.4'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.13'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.13'
|
89
125
|
description: A Gem to expose a wrapping API for The Noun Project API's
|
90
126
|
email: nadav@tailorbrands.com
|
91
127
|
executables: []
|
@@ -94,12 +130,19 @@ extra_rdoc_files: []
|
|
94
130
|
files:
|
95
131
|
- Rakefile
|
96
132
|
- lib/noun-project-api.rb
|
133
|
+
- lib/noun-project-api/base_item.rb
|
134
|
+
- lib/noun-project-api/collection.rb
|
135
|
+
- lib/noun-project-api/collection_retriever.rb
|
97
136
|
- lib/noun-project-api/connection.rb
|
137
|
+
- lib/noun-project-api/errors.rb
|
98
138
|
- lib/noun-project-api/icon.rb
|
99
139
|
- lib/noun-project-api/icon_retriever.rb
|
100
140
|
- lib/noun-project-api/icons_retriever.rb
|
101
141
|
- lib/noun-project-api/reporter.rb
|
102
142
|
- lib/noun-project-api/retriever.rb
|
143
|
+
- spec/lib/noun-project-api/base_item_spec.rb
|
144
|
+
- spec/lib/noun-project-api/collection_retriever_spec.rb
|
145
|
+
- spec/lib/noun-project-api/collection_spec.rb
|
103
146
|
- spec/lib/noun-project-api/icon_retriever_spec.rb
|
104
147
|
- spec/lib/noun-project-api/icon_spec.rb
|
105
148
|
- spec/lib/noun-project-api/icons_retriever_spec.rb
|
@@ -112,7 +155,7 @@ homepage: https://github.com/TailorBrands/noun-project-api
|
|
112
155
|
licenses:
|
113
156
|
- MIT
|
114
157
|
metadata: {}
|
115
|
-
post_install_message:
|
158
|
+
post_install_message:
|
116
159
|
rdoc_options: []
|
117
160
|
require_paths:
|
118
161
|
- lib
|
@@ -127,17 +170,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
170
|
- !ruby/object:Gem::Version
|
128
171
|
version: '0'
|
129
172
|
requirements: []
|
130
|
-
|
131
|
-
|
132
|
-
signing_key:
|
173
|
+
rubygems_version: 3.1.2
|
174
|
+
signing_key:
|
133
175
|
specification_version: 4
|
134
176
|
summary: An API wrapper for The Noun Project API's
|
135
177
|
test_files:
|
136
|
-
- spec/lib/noun-project-api/icon_retriever_spec.rb
|
137
|
-
- spec/lib/noun-project-api/icon_spec.rb
|
138
|
-
- spec/lib/noun-project-api/icons_retriever_spec.rb
|
139
|
-
- spec/lib/noun-project-api/reporter_spec.rb
|
140
|
-
- spec/lib/noun-project-api/retriever_spec.rb
|
141
|
-
- spec/lib/nount_project_api_spec.rb
|
142
178
|
- spec/spec_helper.rb
|
143
179
|
- spec/support/fakes.rb
|
180
|
+
- spec/lib/nount_project_api_spec.rb
|
181
|
+
- spec/lib/noun-project-api/collection_spec.rb
|
182
|
+
- spec/lib/noun-project-api/icon_spec.rb
|
183
|
+
- spec/lib/noun-project-api/base_item_spec.rb
|
184
|
+
- spec/lib/noun-project-api/collection_retriever_spec.rb
|
185
|
+
- spec/lib/noun-project-api/retriever_spec.rb
|
186
|
+
- spec/lib/noun-project-api/icon_retriever_spec.rb
|
187
|
+
- spec/lib/noun-project-api/reporter_spec.rb
|
188
|
+
- spec/lib/noun-project-api/icons_retriever_spec.rb
|