liftapp-client 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.
- data/README.md +23 -2
- data/examples/csv_export/app.rb +3 -3
- data/lib/liftapp-client/version.rb +1 -1
- data/lib/liftapp-client.rb +2 -5
- data/liftapp-client.gemspec +3 -2
- data/spec/fixtures/3280 +1614 -0
- data/spec/fixtures/current +14 -0
- data/spec/fixtures/dashboard +14 -0
- data/spec/lift_spec.rb +12 -2
- metadata +26 -4
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Liftapp::Client
|
2
2
|
|
3
|
-
|
3
|
+
Ruby library to access the Lift.do API. Since there is not yet an official API, this library uses the undocumented mobile app API.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,28 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
##### Request your profile_hash
|
22
|
+
```ruby
|
23
|
+
client = Liftapp::Client.new(email: 'neo@matrix.com', password: 'whiterabbit')
|
24
|
+
data = client.login()
|
25
|
+
puts data['profile_hash']
|
26
|
+
```
|
27
|
+
|
28
|
+
##### Request your subscribed habits
|
29
|
+
```ruby
|
30
|
+
client = Liftapp::Client.new(email: 'neo@matrix.com', password: 'whiterabbit')
|
31
|
+
data = client.dashboard
|
32
|
+
puts data['subscriptions'].inspect
|
33
|
+
```
|
34
|
+
|
35
|
+
##### Request checkin data for your habit
|
36
|
+
```ruby
|
37
|
+
client = Liftapp::Client.new(profile_hash: 'e7fcd2db926273e895ef')
|
38
|
+
data = client.checkin_data('3280')
|
39
|
+
puts data[:checkins].inspect
|
40
|
+
puts data[:'habit-name']
|
41
|
+
```
|
42
|
+
|
22
43
|
|
23
44
|
## Contributing
|
24
45
|
|
data/examples/csv_export/app.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'coffee-script'
|
3
|
-
|
3
|
+
require 'liftapp-client'
|
4
4
|
|
5
5
|
configure do
|
6
6
|
mime_type :plain, 'text/plain'
|
@@ -11,14 +11,14 @@ get '/' do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
post '/dashboard.json' do
|
14
|
-
client =
|
14
|
+
client = Liftapp::Client.new(email: params[:email], password: params[:password])
|
15
15
|
content_type :json
|
16
16
|
client.dashboard.to_json
|
17
17
|
end
|
18
18
|
|
19
19
|
get '/checkins/:user/:habit' do
|
20
20
|
content_type :plain
|
21
|
-
client =
|
21
|
+
client = Liftapp::Client.new(profile_hash: params[:user])
|
22
22
|
data = client.checkin_data(params[:habit])
|
23
23
|
output = data[:checkins].map { |d| d.strftime('%Y-%m-%d') }
|
24
24
|
output.unshift data[:'habit-name']
|
data/lib/liftapp-client.rb
CHANGED
@@ -18,22 +18,19 @@ module Liftapp
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def login
|
21
|
-
response = HTTParty.get('https://lift.do/i/0/users/current', @auth_options)
|
21
|
+
response = HTTParty.get('https://www.lift.do/i/0/users/current', @auth_options)
|
22
22
|
@profile_hash = response['profile_hash']
|
23
23
|
response
|
24
24
|
end
|
25
25
|
|
26
26
|
def dashboard
|
27
|
-
HTTParty.get('https://lift.do/api/v2/dashboard', @auth_options)
|
27
|
+
HTTParty.get('https://www.lift.do/api/v2/dashboard', @auth_options)
|
28
28
|
end
|
29
29
|
|
30
30
|
def habit_activity(habit_id)
|
31
31
|
HTTParty.get('https://www.lift.do/api/v2/habits/' + habit_id + '/activity', @auth_options)
|
32
32
|
end
|
33
33
|
|
34
|
-
def checkin(habit)
|
35
|
-
end
|
36
|
-
|
37
34
|
def checkin_data(habit_id)
|
38
35
|
response = HTTParty.get('https://www.lift.do/users/' + @profile_hash + '/' + habit_id)
|
39
36
|
|
data/liftapp-client.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Liftapp::Client::VERSION
|
17
17
|
|
18
|
-
gem.
|
19
|
-
gem.
|
18
|
+
gem.add_dependency 'httparty'
|
19
|
+
gem.add_dependency 'nokogiri'
|
20
|
+
gem.add_dependency 'webmock'
|
20
21
|
end
|