inbox 0.15.0 → 0.15.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/lib/namespace.rb +5 -8
  4. data/lib/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3652da240e2694c7a33df379517cfbba41c0e261
4
- data.tar.gz: a5f78de8bec34983c4089c307a3c2bb6bdd1df07
3
+ metadata.gz: d21a2eeb1f9758558ebba8cedf43dfa7bc770551
4
+ data.tar.gz: 2cfe21beb20bf9f4ae435d59493bd609490b929b
5
5
  SHA512:
6
- metadata.gz: f67b33d142fa9dd408163e6c5a4143ffffe1af4a0c7b4868acea45dd8c4632af03f92f9344f4445b999c73f18514756c03d075a7036084dbb5cbcd72ab39b4f0
7
- data.tar.gz: 44b42c080c6a92b8f979bec267c0821082b47825f9e223076448ab8c9e6d8e5fd3ba495fb8e36e5da1a20be446a820f156bd9e40fb0935bec9354be0ebd6253f
6
+ metadata.gz: c621c9e95f4a23da84f232c00872a6e4d266d4ac292747418a36eada566c16063be983386b8f92cac98d7a82865bd4cc87d8ad1bc9d4383db72e7a2a4aeef4e5
7
+ data.tar.gz: c5fff4190fe9121ac947f5da7304ad4b6bf7894f386e3f3a0ac92e0c32c6c0c21f163fa119545b4eb9db7056f7a32f457ef145099d5d7dbe9bb1d43723a5e092
data/README.md CHANGED
@@ -296,15 +296,18 @@ save_to_db(last_cursor)
296
296
  ```
297
297
 
298
298
  ### Exclude changes from a specific type --- get only messages
299
+ ````ruby
299
300
  inbox.namespaces.first.deltas(cursor, exclude=[Inbox::Contact,
300
301
  Inbox::Event,
301
302
  Inbox::File,
302
303
  Inbox::Tag,
303
304
  Inbox::Thread]) do |event, object|
304
- if event == 'create' or event == 'modify"
305
+ if event == 'create' or event == 'modify'
305
306
  puts object.subject
306
307
  end
307
308
  end
309
+ ```
310
+
308
311
 
309
312
  ### Handling Errors
310
313
  The Nilas API uses conventional HTTP response codes to indicate success or failure of an API request. The ruby gem raises these as native exceptions.
data/lib/namespace.rb CHANGED
@@ -61,7 +61,7 @@ module Inbox
61
61
 
62
62
  def get_cursor(timestamp)
63
63
  # Get the cursor corresponding to a specific timestamp.
64
- path = @_api.url_for_path("n/#{@namespace_id}/delta/generate_cursor")
64
+ path = @_api.url_for_path("/n/#{@namespace_id}/delta/generate_cursor")
65
65
  data = { :start => timestamp }
66
66
 
67
67
  cursor = nil
@@ -71,7 +71,7 @@ module Inbox
71
71
  cursor = json["cursor"]
72
72
  end
73
73
 
74
- return cursor
74
+ cursor
75
75
  end
76
76
 
77
77
  OBJECTS_TABLE = {
@@ -79,22 +79,19 @@ module Inbox
79
79
  "calendar" => Inbox::Calendar,
80
80
  "draft" => Inbox::Draft,
81
81
  "thread" => Inbox::Thread,
82
- "account" => Inbox::Account,
83
- "calendar" => Inbox::Calendar,
84
82
  "contact" => Inbox::Contact,
85
- "draft" => Inbox::Draft,
86
83
  "event" => Inbox::Event,
87
84
  "file" => Inbox::File,
88
85
  "message" => Inbox::Message,
89
86
  "namespace" => Inbox::Namespace,
90
87
  "tag" => Inbox::Tag,
91
- "thread" => Inbox::Thread
92
88
  }
93
89
 
94
90
  def deltas(cursor, exclude_types=[])
91
+ raise 'Please provide a block for receiving the delta objects' if !block_given?
95
92
  exclude_string = ""
96
93
 
97
- if not exclude_types.empty?
94
+ if exclude_types.any?
98
95
  exclude_string = "&exclude_types="
99
96
 
100
97
  exclude_types.each do |value|
@@ -110,7 +107,7 @@ module Inbox
110
107
 
111
108
  # loop and yield deltas until we've come to the end.
112
109
  loop do
113
- path = @_api.url_for_path("n/#{@namespace_id}/delta?cursor=#{cursor}#{exclude_string}")
110
+ path = @_api.url_for_path("/n/#{@namespace_id}/delta?cursor=#{cursor}#{exclude_string}")
114
111
  json = nil
115
112
 
116
113
  RestClient.get(path) do |response,request,result|
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Inbox
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Gotow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client