moves 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/README.md +21 -5
- data/Rakefile +8 -0
- data/lib/moves/version.rb +1 -1
- data/lib/moves.rb +23 -12
- data/moves.gemspec +1 -0
- data/test/moves_test.rb +103 -0
- data/test/test_helper.rb +4 -0
- metadata +21 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 586d9629aea04bbbd947c97877999a2e689adcfb
|
|
4
|
+
data.tar.gz: dee6b28c75496903e0613b660e9950a4d1fb389e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59eab146e896dfb9bde357b641df02b201083a083fdf0126bda42baafc701964142ab2e0de7d47e4a05a4d72ff16de78863c962234d07b89804fe93b2d3c6c3a
|
|
7
|
+
data.tar.gz: b30869d993ff7423bd1ddfb5a4a23a72f17f6e7b2e467eaf22a5cc8f8ba79b9b93ff1e34eb4310cdba70382c1cafb3d371bbcc7964616b2ef5cb67fab95e2187
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Moves
|
|
2
2
|
|
|
3
|
-
Ruby client for [Moves](
|
|
3
|
+
Ruby client for [Moves](https://dev.moves-app.com/docs/overview)
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -19,31 +19,47 @@ client.profile
|
|
|
19
19
|
Get daily summary
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
|
-
client.daily_summary
|
|
22
|
+
client.daily_summary # current day
|
|
23
|
+
client.daily_summary("2013-06-20") # any day
|
|
24
|
+
client.daily_summary("2013-W25") # week
|
|
25
|
+
client.daily_summary("2013-06") # month
|
|
23
26
|
client.daily_summary(:from => "2013-06-20", :to => "2013-06-23") # max 31 days
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
Get daily activities
|
|
27
30
|
|
|
28
31
|
```ruby
|
|
29
|
-
client.daily_activities
|
|
32
|
+
client.daily_activities # current day
|
|
33
|
+
client.daily_activities("2013-06-20") # any day
|
|
34
|
+
client.daily_activities("2013-W25") # week
|
|
30
35
|
client.daily_activities(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
|
31
36
|
```
|
|
32
37
|
|
|
33
38
|
Get daily places
|
|
34
39
|
|
|
35
40
|
```ruby
|
|
36
|
-
client.daily_places
|
|
41
|
+
client.daily_places # current day
|
|
42
|
+
client.daily_places("2013-06-20") # any day
|
|
43
|
+
client.daily_places("2013-W25") # week
|
|
37
44
|
client.daily_places(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
|
38
45
|
```
|
|
39
46
|
|
|
40
47
|
Get daily storyline
|
|
41
48
|
|
|
42
49
|
```ruby
|
|
43
|
-
client.daily_storyline
|
|
50
|
+
client.daily_storyline # current day
|
|
51
|
+
client.daily_storyline("2013-06-20") # any day
|
|
52
|
+
client.daily_storyline("2013-W25") # week
|
|
44
53
|
client.daily_storyline(:from => "2013-06-20", :to => "2013-06-23") # max 7 days
|
|
45
54
|
```
|
|
46
55
|
|
|
56
|
+
Get daily storyline with track points
|
|
57
|
+
|
|
58
|
+
```ruby
|
|
59
|
+
client.daily_storyline(:trackPoints => true) # current day
|
|
60
|
+
client.daily_storyline("2013-06-20", :trackPoints => true) # any day
|
|
61
|
+
```
|
|
62
|
+
|
|
47
63
|
## Installation
|
|
48
64
|
|
|
49
65
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
data/lib/moves/version.rb
CHANGED
data/lib/moves.rb
CHANGED
|
@@ -16,20 +16,20 @@ module Moves
|
|
|
16
16
|
get "user/profile"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def daily_summary(
|
|
20
|
-
get_range "user/summary/daily",
|
|
19
|
+
def daily_summary(*args)
|
|
20
|
+
get_range "user/summary/daily", *args
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def daily_activities(
|
|
24
|
-
get_range "user/activities/daily",
|
|
23
|
+
def daily_activities(*args)
|
|
24
|
+
get_range "user/activities/daily", *args
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def daily_places(
|
|
28
|
-
get_range "user/places/daily",
|
|
27
|
+
def daily_places(*args)
|
|
28
|
+
get_range "user/places/daily", *args
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def daily_storyline(
|
|
32
|
-
get_range "user/storyline/daily",
|
|
31
|
+
def daily_storyline(*args)
|
|
32
|
+
get_range "user/storyline/daily", *args
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
protected
|
|
@@ -39,10 +39,21 @@ module Moves
|
|
|
39
39
|
JSON.parse(response.body)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def get_range(path,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
def get_range(path, *args)
|
|
43
|
+
extra_path, params =
|
|
44
|
+
if args[0].is_a?(String)
|
|
45
|
+
["/#{args[0]}", args[1]]
|
|
46
|
+
else
|
|
47
|
+
["", args[0]]
|
|
48
|
+
end
|
|
49
|
+
params ||= {}
|
|
50
|
+
|
|
51
|
+
# default to current day
|
|
52
|
+
if extra_path.empty? and !(params[:to] or params[:from])
|
|
53
|
+
extra_path = "/#{Time.now.strftime("%Y%m%d")}"
|
|
54
|
+
end
|
|
46
55
|
|
|
56
|
+
get "#{path}#{extra_path}", params
|
|
57
|
+
end
|
|
47
58
|
end
|
|
48
59
|
end
|
data/moves.gemspec
CHANGED
data/test/moves_test.rb
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class TestMoves < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
@client = Moves::Client.new(ENV["ACCESS_TOKEN"])
|
|
7
|
+
@today = Time.now.strftime("%Y-%m-%d")
|
|
8
|
+
@day = "2013-06-20"
|
|
9
|
+
@week = "2013-W25"
|
|
10
|
+
@month = "2013-06"
|
|
11
|
+
@from_to = {:from => "2013-06-20", :to => "2013-06-23"}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_profile
|
|
15
|
+
profile = @client.profile
|
|
16
|
+
assert_kind_of Hash, profile
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_daily_summary
|
|
20
|
+
assert_works @client.daily_summary
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_daily_summary_day
|
|
24
|
+
assert_works @client.daily_summary(@day)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_daily_summary_week
|
|
28
|
+
assert_works @client.daily_summary(@week)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_daily_summary_month
|
|
32
|
+
assert_works @client.daily_summary(@month)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_daily_summary_from_to
|
|
36
|
+
assert_works @client.daily_summary(@from_to)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_daily_activites
|
|
40
|
+
assert_works @client.daily_activities
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_daily_activites_day
|
|
44
|
+
assert_works @client.daily_activities(@day)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_daily_activites_week
|
|
48
|
+
assert_works @client.daily_activities(@week)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_daily_activities_from_to
|
|
52
|
+
assert_works @client.daily_activities(@from_to)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_daily_places
|
|
56
|
+
assert_works @client.daily_places
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_daily_places_day
|
|
60
|
+
assert_works @client.daily_places(@day)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_daily_places_week
|
|
64
|
+
assert_works @client.daily_places(@week)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_daily_places_from_to
|
|
68
|
+
assert_works @client.daily_places(@from_to)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_daily_storyline
|
|
72
|
+
assert_works @client.daily_storyline
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def test_daily_storyline_day
|
|
76
|
+
assert_works @client.daily_storyline(@day)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_daily_storyline_week
|
|
80
|
+
assert_works @client.daily_storyline(@week)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def test_daily_storyline_from_to
|
|
84
|
+
assert_works @client.daily_storyline(@from_to)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_daily_storyline_track_points
|
|
88
|
+
assert_works @client.daily_storyline(:trackPoints => true)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_daily_storyline_track_points_day
|
|
92
|
+
assert_works @client.daily_storyline(@day, :trackPoints => true)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
protected
|
|
96
|
+
|
|
97
|
+
# TODO better tests
|
|
98
|
+
|
|
99
|
+
def assert_works(actual)
|
|
100
|
+
assert_operator actual.size, :>=, 1
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
data/test/test_helper.rb
ADDED
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.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-06-
|
|
11
|
+
date: 2013-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - '>='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: minitest
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
description: Ruby client for Moves
|
|
56
70
|
email:
|
|
57
71
|
- acekane1@gmail.com
|
|
@@ -67,6 +81,8 @@ files:
|
|
|
67
81
|
- lib/moves.rb
|
|
68
82
|
- lib/moves/version.rb
|
|
69
83
|
- moves.gemspec
|
|
84
|
+
- test/moves_test.rb
|
|
85
|
+
- test/test_helper.rb
|
|
70
86
|
homepage: https://github.com/ankane/moves
|
|
71
87
|
licenses:
|
|
72
88
|
- MIT
|
|
@@ -91,4 +107,6 @@ rubygems_version: 2.0.0
|
|
|
91
107
|
signing_key:
|
|
92
108
|
specification_version: 4
|
|
93
109
|
summary: Ruby client for Moves
|
|
94
|
-
test_files:
|
|
110
|
+
test_files:
|
|
111
|
+
- test/moves_test.rb
|
|
112
|
+
- test/test_helper.rb
|