rallio 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85be5c78b7bb8274a8437ea72945e880182081ad
4
- data.tar.gz: 45de8bdacafe7c047967cb9fe76b8d6bb5069bc2
3
+ metadata.gz: 67177a5826383f816771b2df2496297098fa24af
4
+ data.tar.gz: d7a9f1a90aaf9393a8a442b65ee1348eada12b4d
5
5
  SHA512:
6
- metadata.gz: 04145be6c2b6e068f4e2b65fffce4d0f785f8035f2053bb3a1ad93906565400f6cf88d79e2d74dea9e651fae387757d4cf81a7c15a6bfbcb730d99044d0fbce0
7
- data.tar.gz: a1ff4013ecd7204952f1c24631546af1e83daa35b125906e36cdbd154c5aef4f4adb6635ce184a891c3d9ef0ff75a9f97575fac3961ff20572e305c8eb65fc72
6
+ metadata.gz: 4792240007fa51ae3acf1f3054d849b85ca4c3a7d7b3f037ae06ba259af9a543436a72565fd76cd9e8707228734f24147531be4872c8a655f4f4ccbe7f43c0ce
7
+ data.tar.gz: ff68eb909daee76395108a2a4e2a5e47e2d66fd8de5aa68cdcbd6191e46953fb257ba177010c7122c2afe19bd73bfc6986a24bb99a2166f6b99d7559f47afabc
data/README.md CHANGED
@@ -80,6 +80,20 @@ user.access_token
80
80
  # => <Rallio::AccessToken @access_token="4a25dd89e50bd0a0db1eeae65864fe6b", @user_id=100, @expires_at=nil, @scopes="user_info basic_access">
81
81
  ```
82
82
 
83
+ #### #me
84
+
85
+ This calls out and gets the user info for a given id. All that is needed is to
86
+ instantiate an instance with a valid user id an calling me will pull the rest
87
+ of the information.
88
+
89
+ ```ruby
90
+ user = Rallio::User.new(id: 100)
91
+ # => <Rallio::User @id=100, @email=nil, @first_name=nil, @last_name=nil, @accounts=[], @franchisors=[]>
92
+
93
+ user.me
94
+ # => <Rallio::User @id=100, @email="bob@yourcompany.com", @first_name="Bob", @last_name="Anderson", @accounts=[], @franchisors=[]>
95
+ ```
96
+
83
97
  ### SignOnToken
84
98
 
85
99
  #### .create
data/lib/rallio/user.rb CHANGED
@@ -14,12 +14,17 @@ module Rallio
14
14
 
15
15
  def sign_on_tokens
16
16
  SignOnToken.create(user_id: id)
17
- # response = self.class.post("/users/#{id}/sign_on_tokens", headers: app_credentials)
18
- # SignOnToken.new response.parsed_response[:sign_on_token]
19
17
  end
20
18
 
21
19
  def access_token
22
20
  @access_token ||= AccessToken.create(user_id: id)
23
21
  end
22
+
23
+ def me
24
+ headers = { 'Authentication' => "Bearer #{access_token.access_token}" }
25
+ response = self.class.get('/users/me', headers: headers)
26
+ self.attributes = response.parsed_response
27
+ self
28
+ end
24
29
  end
25
30
  end
@@ -1,3 +1,3 @@
1
1
  module Rallio
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rallio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JD Guzman