ZenfolioAPI 0.1.0 → 0.1.1
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/lib/ZenfolioAPI/authentication.rb +0 -1
- data/lib/ZenfolioAPI/session.rb +12 -1
- data/lib/ZenfolioAPI/version.rb +1 -1
- data/spec/ZenfolioAPI_spec.rb +14 -9
- metadata +5 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1af01afe855c0ab088272b31061de1eb7772b42
|
4
|
+
data.tar.gz: 0d13635d2e954a58837bb4d26fc763d9d712292d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9510680d2b123cc6279cab674de5a8f617151d6988289c372ab4447b0423c11a3c64e087d64d1f0f71a72d6b4c6962bf79b5a7a1e7497a2f18fbe2f93131c94
|
7
|
+
data.tar.gz: 03b510498acff492b90fac6d8d7051c52a75afc42c6f2e1b8d226dce6122d85b2347659b81f8069eebd45ee2b4146ee109fd2b653e80ad02ee67e990649d28e4
|
data/lib/ZenfolioAPI/session.rb
CHANGED
@@ -5,6 +5,7 @@ module ZenfolioAPI
|
|
5
5
|
attr_accessor :galleries
|
6
6
|
attr_accessor :photos
|
7
7
|
attr_accessor :groups
|
8
|
+
attr_accessor :username
|
8
9
|
|
9
10
|
# Create the Zenfolio Session
|
10
11
|
#
|
@@ -16,6 +17,9 @@ module ZenfolioAPI
|
|
16
17
|
@password = password
|
17
18
|
@auth = ZenfolioAPI::Authentication.new(username, password)
|
18
19
|
|
20
|
+
@response = load_private_profile
|
21
|
+
@username = @response['result']['LoginName'] if @response['result']['LoginName'] != @username
|
22
|
+
|
19
23
|
@galleries = []
|
20
24
|
@photos = []
|
21
25
|
@groups = []
|
@@ -24,11 +28,18 @@ module ZenfolioAPI
|
|
24
28
|
# Performs the API request to the Zenfolio server
|
25
29
|
#
|
26
30
|
# @author David Slone
|
27
|
-
def api_request method, params
|
31
|
+
def api_request method, params = nil
|
28
32
|
connection = ZenfolioAPI::HTTP.new()
|
29
33
|
@response = connection.POST(method, params, @auth.token)
|
30
34
|
end
|
31
35
|
|
36
|
+
#
|
37
|
+
#
|
38
|
+
# @author David Slone
|
39
|
+
def load_private_profile
|
40
|
+
api_request 'LoadPrivateProfile'
|
41
|
+
end
|
42
|
+
|
32
43
|
# The CollectionAddPhoto method adds a photo reference to the specified collection.
|
33
44
|
#
|
34
45
|
# @author David Slone
|
data/lib/ZenfolioAPI/version.rb
CHANGED
data/spec/ZenfolioAPI_spec.rb
CHANGED
@@ -3,19 +3,22 @@ require 'spec_helper'
|
|
3
3
|
describe ZenfolioAPI do
|
4
4
|
session = ZenfolioAPI::Session.new(ENV['ZENFOLIO_USERNAME'],ENV['ZENFOLIO_PASSWORD'])
|
5
5
|
|
6
|
+
it "should find username for authenticated user" do
|
7
|
+
email_session = ZenfolioAPI::Session.new(ENV['ZENFOLIO_EMAIL'], ENV['ZENFOLIO_PASSWORD'])
|
8
|
+
email_session.username.should eq(ENV['ZENFOLIO_USERNAME'])
|
9
|
+
end
|
10
|
+
|
6
11
|
it "Should connect to API server" do
|
7
12
|
session.should_not be_nil
|
8
13
|
end
|
9
14
|
|
10
15
|
it "should list galleries for user" do
|
11
16
|
session.list_galleries
|
12
|
-
session.groups.
|
13
|
-
end
|
17
|
+
session.groups.should_not be_nil
|
14
18
|
end
|
15
19
|
|
16
20
|
it "should raise exception for incorrect gallery/collection id" do
|
17
21
|
expect { session.images_for_gallery 5 }.to raise_error
|
18
|
-
|
19
22
|
end
|
20
23
|
|
21
24
|
it "should list photos for a gallery" do
|
@@ -27,7 +30,7 @@ describe ZenfolioAPI do
|
|
27
30
|
end
|
28
31
|
|
29
32
|
it "should load specific photo" do
|
30
|
-
photo = session.load_photo
|
33
|
+
photo = session.load_photo 1710182934435540554
|
31
34
|
photo.should_not be_nil
|
32
35
|
end
|
33
36
|
|
@@ -39,16 +42,18 @@ describe ZenfolioAPI do
|
|
39
42
|
it "shoud list groups for a group" do
|
40
43
|
session.list_galleries
|
41
44
|
group = session.groups.first
|
42
|
-
|
45
|
+
group.should_not be_nil
|
43
46
|
end
|
44
47
|
|
45
48
|
it "should list photos for a group" do
|
46
49
|
session.list_galleries
|
47
50
|
session.groups.each do |group|
|
48
|
-
group.elements.
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
group.elements.should_not be_nil
|
52
|
+
#group.elements.each do |element|
|
53
|
+
# puts "element: #{element.inspect}\n\n"
|
54
|
+
# session.images_for_gallery element.id
|
55
|
+
# session.photos.should_not be_nil
|
56
|
+
#end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ZenfolioAPI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Slone
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -58,27 +55,26 @@ files:
|
|
58
55
|
- spec/spec_helper.rb
|
59
56
|
homepage: ''
|
60
57
|
licenses: []
|
58
|
+
metadata: {}
|
61
59
|
post_install_message:
|
62
60
|
rdoc_options: []
|
63
61
|
require_paths:
|
64
62
|
- lib
|
65
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
64
|
requirements:
|
68
65
|
- - ! '>='
|
69
66
|
- !ruby/object:Gem::Version
|
70
67
|
version: '0'
|
71
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
69
|
requirements:
|
74
70
|
- - ! '>='
|
75
71
|
- !ruby/object:Gem::Version
|
76
72
|
version: '0'
|
77
73
|
requirements: []
|
78
74
|
rubyforge_project:
|
79
|
-
rubygems_version:
|
75
|
+
rubygems_version: 2.0.5
|
80
76
|
signing_key:
|
81
|
-
specification_version:
|
77
|
+
specification_version: 4
|
82
78
|
summary: Currently just a basic implementation of the Zenfolio API with features to
|
83
79
|
list all galleries and photos, and get all the information about a gallery or photo.
|
84
80
|
test_files:
|