Everything returns a promise!
Fitty.app_token = "3842289839a948d9e99f939382"
On how to obtain an app_token, please consult the docs.
Fitty.Api.debug - true
This tells fitty.js to log every request it makes to the console, in ready to use curl commands you can paste to your terminal to try out stuff in more detail.
Fitty.signUp(
username: 'foo'
email: 'foo@bar.de'
password: 'geh heim'
password_confirmation: 'geh heim'
)
Fitty.signIn('user', 'password')
You can provide the username or email address.
user = Fitty.User.current()
# Store your stuff
persist_this_somewhere = Fitty.currentUser().data
# Then, at a later time
Fitty.restoreSession(persist_this_somewhere)
user.profileVisibility()
user.profileVisibility(value: 'visible')
user.muscleGroups()
user.muscleGroups(value: {'Pull ups': 1})
user.profile()
user.profile(
username_literal: 'My Fancy Name'
password: 'new password optional'
password_confirmation: 'new_password_optional'
).then(-> alert('oh hi'))
workouts - user.workouts()
Returns a promise that will give you an array of hashes)
user.saveWorkout(data)
If data contains an id field, it will be PUT to update, otherwise it will be created via POST
user.deleteWorkout(data)
run gulp
and that's it.
I don't know how you people do stuff in the javascript world, so I just incuded Q in this library and the tests are just a file I open in the browser to see if everything still works OK. it runs against a locally running API, so the tests are likely useless to you.
Then again, I would be surprised if anybody read until here, so I might as well just give you a gif because you made it here.