GiphyClient 1.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 +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/GiphyClient.gemspec +44 -0
- data/README.md +152 -0
- data/Rakefile +7 -0
- data/config.json +18 -0
- data/docs/BaseChannelModel.md +36 -0
- data/docs/BaseChannelModelGifs.md +9 -0
- data/docs/Breadcrumb.md +10 -0
- data/docs/Category.md +11 -0
- data/docs/ChannelWithChildrenModel.md +37 -0
- data/docs/ChannelWithChildrenModelChildren.md +9 -0
- data/docs/DefaultApi.md +731 -0
- data/docs/Gif.md +36 -0
- data/docs/GifImages.md +27 -0
- data/docs/GifImagesDownsized.md +11 -0
- data/docs/GifImagesDownsizedLarge.md +11 -0
- data/docs/GifImagesDownsizedMedium.md +11 -0
- data/docs/GifImagesDownsizedSmall.md +11 -0
- data/docs/GifImagesDownsizedStill.md +10 -0
- data/docs/GifImagesFixedHeight.md +15 -0
- data/docs/GifImagesFixedHeightDownsampled.md +13 -0
- data/docs/GifImagesFixedHeightSmall.md +15 -0
- data/docs/GifImagesFixedHeightSmallStill.md +10 -0
- data/docs/GifImagesFixedHeightStill.md +10 -0
- data/docs/GifImagesFixedWidth.md +15 -0
- data/docs/GifImagesFixedWidthDownsampled.md +13 -0
- data/docs/GifImagesFixedWidthSmall.md +15 -0
- data/docs/GifImagesFixedWidthSmallStill.md +10 -0
- data/docs/GifImagesFixedWidthStill.md +10 -0
- data/docs/GifImagesLooping.md +8 -0
- data/docs/GifImagesOriginal.md +16 -0
- data/docs/GifImagesOriginalStill.md +10 -0
- data/docs/GifImagesPreview.md +11 -0
- data/docs/GifImagesPreviewGif.md +11 -0
- data/docs/InlineResponse200.md +10 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse2002.md +9 -0
- data/docs/InlineResponse2003.md +10 -0
- data/docs/InlineResponse2004.md +10 -0
- data/docs/InlineResponse2005.md +10 -0
- data/docs/InlineResponse400.md +8 -0
- data/docs/LastChildModel.md +37 -0
- data/docs/LastChildModelChildren.md +9 -0
- data/docs/MetaContent.md +10 -0
- data/docs/MetaObject.md +8 -0
- data/docs/Pagination.md +10 -0
- data/docs/RandomGif.md +30 -0
- data/docs/ShallowTag.md +9 -0
- data/docs/Tag.md +9 -0
- data/docs/TrendingTag.md +10 -0
- data/docs/User.md +13 -0
- data/generate.sh +12 -0
- data/git_push.sh +55 -0
- data/lib/GiphyClient.rb +84 -0
- data/lib/GiphyClient/api/default_api.rb +952 -0
- data/lib/GiphyClient/api_client.rb +375 -0
- data/lib/GiphyClient/api_error.rb +37 -0
- data/lib/GiphyClient/configuration.rb +195 -0
- data/lib/GiphyClient/models/base_channel_model.rb +464 -0
- data/lib/GiphyClient/models/base_channel_model_gifs.rb +198 -0
- data/lib/GiphyClient/models/breadcrumb.rb +205 -0
- data/lib/GiphyClient/models/category.rb +220 -0
- data/lib/GiphyClient/models/channel_with_children_model.rb +473 -0
- data/lib/GiphyClient/models/channel_with_children_model_children.rb +198 -0
- data/lib/GiphyClient/models/gif.rb +473 -0
- data/lib/GiphyClient/models/gif_images.rb +358 -0
- data/lib/GiphyClient/models/gif_images_downsized.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_large.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_medium.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_small.rb +218 -0
- data/lib/GiphyClient/models/gif_images_downsized_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_height.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_downsampled.rb +238 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_small.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_small_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_height_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_width.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_downsampled.rb +238 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_small.rb +258 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_small_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_fixed_width_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_looping.rb +188 -0
- data/lib/GiphyClient/models/gif_images_original.rb +268 -0
- data/lib/GiphyClient/models/gif_images_original_still.rb +208 -0
- data/lib/GiphyClient/models/gif_images_preview.rb +218 -0
- data/lib/GiphyClient/models/gif_images_preview_gif.rb +218 -0
- data/lib/GiphyClient/models/inline_response_200.rb +209 -0
- data/lib/GiphyClient/models/inline_response_200_1.rb +197 -0
- data/lib/GiphyClient/models/inline_response_200_2.rb +197 -0
- data/lib/GiphyClient/models/inline_response_200_3.rb +207 -0
- data/lib/GiphyClient/models/inline_response_200_4.rb +207 -0
- data/lib/GiphyClient/models/inline_response_200_5.rb +207 -0
- data/lib/GiphyClient/models/inline_response_400.rb +187 -0
- data/lib/GiphyClient/models/last_child_model.rb +473 -0
- data/lib/GiphyClient/models/last_child_model_children.rb +198 -0
- data/lib/GiphyClient/models/meta_content.rb +218 -0
- data/lib/GiphyClient/models/meta_object.rb +187 -0
- data/lib/GiphyClient/models/pagination.rb +208 -0
- data/lib/GiphyClient/models/random_gif.rb +401 -0
- data/lib/GiphyClient/models/shallow_tag.rb +198 -0
- data/lib/GiphyClient/models/tag.rb +198 -0
- data/lib/GiphyClient/models/trending_tag.rb +205 -0
- data/lib/GiphyClient/models/user.rb +238 -0
- data/lib/GiphyClient/version.rb +14 -0
- data/public.yaml +1638 -0
- data/spec/api/default_api_spec.rb +260 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/base_channel_model_gifs_spec.rb +47 -0
- data/spec/models/base_channel_model_spec.rb +209 -0
- data/spec/models/breadcrumb_spec.rb +53 -0
- data/spec/models/category_spec.rb +59 -0
- data/spec/models/channel_with_children_model_children_spec.rb +47 -0
- data/spec/models/channel_with_children_model_spec.rb +215 -0
- data/spec/models/gif_images_downsized_large_spec.rb +59 -0
- data/spec/models/gif_images_downsized_medium_spec.rb +59 -0
- data/spec/models/gif_images_downsized_small_spec.rb +59 -0
- data/spec/models/gif_images_downsized_spec.rb +59 -0
- data/spec/models/gif_images_downsized_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_height_downsampled_spec.rb +71 -0
- data/spec/models/gif_images_fixed_height_small_spec.rb +83 -0
- data/spec/models/gif_images_fixed_height_small_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_height_spec.rb +83 -0
- data/spec/models/gif_images_fixed_height_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_width_downsampled_spec.rb +71 -0
- data/spec/models/gif_images_fixed_width_small_spec.rb +83 -0
- data/spec/models/gif_images_fixed_width_small_still_spec.rb +53 -0
- data/spec/models/gif_images_fixed_width_spec.rb +83 -0
- data/spec/models/gif_images_fixed_width_still_spec.rb +53 -0
- data/spec/models/gif_images_looping_spec.rb +41 -0
- data/spec/models/gif_images_original_spec.rb +89 -0
- data/spec/models/gif_images_original_still_spec.rb +53 -0
- data/spec/models/gif_images_preview_gif_spec.rb +59 -0
- data/spec/models/gif_images_preview_spec.rb +59 -0
- data/spec/models/gif_images_spec.rb +155 -0
- data/spec/models/gif_spec.rb +209 -0
- data/spec/models/inline_response_200_1_spec.rb +47 -0
- data/spec/models/inline_response_200_2_spec.rb +47 -0
- data/spec/models/inline_response_200_3_spec.rb +53 -0
- data/spec/models/inline_response_200_4_spec.rb +53 -0
- data/spec/models/inline_response_200_5_spec.rb +53 -0
- data/spec/models/inline_response_200_spec.rb +53 -0
- data/spec/models/inline_response_400_spec.rb +41 -0
- data/spec/models/last_child_model_children_spec.rb +47 -0
- data/spec/models/last_child_model_spec.rb +215 -0
- data/spec/models/meta_content_spec.rb +53 -0
- data/spec/models/meta_object_spec.rb +41 -0
- data/spec/models/pagination_spec.rb +53 -0
- data/spec/models/random_gif_spec.rb +173 -0
- data/spec/models/shallow_tag_spec.rb +47 -0
- data/spec/models/tag_spec.rb +47 -0
- data/spec/models/trending_tag_spec.rb +53 -0
- data/spec/models/user_spec.rb +71 -0
- data/spec/spec_helper.rb +110 -0
- metadata +428 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#giphy-api
|
|
3
|
+
|
|
4
|
+
#Giphy's public api.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.9.3
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'spec_helper'
|
|
13
|
+
require 'json'
|
|
14
|
+
|
|
15
|
+
# Unit tests for GiphyClient::DefaultApi
|
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
17
|
+
# Please update as you see appropriate
|
|
18
|
+
describe 'DefaultApi' do
|
|
19
|
+
before do
|
|
20
|
+
# run before each test
|
|
21
|
+
@instance = GiphyClient::DefaultApi.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
after do
|
|
25
|
+
# run after each test
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe 'test an instance of DefaultApi' do
|
|
29
|
+
it 'should create an instact of DefaultApi' do
|
|
30
|
+
expect(@instance).to be_instance_of(GiphyClient::DefaultApi)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# unit tests for gifs_categories_category_get
|
|
35
|
+
# Category Tags Endpoint.
|
|
36
|
+
# Returns a list of tags for a given category. NOTE `limit` and `offset` must both be set; otherwise they're ignored.
|
|
37
|
+
# @param api_key Giphy API Key.
|
|
38
|
+
# @param category Filters results by category.
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
41
|
+
# @option opts [Integer] :offset An optional results offset. Defaults to 0.
|
|
42
|
+
# @return [InlineResponse2004]
|
|
43
|
+
describe 'gifs_categories_category_get test' do
|
|
44
|
+
it "should work" do
|
|
45
|
+
resp = @instance.gifs_categories_category_get("dc6zaTOxFJmzC", "actions", {limit: 10, offset: 0})
|
|
46
|
+
expect(resp.data.count).to eq(10)
|
|
47
|
+
resp.data.each do |item|
|
|
48
|
+
expect(item.name).to_not be_empty
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# unit tests for gifs_categories_category_tag_get
|
|
54
|
+
# Tagged Gifs Endpoint.
|
|
55
|
+
# Returns a list of gifs for a given tag (alias to `/gif/search`).
|
|
56
|
+
# @param api_key Giphy API Key.
|
|
57
|
+
# @param category Filters results by category.
|
|
58
|
+
# @param tag Filters results by tag.
|
|
59
|
+
# @param [Hash] opts the optional parameters
|
|
60
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
61
|
+
# @option opts [Integer] :offset An optional results offset. Defaults to 0.
|
|
62
|
+
# @return [InlineResponse2005]
|
|
63
|
+
describe 'gifs_categories_category_tag_get test' do
|
|
64
|
+
it "should work" do
|
|
65
|
+
resp = @instance.gifs_categories_category_tag_get("dc6zaTOxFJmzC", "actions", "breaking-up", {limit: 10, offset: 0})
|
|
66
|
+
expect(resp.data.count).to eq(10)
|
|
67
|
+
resp.data.each do |item|
|
|
68
|
+
expect(item.url).to_not be_empty
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# unit tests for gifs_categories_get
|
|
74
|
+
# Categories Endpoint.
|
|
75
|
+
# Returns a list of categories.
|
|
76
|
+
# @param api_key Giphy API Key.
|
|
77
|
+
# @param [Hash] opts the optional parameters
|
|
78
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
79
|
+
# @return [InlineResponse2003]
|
|
80
|
+
describe 'gifs_categories_get test' do
|
|
81
|
+
it "should work" do
|
|
82
|
+
resp = @instance.gifs_categories_get("dc6zaTOxFJmzC", {limit: 10})
|
|
83
|
+
expect(resp.data.count).to eq(10)
|
|
84
|
+
resp.data.each do |item|
|
|
85
|
+
expect(item.name).to_not be_empty
|
|
86
|
+
expect(item.name_encoded).to_not be_empty
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# unit tests for gifs_get
|
|
92
|
+
# Get GIFs by ID Endpoint
|
|
93
|
+
# A multiget version of the get GIF by ID endpoint.
|
|
94
|
+
# @param api_key Giphy API Key.
|
|
95
|
+
# @param ids Filters results by specified GIF IDs, separated by commas.
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @return [InlineResponse200]
|
|
98
|
+
describe 'gifs_get test' do
|
|
99
|
+
it "should work" do
|
|
100
|
+
resp = @instance.gifs_get("dc6zaTOxFJmzC", "YfCuW2maPixri,BeL3iFbYzAsfu")
|
|
101
|
+
expect(resp.data.count).to eq(2)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# unit tests for gifs_gif_id_get
|
|
106
|
+
# Get GIF by ID Endpoint
|
|
107
|
+
# Returns a GIF given that GIF's unique ID
|
|
108
|
+
# @param api_key Giphy API Key.
|
|
109
|
+
# @param gif_id Filters results by specified GIF ID.
|
|
110
|
+
# @param [Hash] opts the optional parameters
|
|
111
|
+
# @return [InlineResponse2001]
|
|
112
|
+
describe 'gifs_gif_id_get test' do
|
|
113
|
+
it "should work" do
|
|
114
|
+
resp = @instance.gifs_gif_id_get("dc6zaTOxFJmzC", "YfCuW2maPixri")
|
|
115
|
+
expect(resp.data.id).to eq("YfCuW2maPixri")
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# unit tests for gifs_random_get
|
|
120
|
+
# Random Endpoint
|
|
121
|
+
# Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog.
|
|
122
|
+
# @param api_key Giphy API Key.
|
|
123
|
+
# @param [Hash] opts the optional parameters
|
|
124
|
+
# @option opts [String] :tag Filters results by specified tag.
|
|
125
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
126
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
127
|
+
# @return [InlineResponse2002]
|
|
128
|
+
describe 'gifs_random_get test' do
|
|
129
|
+
it "should work" do
|
|
130
|
+
resp = @instance.gifs_random_get("dc6zaTOxFJmzC")
|
|
131
|
+
expect(resp.data.url).to_not be_empty
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# unit tests for gifs_search_get
|
|
136
|
+
# Search Endpoint
|
|
137
|
+
# Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho.
|
|
138
|
+
# @param api_key Giphy API Key.
|
|
139
|
+
# @param q Search query term or prhase.
|
|
140
|
+
# @param [Hash] opts the optional parameters
|
|
141
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
142
|
+
# @option opts [Integer] :offset An optional results offset. Defaults to 0.
|
|
143
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
144
|
+
# @option opts [String] :lang Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>.
|
|
145
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
146
|
+
# @return [InlineResponse200]
|
|
147
|
+
describe 'gifs_search_get test' do
|
|
148
|
+
it "should work" do
|
|
149
|
+
resp = @instance.gifs_search_get("dc6zaTOxFJmzC", "cats", {limit: 10})
|
|
150
|
+
expect(resp.data.count).to eq(10)
|
|
151
|
+
resp.data.each do |item|
|
|
152
|
+
expect(item.url).to_not be_empty
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# unit tests for gifs_translate_get
|
|
158
|
+
# Translate Endpoint
|
|
159
|
+
# The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs.
|
|
160
|
+
# @param api_key Giphy API Key.
|
|
161
|
+
# @param s Search term.
|
|
162
|
+
# @param [Hash] opts the optional parameters
|
|
163
|
+
# @return [InlineResponse2001]
|
|
164
|
+
describe 'gifs_translate_get test' do
|
|
165
|
+
it "should work" do
|
|
166
|
+
resp = @instance.gifs_translate_get("dc6zaTOxFJmzC", "cats")
|
|
167
|
+
expect(resp.data.url).to_not be_empty
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# unit tests for gifs_trending_get
|
|
172
|
+
# Trending GIFs Endpoint
|
|
173
|
+
# Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default.
|
|
174
|
+
# @param api_key Giphy API Key.
|
|
175
|
+
# @param [Hash] opts the optional parameters
|
|
176
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
177
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
178
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
179
|
+
# @return [InlineResponse200]
|
|
180
|
+
describe 'gifs_trending_get test' do
|
|
181
|
+
it "should work" do
|
|
182
|
+
resp = @instance.gifs_trending_get("dc6zaTOxFJmzC", {limit: 10})
|
|
183
|
+
expect(resp.data.count).to eq(10)
|
|
184
|
+
resp.data.each do |item|
|
|
185
|
+
expect(item.url).to_not be_empty
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# unit tests for stickers_random_get
|
|
191
|
+
# Random Sticker Endpoint
|
|
192
|
+
# Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog.
|
|
193
|
+
# @param api_key Giphy API Key.
|
|
194
|
+
# @param [Hash] opts the optional parameters
|
|
195
|
+
# @option opts [String] :tag Filters results by specified tag.
|
|
196
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
197
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
198
|
+
# @return [InlineResponse2002]
|
|
199
|
+
describe 'stickers_random_get test' do
|
|
200
|
+
it "should work" do
|
|
201
|
+
resp = @instance.stickers_random_get("dc6zaTOxFJmzC")
|
|
202
|
+
expect(resp.data.url).to_not be_empty
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# unit tests for stickers_search_get
|
|
207
|
+
# Sticker Search Endpoint
|
|
208
|
+
# Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs.
|
|
209
|
+
# @param api_key Giphy API Key.
|
|
210
|
+
# @param q Search query term or prhase.
|
|
211
|
+
# @param [Hash] opts the optional parameters
|
|
212
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
213
|
+
# @option opts [Integer] :offset An optional results offset. Defaults to 0.
|
|
214
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
215
|
+
# @option opts [String] :lang Specify default country for regional content; use a 2-letter ISO 639-1 country code. See list of supported languages <a href = \"../language-support\">here</a>.
|
|
216
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
217
|
+
# @return [InlineResponse200]
|
|
218
|
+
describe 'stickers_search_get test' do
|
|
219
|
+
it "should work" do
|
|
220
|
+
resp = @instance.stickers_search_get("dc6zaTOxFJmzC", "cats", {limit: 10})
|
|
221
|
+
expect(resp.data.count).to eq(10)
|
|
222
|
+
resp.data.each do |item|
|
|
223
|
+
expect(item.url).to_not be_empty
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# unit tests for stickers_translate_get
|
|
229
|
+
# Sticker Translate Endpoint
|
|
230
|
+
# The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs.
|
|
231
|
+
# @param api_key Giphy API Key.
|
|
232
|
+
# @param s Search term.
|
|
233
|
+
# @param [Hash] opts the optional parameters
|
|
234
|
+
# @return [InlineResponse2001]
|
|
235
|
+
describe 'stickers_translate_get test' do
|
|
236
|
+
it "should work" do
|
|
237
|
+
resp = @instance.gifs_translate_get("dc6zaTOxFJmzC", "cats")
|
|
238
|
+
expect(resp.data.url).to_not be_empty
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# unit tests for stickers_trending_get
|
|
243
|
+
# Trending Stickers Endpoint
|
|
244
|
+
# Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default.
|
|
245
|
+
# @param api_key Giphy API Key.
|
|
246
|
+
# @param [Hash] opts the optional parameters
|
|
247
|
+
# @option opts [Integer] :limit The maximum number of records to return.
|
|
248
|
+
# @option opts [String] :rating Filters results by specified rating.
|
|
249
|
+
# @option opts [String] :fmt Used to indicate the expected response format. Default is Json.
|
|
250
|
+
# @return [InlineResponse200]
|
|
251
|
+
describe 'stickers_trending_get test' do
|
|
252
|
+
it "should work" do
|
|
253
|
+
resp = @instance.stickers_trending_get("dc6zaTOxFJmzC", {limit: 10})
|
|
254
|
+
expect(resp.data.count).to eq(10)
|
|
255
|
+
resp.data.each do |item|
|
|
256
|
+
expect(item.url).to_not be_empty
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#giphy-api
|
|
3
|
+
|
|
4
|
+
#Giphy's public api.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.9.3
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'spec_helper'
|
|
13
|
+
|
|
14
|
+
describe GiphyClient::ApiClient do
|
|
15
|
+
context 'initialization' do
|
|
16
|
+
context 'URL stuff' do
|
|
17
|
+
context 'host' do
|
|
18
|
+
it 'removes http from host' do
|
|
19
|
+
GiphyClient.configure { |c| c.host = 'http://example.com' }
|
|
20
|
+
expect(GiphyClient::Configuration.default.host).to eq('example.com')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'removes https from host' do
|
|
24
|
+
GiphyClient.configure { |c| c.host = 'https://wookiee.com' }
|
|
25
|
+
expect(GiphyClient::ApiClient.default.config.host).to eq('wookiee.com')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'removes trailing path from host' do
|
|
29
|
+
GiphyClient.configure { |c| c.host = 'hobo.com/v4' }
|
|
30
|
+
expect(GiphyClient::Configuration.default.host).to eq('hobo.com')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'base_path' do
|
|
35
|
+
it "prepends a slash to base_path" do
|
|
36
|
+
GiphyClient.configure { |c| c.base_path = 'v4/dog' }
|
|
37
|
+
expect(GiphyClient::Configuration.default.base_path).to eq('/v4/dog')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "doesn't prepend a slash if one is already there" do
|
|
41
|
+
GiphyClient.configure { |c| c.base_path = '/v4/dog' }
|
|
42
|
+
expect(GiphyClient::Configuration.default.base_path).to eq('/v4/dog')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "ends up as a blank string if nil" do
|
|
46
|
+
GiphyClient.configure { |c| c.base_path = nil }
|
|
47
|
+
expect(GiphyClient::Configuration.default.base_path).to eq('')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe "params_encoding in #build_request" do
|
|
54
|
+
let(:config) { GiphyClient::Configuration.new }
|
|
55
|
+
let(:api_client) { GiphyClient::ApiClient.new(config) }
|
|
56
|
+
|
|
57
|
+
it "defaults to nil" do
|
|
58
|
+
expect(GiphyClient::Configuration.default.params_encoding).to eq(nil)
|
|
59
|
+
expect(config.params_encoding).to eq(nil)
|
|
60
|
+
|
|
61
|
+
request = api_client.build_request(:get, '/test')
|
|
62
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "can be customized" do
|
|
66
|
+
config.params_encoding = :multi
|
|
67
|
+
request = api_client.build_request(:get, '/test')
|
|
68
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe "timeout in #build_request" do
|
|
73
|
+
let(:config) { GiphyClient::Configuration.new }
|
|
74
|
+
let(:api_client) { GiphyClient::ApiClient.new(config) }
|
|
75
|
+
|
|
76
|
+
it "defaults to 0" do
|
|
77
|
+
expect(GiphyClient::Configuration.default.timeout).to eq(0)
|
|
78
|
+
expect(config.timeout).to eq(0)
|
|
79
|
+
|
|
80
|
+
request = api_client.build_request(:get, '/test')
|
|
81
|
+
expect(request.options[:timeout]).to eq(0)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "can be customized" do
|
|
85
|
+
config.timeout = 100
|
|
86
|
+
request = api_client.build_request(:get, '/test')
|
|
87
|
+
expect(request.options[:timeout]).to eq(100)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe "#deserialize" do
|
|
92
|
+
it "handles Array<Integer>" do
|
|
93
|
+
api_client = GiphyClient::ApiClient.new
|
|
94
|
+
headers = {'Content-Type' => 'application/json'}
|
|
95
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
|
96
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
|
97
|
+
expect(data).to be_instance_of(Array)
|
|
98
|
+
expect(data).to eq([12, 34])
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "handles Array<Array<Integer>>" do
|
|
102
|
+
api_client = GiphyClient::ApiClient.new
|
|
103
|
+
headers = {'Content-Type' => 'application/json'}
|
|
104
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
|
105
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
|
106
|
+
expect(data).to be_instance_of(Array)
|
|
107
|
+
expect(data).to eq([[12, 34], [56]])
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "handles Hash<String, String>" do
|
|
111
|
+
api_client = GiphyClient::ApiClient.new
|
|
112
|
+
headers = {'Content-Type' => 'application/json'}
|
|
113
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
|
114
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
|
115
|
+
expect(data).to be_instance_of(Hash)
|
|
116
|
+
expect(data).to eq({:message => 'Hello'})
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
describe "#object_to_hash" do
|
|
121
|
+
it "ignores nils and includes empty arrays" do
|
|
122
|
+
# uncomment below to test object_to_hash for model
|
|
123
|
+
#api_client = GiphyClient::ApiClient.new
|
|
124
|
+
#_model = GiphyClient::ModelName.new
|
|
125
|
+
# update the model attribute below
|
|
126
|
+
#_model.id = 1
|
|
127
|
+
# update the expected value (hash) below
|
|
128
|
+
#expected = {id: 1, name: '', tags: []}
|
|
129
|
+
#expect(api_client.object_to_hash(_model)).to eq(expected)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
describe "#build_collection_param" do
|
|
134
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
|
135
|
+
let(:api_client) { GiphyClient::ApiClient.new }
|
|
136
|
+
|
|
137
|
+
it "works for csv" do
|
|
138
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "works for ssv" do
|
|
142
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it "works for tsv" do
|
|
146
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it "works for pipes" do
|
|
150
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it "works for multi" do
|
|
154
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it "fails for invalid collection format" do
|
|
158
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
describe "#json_mime?" do
|
|
163
|
+
let(:api_client) { GiphyClient::ApiClient.new }
|
|
164
|
+
|
|
165
|
+
it "works" do
|
|
166
|
+
expect(api_client.json_mime?(nil)).to eq false
|
|
167
|
+
expect(api_client.json_mime?('')).to eq false
|
|
168
|
+
|
|
169
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
|
170
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
|
171
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
|
172
|
+
|
|
173
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
|
174
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
|
175
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
describe "#select_header_accept" do
|
|
180
|
+
let(:api_client) { GiphyClient::ApiClient.new }
|
|
181
|
+
|
|
182
|
+
it "works" do
|
|
183
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
|
184
|
+
expect(api_client.select_header_accept([])).to be_nil
|
|
185
|
+
|
|
186
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
|
187
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
|
188
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
|
189
|
+
|
|
190
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
|
191
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
describe "#select_header_content_type" do
|
|
196
|
+
let(:api_client) { GiphyClient::ApiClient.new }
|
|
197
|
+
|
|
198
|
+
it "works" do
|
|
199
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
|
200
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
|
201
|
+
|
|
202
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
|
203
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
|
204
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
|
205
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
|
206
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
describe "#sanitize_filename" do
|
|
211
|
+
let(:api_client) { GiphyClient::ApiClient.new }
|
|
212
|
+
|
|
213
|
+
it "works" do
|
|
214
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
|
215
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
|
216
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
|
217
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
|
218
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
|
219
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
|
220
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
|
221
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
|
222
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|