ZenfolioAPI 0.0.2 → 0.0.3

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.
@@ -5,6 +5,7 @@ module ZenfolioAPI
5
5
  attr_reader :created_on
6
6
  attr_reader :modified_on
7
7
  attr_reader :page_url
8
+ attr_reader :title
8
9
  attr_reader :tile_photo
9
10
  attr_reader :mailbox_id
10
11
  attr_reader :immediate_children_count
@@ -45,18 +45,27 @@ module ZenfolioAPI
45
45
  elsif value['$type'] == "Group"
46
46
  elements = []
47
47
  value['Elements'].each do |element|
48
- elements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'],
49
- :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],
50
- :image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],
51
- :featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],
52
- :video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'],
53
- :photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])
48
+ if element['$type'] == "PhotoSet"
49
+ elements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'],
50
+ :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],
51
+ :image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],
52
+ :featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],
53
+ :video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'],
54
+ :photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])
55
+ else
56
+ group_elements = load_group element['Id']
57
+ elements << ZenfolioAPI::Model::Group.new(:id => element['Id'], :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'],
58
+ :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :immediate_children_count => value['ImmediateChildrenCount'], :text_cn => element['TextCn'],
59
+ :caption => element['Caption'], :collection_count => value['CollectionCount'], :sub_group_count => value['SubGroupCount'], :gallery_count => value['GalleryCount'],
60
+ :featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],
61
+ :photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :title => value['Title'])
62
+ end
54
63
  end
55
64
 
56
65
  @groups << ZenfolioAPI::Model::Group.new(:id => value['Id'], :created_on => value['CreatedOn']['Value'], :modified_on => value['ModifiedOn']['Value'],
57
66
  :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], :immediate_children_count => value['ImmediateChildrenCount'], :text_cn => value['TextCn'],
58
67
  :caption => value['Caption'], :collection_count => value['CollectionCount'], :sub_group_count => value['SubGroupCount'], :gallery_count => value['GalleryCount'],
59
- :photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :elements => elements)
68
+ :photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :elements => elements, :title => value['Title'])
60
69
  end
61
70
  end
62
71
 
@@ -102,5 +111,34 @@ module ZenfolioAPI
102
111
 
103
112
 
104
113
  end
114
+
115
+ # The LoadGroup method obtains a snapshot of the specified photoset group.
116
+ #
117
+ # @author David Slone
118
+ # @param [Integer] group_id 64-bit identifier of the photoset group to load
119
+ # @param [String] info_level Specifies which Group snapshot fields to return. This parameter is new in API version 1.4.
120
+ # @param [String] include_children Indicates whether to return immediate group children. This parameter is new in API version 1.4.
121
+ def load_group group_id, info_level = "Full", include_children = "true"
122
+ @response = api_request 'LoadGroup', [group_id, info_level, include_children]
123
+
124
+ elements = []
125
+ @response['result']['Elements'].each do |element|
126
+ if element['$type'] == "PhotoSet"
127
+ elements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'],
128
+ :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],
129
+ :image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],
130
+ :featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],
131
+ :video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'],
132
+ :photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])
133
+ else
134
+ group_elements = load_group element['Id']
135
+ elements << ZenfolioAPI::Model::Group.new(:id => element['Id'], :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'],
136
+ :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :immediate_children_count => value['ImmediateChildrenCount'], :text_cn => element['TextCn'],
137
+ :caption => element['Caption'], :collection_count => value['CollectionCount'], :sub_group_count => value['SubGroupCount'], :gallery_count => value['GalleryCount'],
138
+ :featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],
139
+ :photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :title => value['Title'])
140
+ end
141
+ end
142
+ end
105
143
  end
106
144
  end
@@ -1,3 +1,3 @@
1
1
  module ZenfolioAPI
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ZenfolioAPI do
4
- session = ZenfolioAPI::Session.new('punndit','punndit1024')
4
+ session = ZenfolioAPI::Session.new('<username>','<password>')
5
5
 
6
6
  it "Should connect to API server" do
7
7
  session.should_not be_nil
@@ -20,6 +20,11 @@ describe ZenfolioAPI do
20
20
  session.images_for_gallery 562597393410974837
21
21
  end
22
22
 
23
+ it "shoud list groups for a group" do
24
+ session.list_galleries
25
+ group = session.groups.first
26
+ end
27
+
23
28
  it "should list photos for a group" do
24
29
  session.list_galleries
25
30
  session.groups.each do |group|
@@ -31,8 +36,8 @@ describe ZenfolioAPI do
31
36
  end
32
37
 
33
38
  it "should list messages in inbox" do
34
- session.list_galleries
35
- inbox = session.get_mailbox_messages session.galleries.first.mailbox_id
39
+ #session.list_galleries
40
+ #inbox = session.get_mailbox_messages session.galleries.first.mailbox_id
36
41
  end
37
42
 
38
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZenfolioAPI
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec