ully 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 814210f81a154678ba28247936979ad8ba7fc567
4
+ data.tar.gz: 00780b266bf4a4af59dd853f5e3713c128c7d830
5
+ SHA512:
6
+ metadata.gz: ff5809d5cb24cbeaf531dba9a65c73f7999201adc163daa047687ac980e503bdc5249e662cda7f5de3cc034c832cab4c044895d79c9470f6e598191d79758516
7
+ data.tar.gz: 2ea02eebca63348e9fa7a8dbfa55f7f35879cd73e9995e276af6ce26c8dd7f86e9fe43a75383a15a24247c6fd761a27695d9012f4bfc1d6f6d483d033284db64
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ ullyConfig.yml
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ before_install: gem update --system
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ - jruby-19mode
8
+ - rbx
9
+ script: rake spec
data/CHANGELOG ADDED
@@ -0,0 +1,4 @@
1
+ v0.1.0:
2
+ date: 2014-04-2
3
+ changes:
4
+ - Initial release.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ully.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,30 @@
1
+ The BSD License
2
+
3
+ Copyright (c) 2014, EnyTC Corporation
4
+
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice, this
14
+ list of conditions and the following disclaimer in the documentation and/or
15
+ other materials provided with the distribution.
16
+
17
+ * Neither the name of the EnyTC Corporation nor the names of its
18
+ contributors may be used to endorse or promote products derived from
19
+ this software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,543 @@
1
+ # Ully [![Build Status](https://secure.travis-ci.org/enytc/ully-gem.png?branch=master)](http://travis-ci.org/enytc/ully-gem) [![GEM version](https://badge-me.herokuapp.com/api/gem/ully.png)](http://badges.enytc.com/for/gem/ully)
2
+
3
+ > Ruby Gem for abstracting the use of Ully API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ully'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ $ gem install ully
23
+ ```
24
+
25
+ ## Getting Started
26
+
27
+ ```ruby
28
+ require "ully"
29
+ # Create new instance of Ully
30
+ api = Ully::Client.new("access_token")
31
+ ```
32
+
33
+ ## Documentation
34
+
35
+ #### #login(email, password)
36
+
37
+
38
+ **Parameter**: `email`
39
+ **Type**: `String`
40
+ **Example**: `example@example.com`
41
+
42
+
43
+ **Parameter**: `password`
44
+ **Type**: `String`
45
+ **Example**: `123456test`
46
+
47
+
48
+ The `login` method is responsible to login in accounts
49
+
50
+ How to use this method
51
+
52
+ ```ruby
53
+
54
+ api.login("email", "123456test")
55
+ ```
56
+
57
+ #### #logged_in?
58
+
59
+ The `logged_in?` method is responsible to check if user is logged in
60
+
61
+ How to use this method
62
+
63
+ ```ruby
64
+
65
+ api.logged_in?
66
+ ```
67
+
68
+ #### #signup(name, email, username, password, format=false)
69
+
70
+
71
+ **Parameter**: `name`
72
+ **Type**: `String`
73
+ **Example**: `myname`
74
+
75
+
76
+ **Parameter**: `email`
77
+ **Type**: `String`
78
+ **Example**: `example@example.com`
79
+
80
+
81
+ **Parameter**: `username`
82
+ **Type**: `String`
83
+ **Example**: `myusername`
84
+
85
+
86
+ **Parameter**: `password`
87
+ **Type**: `String`
88
+ **Example**: `123456test`
89
+
90
+
91
+ **Parameter**: `format`
92
+ **Type**: `String`
93
+ **Example**: `yaml`
94
+
95
+
96
+ The `signup` method is responsible for create accounts
97
+
98
+ How to use this method
99
+
100
+ ```ruby
101
+
102
+ api.signup("myname", "email", "myusername", "123456test", "yaml")
103
+ ```
104
+
105
+ #### #forgot(email, username, format=false)
106
+
107
+
108
+ **Parameter**: `email`
109
+ **Type**: `String`
110
+ **Example**: `example@example.com`
111
+
112
+
113
+ **Parameter**: `username`
114
+ **Type**: `String`
115
+ **Example**: `myusername`
116
+
117
+
118
+ **Parameter**: `format`
119
+ **Type**: `String`
120
+ **Example**: `yaml`
121
+
122
+
123
+ The `forgot` method is responsible for reset passwords
124
+
125
+ How to use this method
126
+
127
+ ```ruby
128
+
129
+ api.forgot("example@example.com", "myusername", "yaml")
130
+ ```
131
+
132
+ #### #stats(format=false)
133
+
134
+
135
+ **Parameter**: `format`
136
+ **Type**: `String`
137
+ **Example**: `"yaml"`
138
+
139
+
140
+ The `stats` method is responsible for showing statistics of Ully
141
+
142
+ How to use this method
143
+
144
+ ```ruby
145
+
146
+ api.stats("yaml")
147
+ ```
148
+
149
+ #### #stats_by_username(username, format=false)
150
+
151
+
152
+ **Parameter**: `username`
153
+ **Type**: `String`
154
+ **Example**: `myusername`
155
+
156
+
157
+ **Parameter**: `format`
158
+ **Type**: `String`
159
+ **Example**: `"yaml"`
160
+
161
+
162
+ The `stats` method is responsible for showing statistics of Ully
163
+
164
+ How to use this method
165
+
166
+ ```ruby
167
+
168
+ api.stats("myusername", "yaml")
169
+ ```
170
+
171
+ #### #status(format=false)
172
+
173
+
174
+ **Parameter**: `format`
175
+ **Type**: `String`
176
+ **Example**: `"yaml"`
177
+
178
+
179
+ The `status` method is responsible for showing status of the api
180
+
181
+ How to use this method
182
+
183
+ ```ruby
184
+
185
+ api.status("yaml")
186
+ ```
187
+
188
+ #### #me(format=false)
189
+
190
+
191
+ **Parameter**: `format`
192
+ **Type**: `String`
193
+ **Example**: `"yaml"`
194
+
195
+
196
+ The `me` method is responsible for showing profile info
197
+
198
+ How to use this method
199
+
200
+ ```ruby
201
+
202
+ api.me("yaml")
203
+ ```
204
+
205
+ #### #update_me(current_password, name="", email="", username="", password="", format=false)
206
+
207
+
208
+ **Parameter**: `current_password`
209
+ **Type**: `String`
210
+ **Example**: `123456test`
211
+
212
+
213
+ **Parameter**: `name`
214
+ **Type**: `String`
215
+ **Example**: `myname`
216
+
217
+
218
+ **Parameter**: `email`
219
+ **Type**: `String`
220
+ **Example**: `example@example.com`
221
+
222
+
223
+ **Parameter**: `username`
224
+ **Type**: `String`
225
+ **Example**: `myusername`
226
+
227
+
228
+ **Parameter**: `password`
229
+ **Type**: `String`
230
+ **Example**: `123456test`
231
+
232
+
233
+ **Parameter**: `format`
234
+ **Type**: `String`
235
+ **Example**: `yaml`
236
+
237
+
238
+ The `update_me` method is responsible for update profile info
239
+
240
+ How to use this method
241
+
242
+ ```ruby
243
+
244
+ api.update_me("123456test", "myname", "email", "myusername", "123456test", "yaml")
245
+ ```
246
+
247
+ #### #delete_me(format=false)
248
+
249
+
250
+ **Parameter**: `format`
251
+ **Type**: `String`
252
+ **Example**: `yaml`
253
+
254
+
255
+ The `delete_me` method is responsible for delete profile info
256
+
257
+ How to use this method
258
+
259
+ ```ruby
260
+
261
+ api.delete_me("yaml")
262
+ ```
263
+
264
+ #### #collections(format=false)
265
+
266
+
267
+ **Parameter**: `format`
268
+ **Type**: `String`
269
+ **Example**: `"yaml"`
270
+
271
+
272
+ The `collections` method is responsible for list all collections
273
+
274
+ How to use this method
275
+
276
+ ```ruby
277
+
278
+ api.collections("yaml")
279
+ ```
280
+
281
+ #### #collections_by_username(username, format=false)
282
+
283
+
284
+ **Parameter**: `username`
285
+ **Type**: `String`
286
+ **Example**: `myusername`
287
+
288
+
289
+ **Parameter**: `format`
290
+ **Type**: `String`
291
+ **Example**: `"yaml"`
292
+
293
+
294
+ The `collections_by_username` method is responsible for list all collections of a specific user
295
+
296
+ How to use this method
297
+
298
+ ```ruby
299
+
300
+ api.collections_by_username("username", "yaml")
301
+ ```
302
+
303
+ #### #create_collections(name, slug, public_collection, format=false)
304
+
305
+
306
+ **Parameter**: `name`
307
+ **Type**: `String`
308
+ **Example**: `My Favorites`
309
+
310
+
311
+ **Parameter**: `slug`
312
+ **Type**: `String`
313
+ **Example**: `favorites`
314
+
315
+
316
+ **Parameter**: `public_collection`
317
+ **Type**: `Boolean`
318
+ **Example**: `true`
319
+
320
+
321
+ **Parameter**: `format`
322
+ **Type**: `String`
323
+ **Example**: `yaml`
324
+
325
+
326
+ The `create_collections` method is responsible for create a new collection
327
+
328
+ How to use this method
329
+
330
+ ```ruby
331
+
332
+ api.create_collections("name", "slug", true, "yaml")
333
+ ```
334
+
335
+ #### #update_collections(collection_slug, name="", slug="", public_collection=true, format=false)
336
+
337
+
338
+ **Parameter**: `collection_slug`
339
+ **Type**: `String`
340
+ **Example**: `favorites`
341
+
342
+
343
+ **Parameter**: `name`
344
+ **Type**: `String`
345
+ **Example**: `My Favorites`
346
+
347
+
348
+ **Parameter**: `slug`
349
+ **Type**: `String`
350
+ **Example**: `myfavorites`
351
+
352
+
353
+ **Parameter**: `public_collection`
354
+ **Type**: `Boolean`
355
+ **Example**: `true`
356
+
357
+
358
+ **Parameter**: `format`
359
+ **Type**: `String`
360
+ **Example**: `yaml`
361
+
362
+
363
+ The `update_collections` method is responsible for update a specific collection
364
+
365
+ How to use this method
366
+
367
+ ```ruby
368
+
369
+ api.update_collections("collection_slug", "name", "slug", true, "yaml")
370
+ ```
371
+
372
+ #### #delete_collections(collection_slug, format=false)
373
+
374
+
375
+ **Parameter**: `collectionSlug`
376
+ **Type**: `String`
377
+ **Example**: `favorites`
378
+
379
+
380
+ **Parameter**: `format`
381
+ **Type**: `String`
382
+ **Example**: `yaml`
383
+
384
+
385
+ The `delete_collections` method is responsible for delete a specific collection
386
+
387
+ How to use this method
388
+
389
+ ```ruby
390
+
391
+ api.delete_collections("collection_slug", "yaml")
392
+ ```
393
+
394
+ #### #create_urls(collection_slug, url, title, description)
395
+
396
+
397
+ **Parameter**: `collectionSlug`
398
+ **Type**: `String`
399
+ **Example**: `favorites`
400
+
401
+
402
+ **Parameter**: `title`
403
+ **Type**: `String`
404
+ **Example**: `Title of url`
405
+
406
+
407
+ **Parameter**: `url`
408
+ **Type**: `String`
409
+ **Example**: `http://example.com`
410
+
411
+
412
+ **Parameter**: `description`
413
+ **Type**: `String`
414
+ **Example**: `My example page`
415
+
416
+
417
+ **Parameter**: `format`
418
+ **Type**: `String`
419
+ **Example**: `yaml`
420
+
421
+
422
+ The `create_urls` method is responsible for create a new url
423
+
424
+ How to use this method
425
+
426
+ ```ruby
427
+
428
+ api.create_urls("collection_slug", "http://example.com", "Title of url", "My example page", "yaml")
429
+ ```
430
+
431
+ #### #update_urls(collection_slug, url_id, url, title="", description="", format=false)
432
+
433
+
434
+ **Parameter**: `collection_slug`
435
+ **Type**: `String`
436
+ **Example**: `favorites`
437
+
438
+
439
+ **Parameter**: `url_id`
440
+ **Type**: `String`
441
+ **Example**: `url_id`
442
+
443
+
444
+ **Parameter**: `url`
445
+ **Type**: `String`
446
+ **Example**: `http://example.com`
447
+
448
+
449
+ **Parameter**: `title`
450
+ **Type**: `String`
451
+ **Example**: `Title of url`
452
+
453
+
454
+ **Parameter**: `description`
455
+ **Type**: `String`
456
+ **Example**: `My example page`
457
+
458
+
459
+ **Parameter**: `format`
460
+ **Type**: `String`
461
+ **Example**: `yaml`
462
+
463
+
464
+ The `update_urls` method is responsible for update a specific url
465
+
466
+ How to use this method
467
+
468
+ ```ruby
469
+
470
+ api.update_urls("collection_slug", "url_id", "Title of url", "http://example.com", "My example page", "yaml")
471
+ ```
472
+
473
+ #### #delete_urls(collection_slug, url_id)
474
+
475
+
476
+ **Parameter**: `collectionSlug`
477
+ **Type**: `String`
478
+ **Example**: `favorites`
479
+
480
+
481
+ **Parameter**: `urlid`
482
+ **Type**: `String`
483
+ **Example**: `urlid`
484
+
485
+
486
+ **Parameter**: `format`
487
+ **Type**: `String`
488
+ **Example**: `yaml`
489
+
490
+
491
+ The `delete_Urls` method is responsible for delete a specific url
492
+
493
+ How to use this method
494
+
495
+ ```ruby
496
+
497
+ api.delete_urls("collection_Slug", "url_id")
498
+ ```
499
+
500
+ ## Contributing
501
+
502
+ 1. Fork it [enytc/ully-gem](https://github.com/enytc/ully-gem/fork)
503
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
504
+ 3. Commit your changes (`git commit -am "Add some feature"`)
505
+ 4. Push to the branch (`git push origin my-new-feature`)
506
+ 5. Create new Pull Request
507
+
508
+ ## Support
509
+ If you have any problem or suggestion please open an issue [here](https://github.com/enytc/ully-gem/issues).
510
+
511
+ ## License
512
+
513
+ The BSD License
514
+
515
+ Copyright (c) 2014, EnyTC Corporation
516
+
517
+ All rights reserved.
518
+
519
+ Redistribution and use in source and binary forms, with or without modification,
520
+ are permitted provided that the following conditions are met:
521
+
522
+ * Redistributions of source code must retain the above copyright notice, this
523
+ list of conditions and the following disclaimer.
524
+
525
+ * Redistributions in binary form must reproduce the above copyright notice, this
526
+ list of conditions and the following disclaimer in the documentation and/or
527
+ other materials provided with the distribution.
528
+
529
+ * Neither the name of the EnyTC Corporation nor the names of its
530
+ contributors may be used to endorse or promote products derived from
531
+ this software without specific prior written permission.
532
+
533
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
534
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
535
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
536
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
537
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
538
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES
539
+ LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
540
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
541
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
542
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
543
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new do |task|
5
+ task.rspec_opts = ['--format', 'doc']
6
+ end
data/lib/ully.rb ADDED
@@ -0,0 +1,156 @@
1
+ require "rubygems"
2
+ require "ully/version"
3
+ require "httparty"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ # ully-gem
8
+ # https://github.com/enytc/ully-gem
9
+ #
10
+ # Copyright (c) 2014, EnyTC Corporation
11
+ # Licensed under the BSD license.
12
+
13
+ module Ully
14
+ class Client
15
+ include HTTParty
16
+ base_uri "https://ully.herokuapp.com"
17
+
18
+ def initialize(access_token)
19
+ self.class.default_params :access_token => access_token
20
+ end
21
+
22
+ # Pretty responses in terminal
23
+ def self.pretty_response(response, format)
24
+ json = JSON.parse(response.body)
25
+ if format == "json"
26
+ JSON.pretty_generate(json)
27
+ elsif format == "yaml"
28
+ json.to_yaml
29
+ else
30
+ json
31
+ end
32
+ end
33
+
34
+ # Login in user account
35
+ def login(email, password)
36
+ response = self.class.post('/forgot/token', :body => {:email => email, :password => password})
37
+ config = JSON.parse(response.body)
38
+ if config.has_key?("token") && config.has_key?("role")
39
+ File.open("ullyConfig.yml", "w"){ |f| f << config.to_yaml }
40
+ puts "Logged successfully!"
41
+ else
42
+ puts "Login failed. Try again!"
43
+ end
44
+ end
45
+
46
+ # Check if user is logged
47
+ def logged_in?
48
+ if File.exist?("ullyConfig.yml")
49
+ config = YAML.load_file('ullyConfig.yml')
50
+ if config.has_key?("token") && config.has_key?("role")
51
+ true
52
+ else
53
+ false
54
+ end
55
+ else
56
+ false
57
+ end
58
+ end
59
+
60
+ # Create accounts
61
+ def signup(name, email, username, password, format=false)
62
+ response = self.class.post('/signup', :body => {:name => name, :email => email, :username => username, :password => password})
63
+ self.class.pretty_response(response, format)
64
+ end
65
+
66
+ # Forgot password
67
+ def forgot(email, username, format=false)
68
+ response = self.class.post('/forgot', :body => {:email => email, :username => username})
69
+ self.class.pretty_response(response, format)
70
+ end
71
+
72
+ # Stats of Ully
73
+ def stats(format=false)
74
+ response = self.class.get('/stats')
75
+ self.class.pretty_response(response, format)
76
+ end
77
+
78
+ # Stats of Ully
79
+ def stats_by_username(username, format=false)
80
+ response = self.class.get('/stats/'+username)
81
+ self.class.pretty_response(response, format)
82
+ end
83
+
84
+ # Status of Ully API
85
+ def status(format=false)
86
+ response = self.class.get('/status')
87
+ self.class.pretty_response(response, format)
88
+ end
89
+
90
+ # Show profile info
91
+ def me(format=false)
92
+ response = self.class.get('/me')
93
+ self.class.pretty_response(response, format)
94
+ end
95
+
96
+ # Update profile info
97
+ def update_me(current_password, name="", email="", username="", password="", format=false)
98
+ response = self.class.put('/me', :body => {:name => name, :email => email, :username => username, :currentpassword => current_password, :password => password})
99
+ self.class.pretty_response(response, format)
100
+ end
101
+
102
+ # Delete profile info
103
+ def delete_me(format=false)
104
+ response = self.class.delete('/me')
105
+ self.class.pretty_response(response, format)
106
+ end
107
+
108
+ # Show collections
109
+ def collections(format=false)
110
+ response = self.class.get('/collections', :query => {:fields => "name,slug,urls,public"})
111
+ self.class.pretty_response(response, format)
112
+ end
113
+
114
+ # Show collections by username
115
+ def collections_by_username(username, format=false)
116
+ response = self.class.get('/collections/of/'+username, :query => {:fields => "name,slug,urls,public"})
117
+ self.class.pretty_response(response, format)
118
+ end
119
+
120
+ # Create collections
121
+ def create_collections(name, slug, public_collection=true, format=false)
122
+ response = self.class.post('/collections', :body => {:name => name, :slug => slug, :public => public_collection})
123
+ self.class.pretty_response(response, format)
124
+ end
125
+
126
+ # Update collections
127
+ def update_collections(collection_slug, name="", slug="", public_collection=true, format=false)
128
+ response = self.class.put('/collections/'+collection_slug, :body => {:name => name, :slug => slug, :public => public_collection})
129
+ self.class.pretty_response(response, format)
130
+ end
131
+
132
+ # Delete collections
133
+ def delete_collections(collection_slug, format=false)
134
+ response = self.class.delete('/collections/'+collection_slug)
135
+ self.class.pretty_response(response, format)
136
+ end
137
+
138
+ # Create urls
139
+ def create_urls(collection_slug, url, title="", description="", format=false)
140
+ response = self.class.post('/collections/'+collection_slug+'/urls', :body => {:title => title, :url => url, :description => description})
141
+ self.class.pretty_response(response, format)
142
+ end
143
+
144
+ # Update urls
145
+ def update_urls(collection_slug, url_id, url, title="", description="", format=false)
146
+ response = self.class.put('/collections/'+collection_slug+'/urls/'+url_id, :body => {:title => title, :url => url, :description => description})
147
+ self.class.pretty_response(response, format)
148
+ end
149
+
150
+ # Delete urls
151
+ def delete_urls(collection_slug, url_id, format=false)
152
+ response = self.class.delete('/collections/'+collection_slug+'/urls/'+url_id)
153
+ self.class.pretty_response(response, format)
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,9 @@
1
+ # ully-gem
2
+ # https://github.com/enytc/ully-gem
3
+ #
4
+ # Copyright (c) 2014, EnyTC Corporation
5
+ # Licensed under the BSD license.
6
+
7
+ module Ully
8
+ VERSION = "0.1.0"
9
+ end
@@ -0,0 +1,14 @@
1
+ require "ully"
2
+
3
+ describe Ully::Client do
4
+
5
+ let(:client) { Ully::Client.new("") }
6
+
7
+ describe "#stats" do
8
+ it { expect(client.stats).to have(7).item }
9
+ end
10
+
11
+ describe "#stats" do
12
+ it { expect(client.status).to have(2).item }
13
+ end
14
+ end
data/ully.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ully/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ully"
8
+ spec.version = Ully::VERSION
9
+ spec.authors = ["Christopher EnyTC"]
10
+ spec.email = ["chris.enytc@gmail.com"]
11
+ spec.summary = %q{Ruby Gem for abstracting the use of Ully API.}
12
+ spec.description = %q{Ruby Gem for abstracting the use of Ully API. Manage your favorite links easily and quickly on Ully.}
13
+ spec.homepage = "https://github.com/enytc/ully-gem"
14
+ spec.license = "BSD"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 1.9.3'
22
+
23
+ spec.add_runtime_dependency "httparty", "~> 0.13"
24
+
25
+ spec.add_development_dependency "rspec", "~> 2"
26
+ spec.add_development_dependency "bundler", "~> 1.5"
27
+ spec.add_development_dependency "rake", "~> 10.2"
28
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ully
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christopher EnyTC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.2'
69
+ description: Ruby Gem for abstracting the use of Ully API. Manage your favorite links
70
+ easily and quickly on Ully.
71
+ email:
72
+ - chris.enytc@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
+ - CHANGELOG
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/ully.rb
85
+ - lib/ully/version.rb
86
+ - spec/client_spec.rb
87
+ - ully.gemspec
88
+ homepage: https://github.com/enytc/ully-gem
89
+ licenses:
90
+ - BSD
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 1.9.3
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Ruby Gem for abstracting the use of Ully API.
112
+ test_files:
113
+ - spec/client_spec.rb