moves 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +36 -39
- data/lib/moves/version.rb +1 -1
- data/lib/moves.rb +9 -1
- data/test/moves_test.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17100a3816eb3c1e35188f3f2bc511497e270a27
|
4
|
+
data.tar.gz: b1b55ee4224a1b279a0e6268a821d8a0b1ea0e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a88c9c837c2fc50e4b192b2e26f69f82e28b967cafc448cccb5dea9f2d97828f36505a03b3e1c766d8992c9b7103d5c1b844899ab1412bbbecacfa06c5a0900a
|
7
|
+
data.tar.gz: aaa87d8c9909b168b0305a02586bac5dc1929b22fb319354df88be547169e6c63a4aa8c319daf56f8bbad61206ea2340d768418bfb4532545e89327c670e7b73
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -2,88 +2,85 @@
|
|
2
2
|
|
3
3
|
Ruby client for [Moves](https://dev.moves-app.com/docs/overview)
|
4
4
|
|
5
|
-
##
|
5
|
+
## Get Started
|
6
|
+
|
7
|
+
Add this line to your application’s Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "moves"
|
11
|
+
```
|
6
12
|
|
7
13
|
Create a client. To obtain an access token, we recommend the [omniauth-moves](https://github.com/nickelser/omniauth-moves) gem.
|
8
14
|
|
9
15
|
```ruby
|
10
|
-
|
16
|
+
moves = Moves::Client.new(access_token)
|
11
17
|
```
|
12
18
|
|
13
19
|
Get profile
|
14
20
|
|
15
21
|
```ruby
|
16
|
-
|
22
|
+
moves.profile
|
17
23
|
```
|
18
24
|
|
19
25
|
Get daily summary
|
20
26
|
|
21
27
|
```ruby
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
moves.daily_summary # current day
|
29
|
+
moves.daily_summary("2013-06-20") # any day
|
30
|
+
moves.daily_summary("2013-W25") # week
|
31
|
+
moves.daily_summary("2013-06") # month
|
32
|
+
moves.daily_summary(:from => "2013-06-20", :to => "2013-06-23") # max 31 days
|
33
|
+
moves.daily_summary(:pastDays => 31) # max 31 days
|
34
|
+
moves.daily_summary(:updatedSince => 3.days.ago)
|
27
35
|
|
28
36
|
# also supports Time, Date, and DateTime objects
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
37
|
+
moves.daily_summary(Time.now)
|
38
|
+
moves.daily_summary(Date.today)
|
39
|
+
moves.daily_summary(DateTime.now)
|
40
|
+
moves.daily_summary((Date.today - 1)..Date.today)
|
33
41
|
```
|
34
42
|
|
43
|
+
**Note:** Methods below support the same parameters as above
|
44
|
+
|
35
45
|
Get daily activities
|
36
46
|
|
37
47
|
```ruby
|
38
|
-
|
39
|
-
client.daily_activities("2013-06-20") # any day
|
40
|
-
client.daily_activities("2013-W25") # week
|
41
|
-
client.daily_activities(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
48
|
+
moves.daily_activities
|
42
49
|
```
|
43
50
|
|
44
51
|
Get daily places
|
45
52
|
|
46
53
|
```ruby
|
47
|
-
|
48
|
-
client.daily_places("2013-06-20") # any day
|
49
|
-
client.daily_places("2013-W25") # week
|
50
|
-
client.daily_places(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
54
|
+
moves.daily_places
|
51
55
|
```
|
52
56
|
|
53
57
|
Get daily storyline
|
54
58
|
|
55
59
|
```ruby
|
56
|
-
|
57
|
-
client.daily_storyline("2013-06-20") # any day
|
58
|
-
client.daily_storyline("2013-W25") # week
|
59
|
-
client.daily_storyline(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
60
|
+
moves.daily_storyline
|
60
61
|
```
|
61
62
|
|
62
63
|
Get daily storyline with track points
|
63
64
|
|
64
65
|
```ruby
|
65
|
-
|
66
|
-
client.daily_storyline("2013-06-20", :trackPoints => true) # any day
|
66
|
+
moves.daily_storyline(:trackPoints => true)
|
67
67
|
```
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
Add this line to your application's Gemfile:
|
69
|
+
Get activity list
|
72
70
|
|
73
71
|
```ruby
|
74
|
-
|
72
|
+
moves.activity_list
|
75
73
|
```
|
76
74
|
|
77
|
-
|
75
|
+
## History
|
78
76
|
|
79
|
-
|
80
|
-
bundle
|
81
|
-
```
|
77
|
+
View the [changelog](https://github.com/ankane/moves/blob/master/CHANGELOG.md)
|
82
78
|
|
83
79
|
## Contributing
|
84
80
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
81
|
+
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
82
|
+
|
83
|
+
- [Report bugs](https://github.com/ankane/moves/issues)
|
84
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/moves/pulls)
|
85
|
+
- Write, clarify, or fix documentation
|
86
|
+
- Suggest or add new features
|
data/lib/moves/version.rb
CHANGED
data/lib/moves.rb
CHANGED
@@ -6,7 +6,7 @@ module Moves
|
|
6
6
|
class Client
|
7
7
|
attr_reader :access_token
|
8
8
|
|
9
|
-
ENDPOINT = "https://api.moves-app.com/api/
|
9
|
+
ENDPOINT = "https://api.moves-app.com/api/1.1/"
|
10
10
|
|
11
11
|
def initialize(access_token)
|
12
12
|
@access_token = access_token
|
@@ -32,6 +32,10 @@ module Moves
|
|
32
32
|
get_range "user/storyline/daily", *args
|
33
33
|
end
|
34
34
|
|
35
|
+
def activity_list
|
36
|
+
get "activities"
|
37
|
+
end
|
38
|
+
|
35
39
|
protected
|
36
40
|
|
37
41
|
def get(path, params = {})
|
@@ -69,6 +73,10 @@ module Moves
|
|
69
73
|
params[:from] = params[:from].strftime(format)
|
70
74
|
end
|
71
75
|
|
76
|
+
if params[:updatedSince].respond_to?(:utc)
|
77
|
+
params[:updatedSince] = params[:updatedSince].utc.strftime("%Y%m%dT%H%M%SZ")
|
78
|
+
end
|
79
|
+
|
72
80
|
get "#{path}#{extra_path}", params
|
73
81
|
end
|
74
82
|
end
|
data/test/moves_test.rb
CHANGED
@@ -62,6 +62,14 @@ class TestMoves < Minitest::Test
|
|
62
62
|
assert_works @client.daily_summary(@time_range)
|
63
63
|
end
|
64
64
|
|
65
|
+
def test_daily_summary_past_days
|
66
|
+
assert_works @client.daily_summary(:pastDays => 31)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_daily_summary_updated_since
|
70
|
+
assert @client.daily_summary(:updatedSince => Time.now - 86400)
|
71
|
+
end
|
72
|
+
|
65
73
|
def test_daily_activites
|
66
74
|
assert_works @client.daily_activities
|
67
75
|
end
|
@@ -118,6 +126,10 @@ class TestMoves < Minitest::Test
|
|
118
126
|
assert_works @client.daily_storyline(@day, :trackPoints => true)
|
119
127
|
end
|
120
128
|
|
129
|
+
def test_activity_list
|
130
|
+
assert_works @client.activity_list
|
131
|
+
end
|
132
|
+
|
121
133
|
protected
|
122
134
|
|
123
135
|
# TODO better tests
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -74,6 +74,7 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
+
- CHANGELOG.md
|
77
78
|
- Gemfile
|
78
79
|
- LICENSE.txt
|
79
80
|
- README.md
|