ully 0.3.0 → 0.4.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 +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG +5 -0
- data/README.md +22 -187
- data/lib/ully.rb +13 -43
- data/lib/ully/version.rb +1 -1
- data/spec/client_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30af611b84a7f3b74684d3720d70b04b62cb87e4
|
4
|
+
data.tar.gz: acd4469e2b8c49c4bdfd5d9d67dce523c0734c42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cf7116afe11837733c724caef289ed8856b2dc211f31f48bbbcd11a6f733b6c78bf4a5e75bd4a5e182917d2f6e43014a15d71f4e160cce4ca3359caad06e4ec
|
7
|
+
data.tar.gz: 72c7fee48ecefc5f706f309c52851161dae06faa04d40b73a3b856069ca61bfb37a2cc447da7fb04b8629e2285b89d74558007208d4787073d8944bcabd780f8
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -49,28 +49,6 @@ How to use this method
|
|
49
49
|
api.stats("yaml")
|
50
50
|
```
|
51
51
|
|
52
|
-
#### #stats_by_username(username, format=false)
|
53
|
-
|
54
|
-
|
55
|
-
**Parameter**: `username`
|
56
|
-
**Type**: `String`
|
57
|
-
**Example**: `myusername`
|
58
|
-
|
59
|
-
|
60
|
-
**Parameter**: `format`
|
61
|
-
**Type**: `String`
|
62
|
-
**Example**: `"yaml"`
|
63
|
-
|
64
|
-
|
65
|
-
The `stats` method is responsible for showing statistics of Ully
|
66
|
-
|
67
|
-
How to use this method
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
|
71
|
-
api.stats("myusername", "yaml")
|
72
|
-
```
|
73
|
-
|
74
52
|
#### #status(format=false)
|
75
53
|
|
76
54
|
|
@@ -105,48 +83,6 @@ How to use this method
|
|
105
83
|
api.account("yaml")
|
106
84
|
```
|
107
85
|
|
108
|
-
#### #update_account(current_password, name="", email="", username="", password="", format=false)
|
109
|
-
|
110
|
-
|
111
|
-
**Parameter**: `current_password`
|
112
|
-
**Type**: `String`
|
113
|
-
**Example**: `123456test`
|
114
|
-
|
115
|
-
|
116
|
-
**Parameter**: `name`
|
117
|
-
**Type**: `String`
|
118
|
-
**Example**: `myname`
|
119
|
-
|
120
|
-
|
121
|
-
**Parameter**: `email`
|
122
|
-
**Type**: `String`
|
123
|
-
**Example**: `example@example.com`
|
124
|
-
|
125
|
-
|
126
|
-
**Parameter**: `username`
|
127
|
-
**Type**: `String`
|
128
|
-
**Example**: `myusername`
|
129
|
-
|
130
|
-
|
131
|
-
**Parameter**: `password`
|
132
|
-
**Type**: `String`
|
133
|
-
**Example**: `123456test`
|
134
|
-
|
135
|
-
|
136
|
-
**Parameter**: `format`
|
137
|
-
**Type**: `String`
|
138
|
-
**Example**: `yaml`
|
139
|
-
|
140
|
-
|
141
|
-
The `update_account` method is responsible for update profile info
|
142
|
-
|
143
|
-
How to use this method
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
|
147
|
-
api.update_account("123456test", "myname", "email", "myusername", "123456test", "yaml")
|
148
|
-
```
|
149
|
-
|
150
86
|
#### #collections(format=false)
|
151
87
|
|
152
88
|
|
@@ -164,29 +100,7 @@ How to use this method
|
|
164
100
|
api.collections("yaml")
|
165
101
|
```
|
166
102
|
|
167
|
-
#### #
|
168
|
-
|
169
|
-
|
170
|
-
**Parameter**: `username`
|
171
|
-
**Type**: `String`
|
172
|
-
**Example**: `myusername`
|
173
|
-
|
174
|
-
|
175
|
-
**Parameter**: `format`
|
176
|
-
**Type**: `String`
|
177
|
-
**Example**: `"yaml"`
|
178
|
-
|
179
|
-
|
180
|
-
The `collections_by_username` method is responsible for list all collections of a specific user
|
181
|
-
|
182
|
-
How to use this method
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
|
186
|
-
api.collections_by_username("username", "yaml")
|
187
|
-
```
|
188
|
-
|
189
|
-
#### #create_collections(name, slug, public_collection, format=false)
|
103
|
+
#### #create_collection(name, slug, public_collection, format=false)
|
190
104
|
|
191
105
|
|
192
106
|
**Parameter**: `name`
|
@@ -209,75 +123,16 @@ api.collections_by_username("username", "yaml")
|
|
209
123
|
**Example**: `yaml`
|
210
124
|
|
211
125
|
|
212
|
-
The `
|
213
|
-
|
214
|
-
How to use this method
|
215
|
-
|
216
|
-
```ruby
|
217
|
-
|
218
|
-
api.create_collections("name", "slug", true, "yaml")
|
219
|
-
```
|
220
|
-
|
221
|
-
#### #update_collections(collection_slug, name="", slug="", public_collection=true, format=false)
|
222
|
-
|
223
|
-
|
224
|
-
**Parameter**: `collection_slug`
|
225
|
-
**Type**: `String`
|
226
|
-
**Example**: `favorites`
|
227
|
-
|
228
|
-
|
229
|
-
**Parameter**: `name`
|
230
|
-
**Type**: `String`
|
231
|
-
**Example**: `My Favorites`
|
232
|
-
|
233
|
-
|
234
|
-
**Parameter**: `slug`
|
235
|
-
**Type**: `String`
|
236
|
-
**Example**: `myfavorites`
|
237
|
-
|
238
|
-
|
239
|
-
**Parameter**: `public_collection`
|
240
|
-
**Type**: `Boolean`
|
241
|
-
**Example**: `true`
|
242
|
-
|
243
|
-
|
244
|
-
**Parameter**: `format`
|
245
|
-
**Type**: `String`
|
246
|
-
**Example**: `yaml`
|
247
|
-
|
248
|
-
|
249
|
-
The `update_collections` method is responsible for update a specific collection
|
250
|
-
|
251
|
-
How to use this method
|
252
|
-
|
253
|
-
```ruby
|
254
|
-
|
255
|
-
api.update_collections("collection_slug", "name", "slug", true, "yaml")
|
256
|
-
```
|
257
|
-
|
258
|
-
#### #delete_collections(collection_slug, format=false)
|
259
|
-
|
260
|
-
|
261
|
-
**Parameter**: `collectionSlug`
|
262
|
-
**Type**: `String`
|
263
|
-
**Example**: `favorites`
|
264
|
-
|
265
|
-
|
266
|
-
**Parameter**: `format`
|
267
|
-
**Type**: `String`
|
268
|
-
**Example**: `yaml`
|
269
|
-
|
270
|
-
|
271
|
-
The `delete_collections` method is responsible for delete a specific collection
|
126
|
+
The `create_collection` method is responsible for create a new collection
|
272
127
|
|
273
128
|
How to use this method
|
274
129
|
|
275
130
|
```ruby
|
276
131
|
|
277
|
-
api.
|
132
|
+
api.create_collection("name", "slug", true, "yaml")
|
278
133
|
```
|
279
134
|
|
280
|
-
#### #
|
135
|
+
#### #add_url(collection_slug, url, title="", description="", format=false)
|
281
136
|
|
282
137
|
|
283
138
|
**Parameter**: `collectionSlug`
|
@@ -305,68 +160,48 @@ api.delete_collections("collection_slug", "yaml")
|
|
305
160
|
**Example**: `yaml`
|
306
161
|
|
307
162
|
|
308
|
-
The `
|
163
|
+
The `add_url` method is responsible for create a new url
|
309
164
|
|
310
165
|
How to use this method
|
311
166
|
|
312
167
|
```ruby
|
313
168
|
|
314
|
-
api.
|
169
|
+
api.add_url("collection_slug", "http://example.com", "Title of url", "My example page", "yaml")
|
315
170
|
```
|
316
171
|
|
317
|
-
#### #
|
318
|
-
|
319
|
-
|
320
|
-
**Parameter**: `collection_slug`
|
321
|
-
**Type**: `String`
|
322
|
-
**Example**: `favorites`
|
323
|
-
|
324
|
-
|
325
|
-
**Parameter**: `url_id`
|
326
|
-
**Type**: `String`
|
327
|
-
**Example**: `url_id`
|
328
|
-
|
329
|
-
|
330
|
-
**Parameter**: `url`
|
331
|
-
**Type**: `String`
|
332
|
-
**Example**: `http://example.com`
|
333
|
-
|
334
|
-
|
335
|
-
**Parameter**: `title`
|
336
|
-
**Type**: `String`
|
337
|
-
**Example**: `Title of url`
|
338
|
-
|
339
|
-
|
340
|
-
**Parameter**: `description`
|
341
|
-
**Type**: `String`
|
342
|
-
**Example**: `My example page`
|
172
|
+
#### #shortened_urls(format=false)
|
343
173
|
|
344
174
|
|
345
175
|
**Parameter**: `format`
|
346
176
|
**Type**: `String`
|
347
|
-
**Example**: `yaml`
|
177
|
+
**Example**: `"yaml"`
|
348
178
|
|
349
179
|
|
350
|
-
The `
|
180
|
+
The `shortened_urls` method is responsible for list all shortened urls
|
351
181
|
|
352
182
|
How to use this method
|
353
183
|
|
354
184
|
```ruby
|
355
185
|
|
356
|
-
api.
|
186
|
+
api.shortened_urls("yaml")
|
357
187
|
```
|
358
188
|
|
359
|
-
#### #
|
189
|
+
#### #shorten_url(url, shortcode="", password="", format=false)
|
360
190
|
|
361
191
|
|
362
|
-
**Parameter**: `
|
192
|
+
**Parameter**: `url`
|
363
193
|
**Type**: `String`
|
364
|
-
**Example**: `
|
194
|
+
**Example**: `http://example.com/pages/about/ully`
|
365
195
|
|
366
196
|
|
367
|
-
**Parameter**: `
|
197
|
+
**Parameter**: `shortcode`
|
198
|
+
**Type**: `String`
|
199
|
+
**Example**: `ully`
|
200
|
+
|
201
|
+
|
202
|
+
**Parameter**: `password`
|
368
203
|
**Type**: `String`
|
369
|
-
**Example**: `
|
204
|
+
**Example**: `12345678`
|
370
205
|
|
371
206
|
|
372
207
|
**Parameter**: `format`
|
@@ -374,13 +209,13 @@ api.update_urls("collection_slug", "url_id", "Title of url", "http://example.com
|
|
374
209
|
**Example**: `yaml`
|
375
210
|
|
376
211
|
|
377
|
-
The `
|
212
|
+
The `shorten_url` method is responsible for shorten urls
|
378
213
|
|
379
214
|
How to use this method
|
380
215
|
|
381
216
|
```ruby
|
382
217
|
|
383
|
-
api.
|
218
|
+
api.shorten_url("http://example.com/pages/about/ully", "ully", "12345678", "yaml")
|
384
219
|
```
|
385
220
|
|
386
221
|
## Contributing
|
data/lib/ully.rb
CHANGED
@@ -13,7 +13,7 @@ require "yaml"
|
|
13
13
|
module Ully
|
14
14
|
class Client
|
15
15
|
include HTTParty
|
16
|
-
base_uri ENV["ULLY_URI"] || "https://ully.in/api"
|
16
|
+
base_uri ENV["ULLY_URI"] || "https://ully.in/api/"
|
17
17
|
|
18
18
|
def initialize(access_token)
|
19
19
|
self.class.default_params :access_token => access_token
|
@@ -38,12 +38,6 @@ module Ully
|
|
38
38
|
self.class.pretty_response(response, format)
|
39
39
|
end
|
40
40
|
|
41
|
-
# Stats of Ully
|
42
|
-
def stats_by_username(username, format=false)
|
43
|
-
response = self.class.get("/stats/"+username)
|
44
|
-
self.class.pretty_response(response, format)
|
45
|
-
end
|
46
|
-
|
47
41
|
# Status of Ully API
|
48
42
|
def status(format=false)
|
49
43
|
response = self.class.get("/status")
|
@@ -56,57 +50,33 @@ module Ully
|
|
56
50
|
self.class.pretty_response(response, format)
|
57
51
|
end
|
58
52
|
|
59
|
-
# Update profile info
|
60
|
-
def update_account(current_password, name="", email="", username="", password="", format=false)
|
61
|
-
response = self.class.put("/account", :body => {:name => name, :email => email, :username => username, :currentpassword => current_password, :password => password})
|
62
|
-
self.class.pretty_response(response, format)
|
63
|
-
end
|
64
|
-
|
65
53
|
# Show collections
|
66
54
|
def collections(format=false)
|
67
|
-
response = self.class.get("/collections"
|
68
|
-
self.class.pretty_response(response, format)
|
69
|
-
end
|
70
|
-
|
71
|
-
# Show collections by username
|
72
|
-
def collections_by_username(username, format=false)
|
73
|
-
response = self.class.get("/collections/of/"+username, :query => {:fields => "name,slug,urls,public"})
|
55
|
+
response = self.class.get("/collections")
|
74
56
|
self.class.pretty_response(response, format)
|
75
57
|
end
|
76
58
|
|
77
|
-
# Create
|
78
|
-
def
|
59
|
+
# Create collection
|
60
|
+
def create_collection(name, slug, public_collection=true, format=false)
|
79
61
|
response = self.class.post("/collections", :body => {:name => name, :slug => slug, :public => public_collection})
|
80
62
|
self.class.pretty_response(response, format)
|
81
63
|
end
|
82
64
|
|
83
|
-
#
|
84
|
-
def
|
85
|
-
response = self.class.
|
86
|
-
self.class.pretty_response(response, format)
|
87
|
-
end
|
88
|
-
|
89
|
-
# Delete collections
|
90
|
-
def delete_collections(collection_slug, format=false)
|
91
|
-
response = self.class.delete("/collections/"+collection_slug)
|
92
|
-
self.class.pretty_response(response, format)
|
93
|
-
end
|
94
|
-
|
95
|
-
# Create urls
|
96
|
-
def create_urls(collection_slug, url, title="", description="", format=false)
|
97
|
-
response = self.class.post("/collections/"+collection_slug+"/urls", :body => {:title => title, :url => url, :description => description})
|
65
|
+
# Add url
|
66
|
+
def add_url(collection_slug, url, title="", description="", format=false)
|
67
|
+
response = self.class.post("/collections/urls", :body => {:title => title, :url => url, :description => description, :slug => collection_slug})
|
98
68
|
self.class.pretty_response(response, format)
|
99
69
|
end
|
100
70
|
|
101
|
-
#
|
102
|
-
def
|
103
|
-
response = self.class.
|
71
|
+
# Show shortened urls
|
72
|
+
def shortened_urls(format=false)
|
73
|
+
response = self.class.get("/shortener")
|
104
74
|
self.class.pretty_response(response, format)
|
105
75
|
end
|
106
76
|
|
107
|
-
#
|
108
|
-
def
|
109
|
-
response = self.class.
|
77
|
+
# Shorten url
|
78
|
+
def shorten_url(url, shortcode="", password="", format=false)
|
79
|
+
response = self.class.post("/shortener/", :body => {:url => url, :shortcode => shortcode, :password => password})
|
110
80
|
self.class.pretty_response(response, format)
|
111
81
|
end
|
112
82
|
end
|
data/lib/ully/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -5,10 +5,10 @@ describe Ully::Client do
|
|
5
5
|
let(:client) { Ully::Client.new("") }
|
6
6
|
|
7
7
|
describe "#stats" do
|
8
|
-
it { expect(client.stats).to
|
8
|
+
it { expect(client.stats().size).to eq(7) }
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#stats" do
|
12
|
-
it { expect(client.status).to
|
12
|
+
it { expect(client.status().size).to eq(2) }
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher EnyTC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|