beeminder 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MGNjOWExYTVhMzY0ODc3NzRmYTg0ZmM3ZGRiYWI5MzRlZWY0ZTQwZA==
5
- data.tar.gz: !binary |-
6
- OTBkNmMyMzdmOGM5YTk3ZTJlYjI5ZjIxNmI0MTU2ZWEwYjIxYTFlNA==
2
+ SHA1:
3
+ metadata.gz: fe9446419e3fc9249d45e27dfdb7e93eaa2fd293
4
+ data.tar.gz: 940d2b2b7a75f34c276aef94a89d76b2f2624adc
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NTcxNTBhNzE5Nzg2ZTUyMWI5OWZkNDZkMjY2OTk0Yjg5MmMwN2Q3MGNmZjhj
10
- OTcyODhkOWRjZWZmMGJjNWJhOTg2NjllNjQyYzg2NDMxZWUzZGNhYmFkMjdj
11
- ZmI1NjIxODg2ZjA3NzIwYjJhYTA4NmIxMGExMDk2YzY3ZTQ5Njg=
12
- data.tar.gz: !binary |-
13
- NDI1ZjdlZDhkZTEyMmFiZWU0MTk0NjA1NTY0MjNhMTZmNWE2NGFlOTBhNzVm
14
- MWE1YzhjNDhlODFkZTcyNmE1NjA2MzdhODc3NWE2N2UyZmE5NTJhZDU0ZjE1
15
- YTYyOTZkZWZhOWZkNDJhMzFhNDA1YmZjMjBlYTc1YmQ5NmM2OGU=
6
+ metadata.gz: 375ad660e200645afa73bbf18df8b3717b7eb7dc945d7c9985a20bf695239d68b0819acab666bb0ff3bbac8e305dde35a47d714b292144ef6f0700283f4c3be9
7
+ data.tar.gz: 620545b90de4a56f0fd4cf785763dfc6a6bd2b0baaf18b6ddaa788461b246d725d011001da4e8907b5653a51cba237331a09f169ead72ceeb12dba4e74562668
@@ -0,0 +1,2 @@
1
+ �do�K�湷M����$�V�qD/�
2
+ �\oQ��4deu��νbJ'��+t�7M;"�`*��[5�
Binary file
@@ -19,13 +19,13 @@ module Beeminder
19
19
 
20
20
  # @return [true|false] Enforce user timezone for all passed times? Should be true unless you know what you're doing. (Default: `true`.)
21
21
  attr_accessor :enforce_timezone
22
-
22
+
23
23
  def initialize token, opts={}
24
24
  opts = {
25
25
  :auth_type => :personal,
26
26
  :enforce_timezone => true,
27
27
  }.merge(opts)
28
-
28
+
29
29
  @token = token
30
30
  @auth_type = opts[:auth_type]
31
31
  @enforce_timezone = opts[:enforce_timezone]
@@ -39,7 +39,7 @@ module Beeminder
39
39
  else
40
40
  raise ArgumentError, "Auth type not supported, must be :personal or :oauth."
41
41
  end
42
-
42
+
43
43
  info = get "users/me.json"
44
44
 
45
45
  @name = info["username"]
@@ -47,13 +47,13 @@ module Beeminder
47
47
  @updated_at = DateTime.strptime(info["updated_at"].to_s, '%s').in_time_zone(@timezone)
48
48
  end
49
49
 
50
- # Enforce timezone for all passed times?
50
+ # Enforce timezone for all passed times?
51
51
  #
52
52
  # @return [true|false]
53
53
  def enforce_timezone?
54
54
  !!@enforce_timezone
55
55
  end
56
-
56
+
57
57
  # List of goals.
58
58
  #
59
59
  # @param filter [Symbol] filter goals, can be `:all` (default), `:frontburner` or `:backburner`
@@ -87,7 +87,7 @@ module Beeminder
87
87
  dp = Beeminder::Datapoint.new :value => value, :comment => comment
88
88
  goal.add dp
89
89
  end
90
-
90
+
91
91
  # Create new goal.
92
92
  #
93
93
  # @param opts [Hash] Goal options.
@@ -133,20 +133,20 @@ module Beeminder
133
133
  # @return [Time] Converted time.
134
134
  def convert_to_timezone time
135
135
  Time.use_zone(@timezone){
136
-
136
+
137
137
  time = time.to_time unless time.is_a?(Time)
138
138
  Time.local(time.year, time.month, time.day, time.hour, time.min, time.sec)
139
-
139
+
140
140
  }
141
141
  end
142
142
 
143
143
  private
144
-
144
+
145
145
  # Establish HTTPS connection to API.
146
146
  def _connection type, cmd, data
147
147
  api = "https://www.beeminder.com/api/v1/#{cmd}"
148
148
  data = {@token_type => @token}.merge(data)
149
-
149
+
150
150
  url = URI.parse(api)
151
151
  http = Net::HTTP.new(url.host, url.port)
152
152
  http.read_timeout = 8640
@@ -159,24 +159,24 @@ module Beeminder
159
159
  raise ArgumentError, "invalid timestamp: #{data["timestamp"]}"
160
160
  end
161
161
  end
162
-
162
+
163
163
  json = ""
164
164
  http.start do |http|
165
- req = case type
166
- when :post
167
- Net::HTTP::Post.new(url.path)
168
- req.set_form_data(data)
169
- when :get
170
- Net::HTTP::Get.new(url.path + "?" + data.to_query)
171
- when :delete
172
- Net::HTTP::Delete.new(url.path + "?" + data.to_query)
173
- when :put
174
- Net::HTTP::Put.new(url.path)
175
- req.set_form_data(data)
176
- else
177
- raise "invalid connection type"
178
- end
179
-
165
+ case type
166
+ when :post
167
+ req = Net::HTTP::Post.new(url.path)
168
+ req.set_form_data(data)
169
+ when :get
170
+ req = Net::HTTP::Get.new(url.path + "?" + data.to_query)
171
+ when :delete
172
+ req = Net::HTTP::Delete.new(url.path + "?" + data.to_query)
173
+ when :put
174
+ req = Net::HTTP::Put.new(url.path)
175
+ req.set_form_data(data)
176
+ else
177
+ raise "invalid connection type"
178
+ end
179
+
180
180
  res = http.request(req)
181
181
  if not res.is_a? Net::HTTPSuccess
182
182
  raise "request failed: #{res.code} / #{res.body}"
@@ -1,3 +1,3 @@
1
1
  module Beeminder
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
metadata CHANGED
@@ -1,103 +1,123 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beeminder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - muflax
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-04-20 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDLDCCAhSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQ0wCwYDVQQDDARtYWls
14
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WDqEQF/BnHtlVQ/1w649V+
30
+ -----END CERTIFICATE-----
31
+ date: 2014-04-21 00:00:00.000000000 Z
12
32
  dependencies:
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: activesupport
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
- - - ! '>='
37
+ - - ">="
18
38
  - !ruby/object:Gem::Version
19
39
  version: '3.2'
20
- - - <
40
+ - - "<"
21
41
  - !ruby/object:Gem::Version
22
42
  version: '5'
23
43
  type: :runtime
24
44
  prerelease: false
25
45
  version_requirements: !ruby/object:Gem::Requirement
26
46
  requirements:
27
- - - ! '>='
47
+ - - ">="
28
48
  - !ruby/object:Gem::Version
29
49
  version: '3.2'
30
- - - <
50
+ - - "<"
31
51
  - !ruby/object:Gem::Version
32
52
  version: '5'
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: chronic
35
55
  requirement: !ruby/object:Gem::Requirement
36
56
  requirements:
37
- - - ~>
57
+ - - "~>"
38
58
  - !ruby/object:Gem::Version
39
59
  version: '0.7'
40
60
  type: :runtime
41
61
  prerelease: false
42
62
  version_requirements: !ruby/object:Gem::Requirement
43
63
  requirements:
44
- - - ~>
64
+ - - "~>"
45
65
  - !ruby/object:Gem::Version
46
66
  version: '0.7'
47
67
  - !ruby/object:Gem::Dependency
48
68
  name: json
49
69
  requirement: !ruby/object:Gem::Requirement
50
70
  requirements:
51
- - - ! '>='
71
+ - - ">="
52
72
  - !ruby/object:Gem::Version
53
73
  version: '0'
54
74
  type: :runtime
55
75
  prerelease: false
56
76
  version_requirements: !ruby/object:Gem::Requirement
57
77
  requirements:
58
- - - ! '>='
78
+ - - ">="
59
79
  - !ruby/object:Gem::Version
60
80
  version: '0'
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: highline
63
83
  requirement: !ruby/object:Gem::Requirement
64
84
  requirements:
65
- - - ~>
85
+ - - "~>"
66
86
  - !ruby/object:Gem::Version
67
87
  version: '1.6'
68
88
  type: :runtime
69
89
  prerelease: false
70
90
  version_requirements: !ruby/object:Gem::Requirement
71
91
  requirements:
72
- - - ~>
92
+ - - "~>"
73
93
  - !ruby/object:Gem::Version
74
94
  version: '1.6'
75
95
  - !ruby/object:Gem::Dependency
76
96
  name: trollop
77
97
  requirement: !ruby/object:Gem::Requirement
78
98
  requirements:
79
- - - ~>
99
+ - - "~>"
80
100
  - !ruby/object:Gem::Version
81
101
  version: '2'
82
102
  type: :runtime
83
103
  prerelease: false
84
104
  version_requirements: !ruby/object:Gem::Requirement
85
105
  requirements:
86
- - - ~>
106
+ - - "~>"
87
107
  - !ruby/object:Gem::Version
88
108
  version: '2'
89
109
  - !ruby/object:Gem::Dependency
90
110
  name: tzinfo
91
111
  requirement: !ruby/object:Gem::Requirement
92
112
  requirements:
93
- - - ! '>='
113
+ - - ">="
94
114
  - !ruby/object:Gem::Version
95
115
  version: '0'
96
116
  type: :runtime
97
117
  prerelease: false
98
118
  version_requirements: !ruby/object:Gem::Requirement
99
119
  requirements:
100
- - - ! '>='
120
+ - - ">="
101
121
  - !ruby/object:Gem::Version
102
122
  version: '0'
103
123
  description: Convenient access to Beeminder's API.
@@ -108,7 +128,7 @@ executables:
108
128
  extensions: []
109
129
  extra_rdoc_files: []
110
130
  files:
111
- - .gitignore
131
+ - ".gitignore"
112
132
  - CHANGES.md
113
133
  - Gemfile
114
134
  - LICENSE.txt
@@ -130,12 +150,12 @@ require_paths:
130
150
  - lib
131
151
  required_ruby_version: !ruby/object:Gem::Requirement
132
152
  requirements:
133
- - - ! '>='
153
+ - - ">="
134
154
  - !ruby/object:Gem::Version
135
155
  version: '0'
136
156
  required_rubygems_version: !ruby/object:Gem::Requirement
137
157
  requirements:
138
- - - ! '>='
158
+ - - ">="
139
159
  - !ruby/object:Gem::Version
140
160
  version: '0'
141
161
  requirements: []
@@ -0,0 +1 @@
1
+ ��mj<���Q]0H�+_��� V��<�N]n�+���S��