active_diigo 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 94983a429e081370551dd937df6ec26a649946c8
4
+ data.tar.gz: 5d181d1c700164f5650a36d8406e228635df3a3c
5
+ SHA512:
6
+ metadata.gz: f4e4a8ed31b981ad09ab89fd2c733c3a626507ab831d6e0da8169d2d00350874e604c6e2c57ad40170df6562477d9302055a805ded4ab723fad033de6843b611
7
+ data.tar.gz: bc6117030c2bf3715aa4db22f5de998d39d9edeb37cf5eca9f5c3f4adbccf8abb44467abef6d019e2a8040def562e04ac8f1f50aad699123a92a2eabaaed7742
@@ -1,5 +1,9 @@
1
1
  ## ActiveDiigo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/active_diigo.png)](http://badge.fury.io/rb/active_diigo)
4
+
5
+ [![Build Status](https://travis-ci.org/bagwanpankaj/active_diigo.svg?branch=master)](https://travis-ci.org/bagwanpankaj/active_diigo)
6
+
3
7
  ### Description
4
8
 
5
9
  ActiveDiigo is a wrapper for Diigo API(version: v2). It provides ActiveRecord like interaction with Diigo API. You just need to inherit ActiveDiigo::Base in class you want to use active_diigo in. It's also works standalone and it's framework agnostic gem, enabling itself to be used in any ruby framework.
@@ -9,7 +13,7 @@ ActiveDiigo is a wrapper for Diigo API(version: v2). It provides ActiveRecord li
9
13
  as you install any other ruby gem
10
14
 
11
15
  [sudo] gem install active_diigo
12
-
16
+
13
17
  using bundler
14
18
 
15
19
  gem 'active_diigo'
@@ -24,21 +28,21 @@ Setup API Key and user credentials in initializer or anywhere before using activ
24
28
 
25
29
  ActiveDiigo.api_key = 'YOUR_API_KEY'
26
30
  ActiveDiigo.username = '<user-name>'
27
- ActiveDiigo.username = '<password>'
28
-
31
+ ActiveDiigo.password = '<password>'
32
+
29
33
  then
30
34
 
31
35
  ActiveDiigo::Base.find(username, options)
32
36
  #=> returns array of ActiveDiigo::Base objects
33
37
  ActiveDiigo::Base.save(title, url, options)
34
- #=> returns a hash with message (saved or not)
38
+ #=> returns a hash with message (saved or not)
35
39
  #OR
36
40
  class MyDiigo < ActiveDiigo::Base; end
37
41
  MyDiigo.find(username, options)
38
42
  #=> Returns array of MyDiigo objects
39
43
 
40
44
  ### Contributing to active_diigo
41
-
45
+
42
46
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
43
47
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
44
48
  * Fork the project
@@ -53,5 +57,5 @@ then
53
57
 
54
58
  ### Copyright
55
59
 
56
- Copyright (c) 2011 Bagwan Pankaj. See LICENSE for further details.
60
+ Copyright (c) 2011-2016 Bagwan Pankaj. See LICENSE for further details.
57
61
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -1,209 +1,209 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "ActiveDiigo" do
4
-
4
+
5
5
  describe ActiveDiigo do
6
6
  before(:all) do
7
7
  ActiveDiigo.api_key = 'TEST_API_KEY'
8
8
  ActiveDiigo.username = 'test-user'
9
9
  ActiveDiigo.password = 'test-pass'
10
10
  end
11
-
11
+
12
12
  it "should have api_key as an accessor" do
13
- ActiveDiigo.should respond_to(:api_key)
14
- ActiveDiigo.api_key.should == 'TEST_API_KEY'
13
+ expect(ActiveDiigo).to respond_to(:api_key)
14
+ expect(ActiveDiigo.api_key).to eq 'TEST_API_KEY'
15
15
  end
16
-
16
+
17
17
  it "should allow to set api_key" do
18
- ActiveDiigo.should respond_to(:api_key)
18
+ expect(ActiveDiigo).to respond_to(:api_key)
19
19
  ActiveDiigo.api_key = 'TEST_API_KEY_CHANGED'
20
- ActiveDiigo.api_key.should == 'TEST_API_KEY_CHANGED'
20
+ expect(ActiveDiigo.api_key).to eq 'TEST_API_KEY_CHANGED'
21
21
  end
22
-
22
+
23
23
  it "should have username as an accessor" do
24
- ActiveDiigo.should respond_to(:username)
25
- ActiveDiigo.username.should == 'test-user'
24
+ expect(ActiveDiigo).to respond_to(:username)
25
+ expect(ActiveDiigo.username).to eq 'test-user'
26
26
  end
27
-
27
+
28
28
  it "should allow to set username" do
29
- ActiveDiigo.should respond_to(:username)
29
+ expect(ActiveDiigo).to respond_to(:username)
30
30
  ActiveDiigo.username = 'TEST_USER'
31
- ActiveDiigo.username.should == 'TEST_USER'
31
+ expect(ActiveDiigo.username).to eq 'TEST_USER'
32
32
  end
33
-
33
+
34
34
  it "should have password as an accessor" do
35
- ActiveDiigo.should respond_to(:password)
36
- ActiveDiigo.password.should == 'test-pass'
35
+ expect(ActiveDiigo).to respond_to(:password)
36
+ expect(ActiveDiigo.password).to eq 'test-pass'
37
37
  end
38
-
38
+
39
39
  it "should allow to set password" do
40
- ActiveDiigo.should respond_to(:password)
40
+ expect(ActiveDiigo).to respond_to(:password)
41
41
  ActiveDiigo.password = 'TEST_PASS'
42
- ActiveDiigo.password.should == 'TEST_PASS'
42
+ expect(ActiveDiigo.password).to eq 'TEST_PASS'
43
43
  end
44
-
44
+
45
45
  it "should respond version method" do
46
- ActiveDiigo.should respond_to(:version)
46
+ expect(ActiveDiigo).to respond_to(:version)
47
47
  end
48
-
48
+
49
49
  it "should return current version of gem" do
50
- ActiveDiigo.version.should == File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
50
+ expect(ActiveDiigo.version).to eq File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
51
51
  end
52
-
52
+
53
53
  end
54
-
54
+
55
55
  describe ActiveDiigo::Request do
56
56
  before(:all) do
57
57
  ActiveDiigo.api_key = 'TEST_API_KEY'
58
58
  @base_uri = "https://secure.diigo.com/api/v2"
59
59
  end
60
60
  it "should have HTTParty included" do
61
- ActiveDiigo::Request.should include HTTParty
61
+ expect(ActiveDiigo::Request).to include HTTParty
62
62
  end
63
-
63
+
64
64
  it "should have base_uri set as diigo api uri" do
65
- ActiveDiigo::Request.base_uri.should == @base_uri
65
+ expect(ActiveDiigo::Request.base_uri).to eq @base_uri
66
66
  end
67
-
67
+
68
68
  it "should have API version v2 for diigo API" do
69
- ActiveDiigo::Request::API_VERSION.should == 'v2'
69
+ expect(ActiveDiigo::Request::API_VERSION).to eq 'v2'
70
70
  end
71
-
71
+
72
72
  it "should raise ArgumentError when not initialized with with proper no of argument" do
73
- Proc.new do
74
- ActiveDiigo::Request.new()
75
- end.should raise_error(ArgumentError)
73
+ expect(Proc.new do
74
+ ActiveDiigo::Request.new()
75
+ end).to raise_error(ArgumentError)
76
76
  end
77
-
77
+
78
78
  it "should not raise error when initialized properly" do
79
- Proc.new do
80
- ActiveDiigo::Request.new('user', 'pass')
81
- end.should_not raise_error(ArgumentError)
79
+ expect(Proc.new do
80
+ ActiveDiigo::Request.new('user', 'pass')
81
+ end).not_to raise_error(ArgumentError)
82
82
  end
83
-
83
+
84
84
  it "should send a 10 bookmarks in json format by default when requested" do
85
85
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?user=test-user&key=TEST_API_KEY")
86
-
86
+
87
87
  con = ActiveDiigo::Request.new('test-user', 'test-pass')
88
88
  res = con.bookmarks(:user => 'test-user')
89
- res.parsed_response.should be_an_instance_of Array
90
- res.size.should == 10
89
+ expect(res.parsed_response).to be_an_instance_of Array
90
+ expect(res.size).to eq 10
91
91
  end
92
-
92
+
93
93
  it "should get error json while saving bookmark without required params" do
94
94
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks", :method => :post,
95
95
  :fixture => 'save_error')
96
96
  con = ActiveDiigo::Request.new('test-user', 'test-pass')
97
97
  res = con.save()
98
- res["message"].should == "Error detected. Please check your input. Contact service@diigo.com if there's any problem."
98
+ expect(res["message"]).to eq "Error detected. Please check your input. Contact service@diigo.com if there's any problem."
99
99
  end
100
-
100
+
101
101
  it "should get success json while saving bookmark" do
102
102
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks", :method => :post,
103
103
  :fixture => 'save_success')
104
104
  con = ActiveDiigo::Request.new('test-user', 'test-pass')
105
105
  res = con.save(:title => "my bookmark", :url => "http://mybookmark.com")
106
- res["message"].should == "Saved 1 bookmark(s)"
107
- res['code'].should == 1
106
+ expect(res["message"]).to eq "Saved 1 bookmark(s)"
107
+ expect(res['code']).to eq 1
108
108
  end
109
-
109
+
110
110
  end
111
-
111
+
112
112
  describe ActiveDiigo::Base do
113
-
113
+
114
114
  before(:all) do
115
115
  ActiveDiigo.api_key = 'TEST_API_KEY'
116
116
  ActiveDiigo.username = 'test-user'
117
117
  ActiveDiigo.password = 'test-pass'
118
118
  end
119
-
119
+
120
120
  it "should find bookmarks with user test-user and return 10 bookmarks defaultly" do
121
121
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?user=test-user&key=TEST_API_KEY")
122
-
122
+
123
123
  response = ActiveDiigo::Base.find('test-user')
124
- response.size.should == 10
124
+ expect(response.size).to eq 10
125
125
  end
126
-
126
+
127
127
  it "should find bookmarks with user test-user and return 2 bookmarks" do
128
128
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?count=2&user=test-user&key=TEST_API_KEY",
129
129
  :fixture => 'bookmarks_count')
130
-
130
+
131
131
  response = ActiveDiigo::Base.find('test-user', :count => 2)
132
- response.size.should == 2
132
+ expect(response.size).to eq 2
133
133
  end
134
-
134
+
135
135
  it "should find bookmarks with specified tags" do
136
136
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?tags=mysql%2C%20rvm&user=test-user&key=TEST_API_KEY",
137
137
  :fixture => 'bookmarks_with_tags')
138
-
138
+
139
139
  response = ActiveDiigo::Base.find('test-user', :tags => 'mysql, rvm')
140
- response.size.should == 1
141
- response.first.tags.should include('mysql')
140
+ expect(response.size).to eq 1
141
+ expect(response.first.tags).to include('mysql')
142
142
  end
143
-
143
+
144
144
  it "should find bookmarks that includes tags searched for" do
145
145
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?tags=mysql%2C%20rvm&user=test-user&key=TEST_API_KEY",
146
146
  :fixture => 'bookmarks_with_tags')
147
-
147
+
148
148
  response = ActiveDiigo::Base.find('test-user', :tags => 'mysql, rvm')
149
- response.first.tags.should include('mysql')
150
- response.first.tags.should include('rvm')
151
- end
152
-
149
+ expect(response.first.tags).to include('mysql')
150
+ expect(response.first.tags).to include('rvm')
151
+ end
152
+
153
153
  it "should save bookmark and should return success" do
154
154
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks", :method => :post,
155
- :fixture => 'save_success')
155
+ :fixture => 'save_success')
156
156
  response = ActiveDiigo::Base.save('test-title', 'http://testtitle.com')
157
- response["message"].should == "Saved 1 bookmark(s)"
158
- response['code'].should == 1
157
+ expect(response["message"]).to eq "Saved 1 bookmark(s)"
158
+ expect(response['code']).to eq 1
159
159
  end
160
-
160
+
161
161
  it "should get ArgumentError while calling save without arguments" do
162
- Proc.new do
163
- response = ActiveDiigo::Base.save()
164
- end.should raise_error(ArgumentError)
162
+ expect(Proc.new do
163
+ response = ActiveDiigo::Base.save()
164
+ end).to raise_error(ArgumentError)
165
165
  end
166
-
166
+
167
167
  it "should return object of class that inherits ActiveDiigo::Base" do
168
168
  class MyDiigo < ActiveDiigo::Base; end
169
169
  mock_request_for("https://test-user:test-pass@secure.diigo.com/api/v2/bookmarks?user=test-user&key=TEST_API_KEY")
170
-
170
+
171
171
  response = MyDiigo.find('test-user')
172
- response.size.should == 10
173
- response.first.should be_an_instance_of MyDiigo
172
+ expect(response.size).to eq 10
173
+ expect(response.first).to be_an_instance_of MyDiigo
174
174
  end
175
-
175
+
176
176
  it "should respond to all methods in class that inherits ActiveDiigo::Base" do
177
177
  class MyDiigo < ActiveDiigo::Base; end
178
- MyDiigo.should respond_to(:find)
179
- MyDiigo.should respond_to(:save)
178
+ expect(MyDiigo).to respond_to(:find)
179
+ expect(MyDiigo).to respond_to(:save)
180
180
  end
181
-
181
+
182
182
  end
183
-
183
+
184
184
  describe "Misc" do
185
185
  describe ActiveDiigo::Errors do
186
-
186
+
187
187
  before(:all) do
188
188
  @base_name = "ActiveDiigo::Errors::ActiveDiigoError"
189
189
  end
190
-
190
+
191
191
  it "should inherit from Standard Error" do
192
- ActiveDiigo::Errors::ActiveDiigoError.superclass.name.should == "StandardError"
192
+ expect(ActiveDiigo::Errors::ActiveDiigoError.superclass.name).to eq "StandardError"
193
193
  end
194
-
194
+
195
195
  it "should have various error classes implemented" do
196
- ActiveDiigo::Errors::ActiveDiigoError.name.should == @base_name
197
- ActiveDiigo::Errors::NotAuthorizedError.superclass.name.should == @base_name
198
- ActiveDiigo::Errors::ForbiddenError.superclass.name.should == @base_name
199
- ActiveDiigo::Errors::BadRequestError.superclass.name.should == @base_name
200
- ActiveDiigo::Errors::NotFoundError.superclass.name.should == @base_name
201
- ActiveDiigo::Errors::InternalServerError.superclass.name.should == @base_name
202
- ActiveDiigo::Errors::BadGatewayError.superclass.name.should == @base_name
203
- ActiveDiigo::Errors::ServiceUnavailableError.superclass.name.should == @base_name
196
+ expect(ActiveDiigo::Errors::ActiveDiigoError.name).to eq @base_name
197
+ expect(ActiveDiigo::Errors::NotAuthorizedError.superclass.name).to eq @base_name
198
+ expect(ActiveDiigo::Errors::ForbiddenError.superclass.name).to eq @base_name
199
+ expect(ActiveDiigo::Errors::BadRequestError.superclass.name).to eq @base_name
200
+ expect(ActiveDiigo::Errors::NotFoundError.superclass.name).to eq @base_name
201
+ expect(ActiveDiigo::Errors::InternalServerError.superclass.name).to eq @base_name
202
+ expect(ActiveDiigo::Errors::BadGatewayError.superclass.name).to eq @base_name
203
+ expect(ActiveDiigo::Errors::ServiceUnavailableError.superclass.name).to eq @base_name
204
204
  end
205
-
205
+
206
206
  end
207
207
  end
208
-
208
+
209
209
  end
metadata CHANGED
@@ -1,94 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_diigo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bagwan Pankaj
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-02-02 00:00:00.000000000Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
- requirement: &2153176140 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *2153176140
25
- - !ruby/object:Gem::Dependency
26
- name: json
27
- requirement: &2153175660 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ! '>='
24
+ - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *2153175660
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
- requirement: &2153175180 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- version: 2.1.0
44
- type: :development
45
- prerelease: false
46
- version_requirements: *2153175180
47
- - !ruby/object:Gem::Dependency
48
- name: yard
49
- requirement: &2153174700 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 0.6.0
55
- type: :development
56
- prerelease: false
57
- version_requirements: *2153174700
58
- - !ruby/object:Gem::Dependency
59
- name: bundler
60
- requirement: &2153174220 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ~>
64
- - !ruby/object:Gem::Version
65
- version: 1.0.0
66
- type: :development
67
- prerelease: false
68
- version_requirements: *2153174220
69
27
  - !ruby/object:Gem::Dependency
70
- name: rcov
71
- requirement: &2153173740 !ruby/object:Gem::Requirement
72
- none: false
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
73
30
  requirements:
74
- - - ! '>='
31
+ - - ">="
75
32
  - !ruby/object:Gem::Version
76
33
  version: '0'
77
- type: :development
34
+ type: :runtime
78
35
  prerelease: false
79
- version_requirements: *2153173740
80
- - !ruby/object:Gem::Dependency
81
- name: fakeweb
82
- requirement: &2153173260 !ruby/object:Gem::Requirement
83
- none: false
36
+ version_requirements: !ruby/object:Gem::Requirement
84
37
  requirements:
85
- - - ! '>='
38
+ - - ">="
86
39
  - !ruby/object:Gem::Version
87
40
  version: '0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: *2153173260
91
- description: ! 'ActiveDiigo is a wrapper for Diigo API(version: v2).'
41
+ description: 'ActiveDiigo is a wrapper for Diigo API(version: v2).'
92
42
  email: me@bagwanpankaj.com
93
43
  executables: []
94
44
  extensions: []
@@ -97,38 +47,37 @@ extra_rdoc_files:
97
47
  - README.markdown
98
48
  files:
99
49
  - LICENSE.txt
50
+ - README.markdown
100
51
  - VERSION
101
52
  - lib/active_diigo.rb
102
53
  - lib/active_diigo/base.rb
103
54
  - lib/active_diigo/errors.rb
104
55
  - lib/active_diigo/request.rb
105
56
  - lib/active_diigo/response_object.rb
106
- - README.markdown
107
57
  - spec/active_diigo_spec.rb
108
58
  - spec/spec_helper.rb
109
59
  - spec/support/fake_web_stub.rb
110
60
  homepage: http://github.com/bagwanpankaj/active_diigo
111
61
  licenses:
112
62
  - MIT
63
+ metadata: {}
113
64
  post_install_message:
114
65
  rdoc_options: []
115
66
  require_paths:
116
67
  - lib
117
68
  required_ruby_version: !ruby/object:Gem::Requirement
118
- none: false
119
69
  requirements:
120
- - - ! '>='
70
+ - - ">="
121
71
  - !ruby/object:Gem::Version
122
72
  version: '0'
123
73
  required_rubygems_version: !ruby/object:Gem::Requirement
124
- none: false
125
74
  requirements:
126
- - - ! '>='
75
+ - - ">="
127
76
  - !ruby/object:Gem::Version
128
77
  version: '0'
129
78
  requirements: []
130
79
  rubyforge_project:
131
- rubygems_version: 1.8.10
80
+ rubygems_version: 2.4.5
132
81
  signing_key:
133
82
  specification_version: 3
134
83
  summary: Diigo Restful API wrapper; much like ActiveRecord