noun-project-api 3.1.4 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/noun_project_api/base_item.rb +1 -0
- data/lib/noun_project_api/collection.rb +4 -4
- data/lib/noun_project_api/icon.rb +1 -1
- data/lib/noun_project_api/icons_retriever.rb +11 -20
- data/lib/noun_project_api.rb +1 -1
- data/spec/lib/noun_project_api/icons_retriever_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- metadata +11 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a54ae4b1729039cd83078fb3539983ddcaab4a917ec5d0b24a72f83cd4a53e24
|
4
|
+
data.tar.gz: 03f70103a7b43842c63bb75a84f59103c1b13ae429daf2e8e04bf9f2b0d6dd43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a466dc9016b91a523ce7828bd3708264c84ade3130f32771a37581cd5686ad6673de50089d92d24977bd07b257c23f189cd5d1b2857155315a8d38ac1a25305
|
7
|
+
data.tar.gz: da1ab9bf4ebfa2fd397e846d7a2d21a3ec70b1399d5b985f0c5f88a6d653b7961c22febff08a4588f508bd107c850428bbac617c23e3e482a7a200ddca9445cd
|
@@ -19,17 +19,14 @@ module NounProjectApi
|
|
19
19
|
NounProjectApi.configuration.cache.fetch(cache_key, expires_in: cache_ttl) do
|
20
20
|
raise ArgumentError, "Missing search term" unless term
|
21
21
|
|
22
|
-
search = OAuth::Helper.escape(term)
|
23
|
-
search += "?limit_to_public_domain=#{NounProjectApi.configuration.public_domain ? 1 : 0}"
|
24
|
-
|
25
22
|
args = {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
limit_to_public_domain: NounProjectApi.configuration.public_domain ? 1 : 0,
|
24
|
+
limit:,
|
25
|
+
offset:,
|
26
|
+
page:
|
27
|
+
}.compact
|
31
28
|
|
32
|
-
result = access_token.get("#{API_BASE}#{API_PATH}#{
|
29
|
+
result = access_token.get("#{API_BASE}#{API_PATH}#{OAuth::Helper.escape(term)}?#{args.to_query}")
|
33
30
|
raise ServiceError.new(result.code, result.body) unless ["200", "404"].include? result.code
|
34
31
|
|
35
32
|
if result.code == "200"
|
@@ -46,18 +43,12 @@ module NounProjectApi
|
|
46
43
|
# * page - page number
|
47
44
|
def recent_uploads(limit = nil, offset = nil, page = nil)
|
48
45
|
args = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}.
|
53
|
-
if !args.empty?
|
54
|
-
search = "?"
|
55
|
-
args.each { |k, v| search += "#{k}=#{v}&" }
|
56
|
-
else
|
57
|
-
search = ""
|
58
|
-
end
|
46
|
+
limit:,
|
47
|
+
offset:,
|
48
|
+
page:
|
49
|
+
}.compact
|
59
50
|
|
60
|
-
result = access_token.get("#{API_BASE}#{API_PATH}recent_uploads
|
51
|
+
result = access_token.get("#{API_BASE}#{API_PATH}recent_uploads?#{args.to_query}")
|
61
52
|
raise ServiceError.new(result.code, result.body) unless result.code == "200"
|
62
53
|
|
63
54
|
JSON.parse(result.body, symbolize_names: true)[:recent_uploads].map { |icon| Icon.new(icon) }
|
data/lib/noun_project_api.rb
CHANGED
@@ -18,7 +18,7 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
18
18
|
expect(@icons.access_token).to receive(
|
19
19
|
:get
|
20
20
|
).with(
|
21
|
-
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}recent_uploads"
|
21
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}recent_uploads?"
|
22
22
|
).and_return(
|
23
23
|
valid_response
|
24
24
|
)
|
@@ -41,7 +41,7 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
41
41
|
expect(@icons.access_token).to receive(
|
42
42
|
:get
|
43
43
|
).with(
|
44
|
-
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}recent_uploads?limit=#{limit}
|
44
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}recent_uploads?limit=#{limit}"
|
45
45
|
).and_return(
|
46
46
|
valid_response
|
47
47
|
)
|
@@ -141,7 +141,7 @@ RSpec.describe NounProjectApi::IconsRetriever do
|
|
141
141
|
expect(@icons.access_token).to receive(
|
142
142
|
:get
|
143
143
|
).with(
|
144
|
-
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}#{OAuth::Helper.escape(term)}?
|
144
|
+
"#{NounProjectApi::API_BASE}#{NounProjectApi::IconsRetriever::API_PATH}#{OAuth::Helper.escape(term)}?limit=#{limit}&limit_to_public_domain=0"
|
145
145
|
).and_return(
|
146
146
|
valid_response
|
147
147
|
)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noun-project-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tailor Engineering
|
@@ -30,42 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faker
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.13'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.13'
|
54
|
+
version: '3.1'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,42 +72,28 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
75
|
+
version: '3.12'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
82
|
+
version: '3.12'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: rubocop
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
89
|
+
version: '1'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.79.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.79.0
|
96
|
+
version: '1'
|
125
97
|
description: A Gem to expose a wrapping API for The Noun Project API's
|
126
98
|
email: sloths@tailorbrands.com
|
127
99
|
executables: []
|
@@ -163,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
135
|
requirements:
|
164
136
|
- - ">="
|
165
137
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
138
|
+
version: '3.2'
|
167
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
140
|
requirements:
|
169
141
|
- - ">="
|