podio 0.8.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +9 -2
  4. data/README.md +1 -4
  5. data/examples/oauth_web_flow/Gemfile +4 -0
  6. data/examples/{sinatra.rb → oauth_web_flow/sinatra.rb} +7 -6
  7. data/lib/podio.rb +18 -3
  8. data/lib/podio/active_podio/base.rb +107 -62
  9. data/lib/podio/client.rb +30 -5
  10. data/lib/podio/error.rb +22 -10
  11. data/lib/podio/middleware/error_response.rb +23 -16
  12. data/lib/podio/middleware/json_response.rb +1 -1
  13. data/lib/podio/middleware/logger.rb +3 -0
  14. data/lib/podio/middleware/oauth2.rb +3 -0
  15. data/lib/podio/models/account_provider.rb +1 -0
  16. data/lib/podio/models/action.rb +19 -2
  17. data/lib/podio/models/activation_status.rb +8 -2
  18. data/lib/podio/models/app_store_category.rb +4 -1
  19. data/lib/podio/models/app_store_share.rb +29 -16
  20. data/lib/podio/models/application.rb +57 -2
  21. data/lib/podio/models/application_email.rb +5 -2
  22. data/lib/podio/models/application_field.rb +5 -2
  23. data/lib/podio/models/batch.rb +8 -0
  24. data/lib/podio/models/by_line.rb +2 -1
  25. data/lib/podio/models/calendar_event.rb +63 -3
  26. data/lib/podio/models/calendar_mute.rb +6 -1
  27. data/lib/podio/models/category.rb +1 -0
  28. data/lib/podio/models/comment.rb +29 -8
  29. data/lib/podio/models/condition.rb +8 -0
  30. data/lib/podio/models/condition_set.rb +40 -0
  31. data/lib/podio/models/contact.rb +13 -2
  32. data/lib/podio/models/contract.rb +85 -1
  33. data/lib/podio/models/contract_event.rb +17 -0
  34. data/lib/podio/models/contract_price.rb +3 -7
  35. data/lib/podio/models/contract_price_v2.rb +31 -0
  36. data/lib/podio/models/contract_user.rb +4 -0
  37. data/lib/podio/models/conversation.rb +114 -13
  38. data/lib/podio/models/conversation_event.rb +51 -0
  39. data/lib/podio/models/conversation_message.rb +2 -1
  40. data/lib/podio/models/conversation_participant.rb +3 -2
  41. data/lib/podio/models/date_election.rb +35 -0
  42. data/lib/podio/models/email_contact.rb +46 -0
  43. data/lib/podio/models/email_subscription_setting.rb +4 -23
  44. data/lib/podio/models/embed.rb +4 -4
  45. data/lib/podio/models/experiment.rb +71 -0
  46. data/lib/podio/models/external_file.rb +7 -2
  47. data/lib/podio/models/file_attachment.rb +23 -0
  48. data/lib/podio/models/form.rb +7 -0
  49. data/lib/podio/models/friend.rb +12 -0
  50. data/lib/podio/models/grant.rb +73 -0
  51. data/lib/podio/models/hook.rb +13 -6
  52. data/lib/podio/models/importer.rb +3 -0
  53. data/lib/podio/models/integration.rb +17 -6
  54. data/lib/podio/models/invoice.rb +30 -0
  55. data/lib/podio/models/item.rb +81 -14
  56. data/lib/podio/models/item_diff.rb +9 -5
  57. data/lib/podio/models/item_field.rb +11 -2
  58. data/lib/podio/models/item_revision.rb +5 -2
  59. data/lib/podio/models/linked_account.rb +1 -0
  60. data/lib/podio/models/live.rb +61 -0
  61. data/lib/podio/models/net_promoter_score.rb +28 -0
  62. data/lib/podio/models/notification.rb +9 -4
  63. data/lib/podio/models/notification_group.rb +5 -2
  64. data/lib/podio/models/o_auth.rb +4 -2
  65. data/lib/podio/models/o_auth_client.rb +1 -2
  66. data/lib/podio/models/organization.rb +22 -10
  67. data/lib/podio/models/organization_contact.rb +2 -1
  68. data/lib/podio/models/organization_member.rb +17 -3
  69. data/lib/podio/models/organization_profile.rb +8 -2
  70. data/lib/podio/models/pin.rb +27 -0
  71. data/lib/podio/models/profile.rb +19 -50
  72. data/lib/podio/models/promotion.rb +91 -0
  73. data/lib/podio/models/rating.rb +23 -5
  74. data/lib/podio/models/recurrence.rb +6 -3
  75. data/lib/podio/models/reference.rb +17 -1
  76. data/lib/podio/models/reminder.rb +8 -3
  77. data/lib/podio/models/search.rb +7 -1
  78. data/lib/podio/models/space.rb +41 -2
  79. data/lib/podio/models/space_contact.rb +1 -2
  80. data/lib/podio/models/space_invitation.rb +4 -5
  81. data/lib/podio/models/space_member.rb +37 -4
  82. data/lib/podio/models/status.rb +20 -8
  83. data/lib/podio/models/stream_activity_group.rb +40 -0
  84. data/lib/podio/models/stream_mute.rb +7 -8
  85. data/lib/podio/models/stream_object.rb +19 -11
  86. data/lib/podio/models/subscription.rb +7 -1
  87. data/lib/podio/models/tag.rb +6 -1
  88. data/lib/podio/models/tag_search.rb +2 -1
  89. data/lib/podio/models/task.rb +74 -18
  90. data/lib/podio/models/task_label.rb +10 -2
  91. data/lib/podio/models/user.rb +50 -6
  92. data/lib/podio/models/user_mail.rb +4 -0
  93. data/lib/podio/models/user_status.rb +7 -0
  94. data/lib/podio/models/view.rb +27 -7
  95. data/lib/podio/models/widget.rb +25 -3
  96. data/lib/podio/version.rb +1 -1
  97. data/podio.gemspec +13 -10
  98. data/script/config.example.rb +6 -0
  99. data/script/referenceGenerator.rb +87 -0
  100. data/test/active_podio_test.rb +44 -34
  101. data/test/client_test.rb +13 -2
  102. metadata +89 -36
  103. data/lib/podio/middleware/date_conversion.rb +0 -37
  104. data/lib/podio/models/bulletin.rb +0 -60
  105. data/lib/podio/models/connection.rb +0 -53
  106. data/lib/podio/models/news.rb +0 -85
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/tasks
1
2
  class Podio::TaskLabel < ActivePodio::Base
2
3
  include ActivePodio::Updatable
3
4
 
@@ -7,29 +8,34 @@ class Podio::TaskLabel < ActivePodio::Base
7
8
 
8
9
  DEFAULT_COLOR_FOR_NEW_LABELS = 'E9E9E9'
9
10
 
11
+ # @see https://developers.podio.com/doc/tasks/create-label-151265
10
12
  def create
11
13
  if self.color.nil? || self.color.empty?
12
14
  self.color = DEFAULT_COLOR_FOR_NEW_LABELS
13
15
  end
14
-
16
+
15
17
  self.label_id = self.class.create(self.attributes)
16
18
  end
17
19
 
20
+ # @see https://developers.podio.com/doc/tasks/delete-label-151302
18
21
  def destroy
19
22
  self.class.delete(self.label_id)
20
23
  end
21
24
 
25
+ # @see https://developers.podio.com/doc/tasks/update-label-151289
22
26
  def update
23
27
  self.class.update(self.label_id, self.attributes)
24
28
  end
25
-
29
+
26
30
  class << self
31
+ # @see https://developers.podio.com/doc/tasks/get-labels-151534
27
32
  def find_all_labels
28
33
  list Podio.connection.get { |req|
29
34
  req.url("/task/label/")
30
35
  }.body
31
36
  end
32
37
 
38
+ # @see https://developers.podio.com/doc/tasks/create-label-151265
33
39
  def create(attributes)
34
40
  response = Podio.connection.post do |req|
35
41
  req.url "/task/label/"
@@ -39,10 +45,12 @@ class Podio::TaskLabel < ActivePodio::Base
39
45
  response.body['label_id']
40
46
  end
41
47
 
48
+ # @see https://developers.podio.com/doc/tasks/delete-label-151302
42
49
  def delete(label_id)
43
50
  Podio.connection.delete("/task/label/#{label_id}").status
44
51
  end
45
52
 
53
+ # @see https://developers.podio.com/doc/tasks/update-label-151289
46
54
  def update(label_id, attributes)
47
55
  Podio.connection.put("/task/label/#{label_id}", attributes).status
48
56
  end
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/users
1
2
  class Podio::User < ActivePodio::Base
2
3
  property :user_id, :integer
3
4
  property :mail, :string
@@ -7,9 +8,8 @@ class Podio::User < ActivePodio::Base
7
8
  property :password, :string
8
9
  property :old_password, :string
9
10
  property :new_password, :string
10
- property :flags, :array
11
- property :betas, :array
12
11
  property :created_on, :datetime
12
+ property :activated_on, :datetime
13
13
  property :name, :string
14
14
  property :link, :string
15
15
  property :avatar, :integer
@@ -28,6 +28,7 @@ class Podio::User < ActivePodio::Base
28
28
  alias_method :id, :user_id
29
29
 
30
30
  class << self
31
+ # @see https://developers.podio.com/doc/users/get-user-22378
31
32
  def current
32
33
  member Podio.connection.get("/user/").body
33
34
  end
@@ -42,7 +43,7 @@ class Podio::User < ActivePodio::Base
42
43
  end
43
44
 
44
45
  def create_inactive(attributes)
45
- response = Podio.connection.post do |req|
46
+ response = Podio.client.trusted_connection.post do |req|
46
47
  req.url '/user/inactive/'
47
48
  req.body = attributes
48
49
  end
@@ -54,12 +55,27 @@ class Podio::User < ActivePodio::Base
54
55
  Podio.connection.put("/user/", attributes).status
55
56
  end
56
57
 
58
+ # @see https://developers.podio.com/doc/users/update-profile-22402
57
59
  def update_profile(attributes)
58
60
  Podio.connection.put("/user/profile/", attributes).status
59
61
  end
60
62
 
63
+ # @see https://developers.podio.com/doc/users/update-profile-field-22500
64
+ def update_profile_field(key, attributes)
65
+ Podio.connection.put("/user/profile/#{key}", attributes).status
66
+ end
67
+
68
+ def can_request_call
69
+ response = Podio.connection.get("/user/request_call")
70
+ response.body['requestable']
71
+ end
72
+
73
+ def request_call
74
+ Podio.connection.post("/user/request_call").status
75
+ end
76
+
61
77
  def activate(attributes)
62
- response = Podio.connection.post do |req|
78
+ response = Podio.client.trusted_connection.post do |req|
63
79
  req.url '/user/activate_user'
64
80
  req.body = attributes
65
81
  end
@@ -67,6 +83,7 @@ class Podio::User < ActivePodio::Base
67
83
  member response.body
68
84
  end
69
85
 
86
+ # @see https://developers.podio.com/doc/organizations/get-organization-admins-81542
70
87
  def find_all_admins_for_org(org_id)
71
88
  list Podio.connection.get("/org/#{org_id}/admin/").body
72
89
  end
@@ -79,14 +96,17 @@ class Podio::User < ActivePodio::Base
79
96
  Podio.connection.put("/user/property/#{name}", {:value => value}).status
80
97
  end
81
98
 
99
+ # @see https://developers.podio.com/doc/users/get-user-property-29798
82
100
  def get_property_hash(name)
83
101
  Podio.connection.get("/user/property/#{name}").body
84
102
  end
85
103
 
104
+ # @see https://developers.podio.com/doc/users/set-user-property-29799
86
105
  def set_property_hash(name, hash)
87
106
  Podio.connection.put("/user/property/#{name}", hash).status
88
107
  end
89
108
 
109
+ # @see https://developers.podio.com/doc/users/set-user-properties-9052829
90
110
  def set_properties(attributes)
91
111
  response = Podio.connection.put do |req|
92
112
  req.url '/user/property/'
@@ -96,6 +116,7 @@ class Podio::User < ActivePodio::Base
96
116
  response.body
97
117
  end
98
118
 
119
+ # @see https://developers.podio.com/doc/users/delete-user-property-29800
99
120
  def remove_property(name)
100
121
  Podio.connection.delete("/user/property/#{name}", {}).status
101
122
  end
@@ -114,7 +135,7 @@ class Podio::User < ActivePodio::Base
114
135
  end
115
136
 
116
137
  def recover(mail)
117
- response = Podio.connection.post do |req|
138
+ response = Podio.client.trusted_connection.post do |req|
118
139
  req.url '/user/recover_password'
119
140
  req.body = {:mail => mail}
120
141
  end
@@ -123,7 +144,7 @@ class Podio::User < ActivePodio::Base
123
144
  end
124
145
 
125
146
  def reset(password, recovery_code)
126
- response = Podio.connection.post do |req|
147
+ response = Podio.client.trusted_connection.post do |req|
127
148
  req.url '/user/reset_password'
128
149
  req.body = {:password => password, :recovery_code => recovery_code}
129
150
  end
@@ -138,5 +159,28 @@ class Podio::User < ActivePodio::Base
138
159
  def internal_source
139
160
  Podio.connection.get("/user/source").body
140
161
  end
162
+
163
+ def merge(activation_code)
164
+ response = Podio.connection.post do |req|
165
+ req.url '/user/merge'
166
+ req.body = {:activation_code => activation_code}
167
+ end
168
+
169
+ response.status
170
+ end
171
+
172
+ def get_sales_agent_profile
173
+ Podio.connection.get("/user/sales_agent").body
174
+ end
175
+
176
+ def resend_signup_email(mail)
177
+ response = Podio.connection.post do |req|
178
+ req.url '/user/resend_signup_email'
179
+ req.body = {:mail => mail}
180
+ end
181
+
182
+ response.status
183
+ end
184
+
141
185
  end
142
186
  end
@@ -1,7 +1,11 @@
1
+ # @see https://developers.podio.com/doc/users
1
2
  class Podio::UserMail < ActivePodio::Base
2
3
  property :mail, :string
3
4
  property :verified, :boolean
4
5
  property :primary, :boolean
5
6
  property :disabled, :boolean
6
7
 
8
+ def self.validate(mail)
9
+ Podio.client.trusted_connection.post("/user/mail_validation", :mail => mail).body
10
+ end
7
11
  end
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/users
1
2
  class Podio::UserStatus < ActivePodio::Base
2
3
  property :user, :hash
3
4
  property :profile, :hash
@@ -6,12 +7,18 @@ class Podio::UserStatus < ActivePodio::Base
6
7
  property :calendar_code, :string
7
8
  property :task_mail, :string
8
9
  property :mailbox, :string
10
+ property :message_unread_count, :integer
11
+ property :flags, :array
12
+ property :betas, :array
13
+ property :push, :hash
14
+ property :presence, :hash
9
15
 
10
16
  has_one :user, :class => 'User'
11
17
  has_one :contact, :class => 'Contact', :property => :profile
12
18
  has_one :referral, :class => 'Referral'
13
19
 
14
20
  class << self
21
+ # @see https://developers.podio.com/doc/users/get-user-status-22480
15
22
  def current
16
23
  member Podio.connection.get("/user/status").body
17
24
  end
@@ -1,5 +1,6 @@
1
+ # @see https://developers.podio.com/doc/filters
1
2
  class Podio::View < ActivePodio::Base
2
- property :view_id, :integer
3
+ property :view_id, :string
3
4
  property :name, :string
4
5
  property :created_on, :datetime
5
6
  property :items, :integer
@@ -8,39 +9,58 @@ class Podio::View < ActivePodio::Base
8
9
  property :filters, :hash
9
10
  property :layout, :string
10
11
  property :fields, :hash
12
+ property :type, :string
11
13
 
12
14
  alias_method :id, :view_id
13
15
 
14
16
  has_one :created_by, :class => 'User'
15
17
 
16
18
  class << self
19
+ # @see https://developers.podio.com/doc/views/get-last-view-27663
17
20
  def find_last(app_id)
18
21
  member Podio.connection.get("/view/app/#{app_id}/last").body
19
22
  end
20
23
 
21
- def find_all(app_id)
24
+ # @see https://developers.podio.com/doc/views/get-views-27460
25
+ def find_all(app_id, options={})
22
26
  list Podio.connection.get { |req|
23
- req.url("/view/app/#{app_id}/")
27
+ req.url("/view/app/#{app_id}/", options)
24
28
  }.body
25
29
  end
26
30
 
27
- def find(id)
28
- member Podio.connection.get("/view/#{id}").body
31
+ # @see https://developers.podio.com/doc/views/get-view-27450
32
+ def find(id, app_id=nil)
33
+ path = app_id ? "/view/app/#{app_id}/#{id}" : "/view/#{id}"
34
+
35
+ member Podio.connection.get(path).body
29
36
  end
30
37
 
38
+ # @see https://developers.podio.com/doc/views/delete-view-27454
31
39
  def delete(view_id)
32
40
  Podio.connection.delete("/view/#{view_id}").status
33
41
  end
34
42
 
43
+ # @see https://developers.podio.com/doc/views/create-view-27453
35
44
  def create(app_id, attributes)
36
45
  response = Podio.connection.post do |req|
37
46
  req.url "/view/app/#{app_id}/"
38
47
  req.body = attributes
39
48
  end
40
49
 
41
- response.body['view_id']
50
+ member response.body
51
+ end
52
+
53
+ # @see https://developers.podio.com/doc/views/update-view-20069949
54
+ def update(view_id, attributes)
55
+ response = Podio.connection.put do |req|
56
+ req.url "/view/#{view_id}"
57
+ req.body = attributes
58
+ end
59
+
60
+ response.status
42
61
  end
43
62
 
63
+ # @see https://developers.podio.com/doc/views/update-last-view-5988251
44
64
  def update_last(app_id, attributes)
45
65
  Podio.connection.put do |req|
46
66
  req.url "/view/app/#{app_id}/last"
@@ -48,4 +68,4 @@ class Podio::View < ActivePodio::Base
48
68
  end
49
69
  end
50
70
  end
51
- end
71
+ end
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/widgets
1
2
  class Podio::Widget < ActivePodio::Base
2
3
  property :widget_id, :integer
3
4
  property :ref_type, :string
@@ -8,30 +9,39 @@ class Podio::Widget < ActivePodio::Base
8
9
  property :ref, :hash
9
10
  property :rights, :array
10
11
  property :data, :hash
11
-
12
+ property :x, :integer
13
+ property :y, :integer
14
+ property :rows, :integer
15
+ property :cols, :integer
16
+ property :allowed_refs, :array
17
+
12
18
  class << self
19
+ # @see https://developers.podio.com/doc/widgets/create-widget-22491
13
20
  def create(ref_type, ref_id, attributes)
14
21
  response = Podio.connection.post do |req|
15
22
  req.url "/widget/#{ref_type}/#{ref_id}/"
16
23
  req.body = attributes
17
24
  end
18
25
 
19
- response.body['widget_id']
26
+ member response.body
20
27
  end
21
28
 
29
+ # @see https://developers.podio.com/doc/widgets/update-widget-22490
22
30
  def update(id, attributes)
23
31
  response = Podio.connection.put do |req|
24
32
  req.url "/widget/#{id}"
25
33
  req.body = attributes
26
34
  end
27
35
 
28
- response.status
36
+ member response.body
29
37
  end
30
38
 
39
+ # @see https://developers.podio.com/doc/widgets/delete-widget-22492
31
40
  def delete(id)
32
41
  Podio.connection.delete("/widget/#{id}").status
33
42
  end
34
43
 
44
+ # @see https://developers.podio.com/doc/widgets/update-widget-order-22495
35
45
  def update_order(ref_type, ref_id, widget_list)
36
46
  response = Podio.connection.put do |req|
37
47
  req.url "/widget/#{ref_type}/#{ref_id}/order"
@@ -41,12 +51,24 @@ class Podio::Widget < ActivePodio::Base
41
51
  response.status
42
52
  end
43
53
 
54
+ # @see https://developers.podio.com/doc/widgets/get-widget-22489
44
55
  def find(id)
45
56
  member Podio.connection.get("/widget/#{id}").body
46
57
  end
47
58
 
59
+ # @see https://developers.podio.com/doc/widgets/get-widgets-22494
48
60
  def find_all_for_reference(ref_type, ref_id)
49
61
  list Podio.connection.get("/widget/#{ref_type}/#{ref_id}/display/").body
50
62
  end
63
+
64
+ # @see https://developers.podio.com/doc/widgets/clone-widget-105850650
65
+ def clone(id, attributes)
66
+ response = Podio.connection.post do |req|
67
+ req.url "/widget/#{id}/clone"
68
+ req.body = attributes
69
+ end
70
+
71
+ member response.body
72
+ end
51
73
  end
52
74
  end
@@ -1,3 +1,3 @@
1
1
  module Podio
2
- VERSION = '0.8.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,4 +1,4 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
2
  require 'podio/version'
3
3
 
4
4
  Gem::Specification.new do |s|
@@ -6,21 +6,24 @@ Gem::Specification.new do |s|
6
6
  s.version = Podio::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = 'Ruby wrapper for the Podio API'
9
- s.homepage = 'https://github.com/podio/podio-rb'
10
- s.email = 'florian@podio.com'
9
+ s.description = 'The official Ruby wrapper for the Podio API used and maintained by the Podio team'
10
+ s.license = 'MIT'
11
+
11
12
  s.authors = ['Florian Munz', 'Casper Fabricius']
12
- s.has_rdoc = false
13
+ s.email = 'munz@podio.com'
14
+ s.homepage = 'https://github.com/podio/podio-rb'
13
15
 
14
16
  s.files = `git ls-files`.split("\n")
15
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
18
  s.require_paths = ['lib']
17
19
 
18
- s.add_dependency('faraday', '~> 0.7.0')
19
- s.add_dependency('activesupport', '~> 3.0')
20
- s.add_dependency('activemodel', '~> 3.0')
20
+ s.has_rdoc = false
21
+
22
+ s.add_dependency('faraday', '~> 0.8.0')
23
+ s.add_dependency('activesupport', '>= 3.0')
24
+ s.add_dependency('activemodel', '>= 3.0')
21
25
  s.add_dependency('multi_json')
22
26
 
23
- s.description = <<desc
24
- The official Ruby wrapper for the Podio API used and maintained by the Podio team
25
- desc
27
+ s.add_development_dependency('rake')
28
+ s.add_development_dependency('yard')
26
29
  end
@@ -0,0 +1,6 @@
1
+ PODIO_SETUP = {
2
+ :client_id => '',
3
+ :client_secret => '',
4
+ :app_id => '',
5
+ :app_token => ''
6
+ }
@@ -0,0 +1,87 @@
1
+ # Updates API documentation. Run with:
2
+
3
+ # # Generate sample output (use as a dry run)
4
+ # bundle exec ruby referenceGenerator.rb
5
+
6
+ # # Only act on a single model
7
+ # bundle exec ruby referenceGenerator.rb --file=status.rb
8
+
9
+ # # Send updates to API documentation
10
+ # bundle exec ruby referenceGenerator.rb --update-api
11
+
12
+ # # All together
13
+ # bundle exec ruby referenceGenerator.rb --update-api --file=status.rb
14
+
15
+ require 'yard'
16
+ require 'multi_json'
17
+ require '../lib/podio'
18
+
19
+ operations = {}
20
+ path = '*.rb'
21
+ update_api = false
22
+ ARGV.each do |arg|
23
+ if arg.match('--file=')
24
+ path = arg.sub('--file=', '')
25
+ elsif arg == '--update-api'
26
+ update_api = true
27
+ end
28
+ end
29
+
30
+ YARD.parse("../lib/podio/models/#{path}")
31
+
32
+ YARD::Registry.all(:class).each do |klass|
33
+ klass.meths(:visibility => :public).each do |meth|
34
+ link = meth.tag('see').name if meth.has_tag?('see')
35
+ match = link.match(/https:\/\/developers.podio.com\/doc\/(.+)-([0-9]+)/) if link
36
+ if match
37
+ item_id = match[2].to_i
38
+
39
+ # Build example string
40
+ param_string = ''
41
+ param_list = []
42
+ meth.parameters.each do |p|
43
+ if p[1]
44
+ param_list << "#{p[0]} = #{p[1]}"
45
+ else
46
+ param_list << p[0]
47
+ end
48
+ end
49
+ param_string = "( #{param_list.join(', ')} )" if param_list.length > 0
50
+
51
+ if meth.scope == :class
52
+ example_string = "Podio::#{klass.name}.#{meth.name}#{param_string}"
53
+ else
54
+ example_string = "#{klass.name.downcase}.#{meth.name}#{param_string}"
55
+ end
56
+
57
+
58
+ data = {
59
+ :className => klass.name,
60
+ :method => meth.name,
61
+ :path => "models/"+File.basename(meth.files.first.first),
62
+ :line => meth.files.first.last,
63
+ :type => meth.scope == :class ? 'static' : 'instance',
64
+ :example => example_string,
65
+ }
66
+ operations[item_id] = [] if !operations[item_id]
67
+ operations[item_id] << data
68
+ end
69
+ end
70
+ end
71
+
72
+ if update_api
73
+ require './config.rb'
74
+ Podio.setup(:api_key => PODIO_SETUP[:client_id], :api_secret => PODIO_SETUP[:client_secret])
75
+ Podio.client.authenticate_with_app(PODIO_SETUP[:app_id], PODIO_SETUP[:app_token])
76
+ operations.each do |item_id, data|
77
+ puts "Updating #{item_id}"
78
+ encoded_data = MultiJson.encode(data)
79
+ begin
80
+ Podio::ItemField.update(item_id, 16359339, {:value => encoded_data}, {:silent => true})
81
+ rescue Podio::GoneError
82
+ puts " PodioGoneError for this item id"
83
+ end
84
+ end
85
+ else
86
+ puts operations
87
+ end