rallio 0.4.5 → 0.5.0
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 +5 -8
- data/lib/rallio/review.rb +15 -5
- data/lib/rallio/user.rb +17 -10
- data/lib/rallio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade13b37179b9aae4933fb452929369d2d3ef1b0
|
4
|
+
data.tar.gz: d5465b01ab5f24df3070bf1c3b29fc3fafe66a7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85e9e0598dc5497503604455d420479c5a6ea90088672054d2ffc75a4d22515c0594fe5e1db8dde75ff54b483fa8da672a4bcd10fdf1c48a7ce6b6696cf71280
|
7
|
+
data.tar.gz: 97ff5215c8fcdad9de133810d4a359d9987eeb848d5ff5f841ace63fd29555e50462b97ecff899a81d28f5d0313e821f729f880d6a23f4bec395816fe1745385
|
data/README.md
CHANGED
@@ -111,10 +111,7 @@ user.franchisor_ownerships
|
|
111
111
|
# => [#<Rallio::FranchisorOwnership:0x007f93d8986340 @user_id=100, @franchisor_id=300, @franchisor_name="Awesome Haircuts Franchisor 1">]
|
112
112
|
```
|
113
113
|
|
114
|
-
#### #
|
115
|
-
|
116
|
-
**NOTE:** This endpoint is in the docs but it appears it may not be implemented.
|
117
|
-
This will remain here until that is cleared up.
|
114
|
+
#### #dashboard
|
118
115
|
|
119
116
|
This calls out and gets the user info for a given id. All that is needed is to
|
120
117
|
instantiate an instance with a valid user id an calling me will pull the rest
|
@@ -124,7 +121,7 @@ of the information.
|
|
124
121
|
user = Rallio::User.new(id: 100)
|
125
122
|
# => <Rallio::User @id=100, @email=nil, @first_name=nil, @last_name=nil, @accounts=[], @franchisors=[]>
|
126
123
|
|
127
|
-
user.
|
124
|
+
user.dashboard
|
128
125
|
# => <Rallio::User @id=100, @email="bob@yourcompany.com", @first_name="Bob", @last_name="Anderson", @accounts=[], @franchisors=[]>
|
129
126
|
```
|
130
127
|
|
@@ -301,10 +298,10 @@ account.reviews(access_token: user.access_token)
|
|
301
298
|
This calls out to get all reviews for a given account or franchisor.
|
302
299
|
|
303
300
|
```ruby
|
304
|
-
#
|
305
|
-
#
|
301
|
+
# query_params: possible keys are: :page, :account_id, :franchisor_id, :network
|
302
|
+
# :start_date, :end_date, :rating
|
306
303
|
# access_token: is the access token for a Rallio::User
|
307
|
-
reviews = Rallio::Review.all(
|
304
|
+
reviews = Rallio::Review.all(query_params: {}, access_token: user.access_token)
|
308
305
|
# => [<Rallio::Review:0x007fcf402de8f0 @access_token="4a25dd89e50bd0a0db1eeae65864fe6b", @id=227704, @account_id=9397, @account_name="Rally-O Tires New York", @network="facebook", @posted_at=#<DateTime: 2017-02-21T23:12:33+00:00 ((2457806j,83553s,0n),+0s,2299161j)>, @user_name="Andy Bobson", @user_image="https://graph.facebook.com/100009872044695/picture", @rating=5.0, @message="This is my favourite place to buy tires!", @comments=[{:user_name=>"Rally-O Tires New York", :user_image=>"https://graph.facebook.com/113397275345614/picture", :message=>"Thanks for the 5 star review!", :created_at=>"2017-02-22T00:49:53.000+00:00"}], @liked=true, @url="https://www.facebook.com/123123123", @can_reply=true, @location_name="Visiting Angels Newburyport MA", @location_image_url="https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/16266055_1428821143803214_8378119243787669723_n.jpg?oh=3268e6e30474a0aa488cfd896a6d6c06&oe=59357742", @review_reply=nil, @review_reply_at=nil>]
|
309
306
|
```
|
310
307
|
|
data/lib/rallio/review.rb
CHANGED
@@ -54,15 +54,25 @@ module Rallio
|
|
54
54
|
attribute :review_reply, String
|
55
55
|
attribute :review_reply_at, DateTime
|
56
56
|
|
57
|
-
# Retreives reviews.
|
57
|
+
# Retreives reviews. All query_params are optional. If no query_params are
|
58
|
+
# passed in all reviews accessible to user are returned.
|
58
59
|
#
|
59
|
-
# @param
|
60
|
-
# @
|
60
|
+
# @param query_params [Hash] params to filter results
|
61
|
+
# @option query_params [String] :page results page
|
62
|
+
# @option query_params [String] :account_id filter results to one or more
|
63
|
+
# accounts, should be seperated by commas
|
64
|
+
# @option query_params [String] :franchisor_id filter results to a single
|
65
|
+
# franchisor
|
66
|
+
# @option query_params [String] :network filter results to one network,
|
67
|
+
# possible choices are facebook, google_places, yelp
|
68
|
+
# @option query_params [String] :start_date iso8601 date to start on
|
69
|
+
# @option query_params [String] :end_date iso8601 date to end on
|
70
|
+
# @option query_params [String] :rating filter by rating
|
61
71
|
# @param access_token [String] user access token to use for authorization
|
62
72
|
# @return [Array<Rallio::Review>]
|
63
|
-
def self.all(
|
73
|
+
def self.all(query_params: {}, access_token:)
|
64
74
|
headers = { 'Authorization' => "Bearer #{access_token}" }
|
65
|
-
response = self.get("
|
75
|
+
response = self.get("/reviews", query: query_params, headers: headers)
|
66
76
|
response.parsed_response['reviews'].map { |r| new(r) }
|
67
77
|
end
|
68
78
|
|
data/lib/rallio/user.rb
CHANGED
@@ -14,9 +14,8 @@ module Rallio
|
|
14
14
|
attribute :email, String
|
15
15
|
attribute :first_name, String
|
16
16
|
attribute :last_name, String
|
17
|
-
|
18
|
-
|
19
|
-
#attribute :franchisors, Array[Franchisor]
|
17
|
+
attribute :accounts, Array[Account]
|
18
|
+
attribute :franchisors, Array[Franchisor]
|
20
19
|
|
21
20
|
attr_writer :access_token
|
22
21
|
|
@@ -75,13 +74,21 @@ module Rallio
|
|
75
74
|
FranchisorOwnership.for(access_token: access_token.access_token)
|
76
75
|
end
|
77
76
|
|
78
|
-
#
|
79
|
-
# implemented. This is here until that gets cleared up.
|
77
|
+
# Retreives current data for user.
|
80
78
|
#
|
81
|
-
#
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
# @return [Rallio::User]
|
80
|
+
def dashboard
|
81
|
+
response = self.class.get('/dashboard', headers: user_credentials)
|
82
|
+
self.attributes = response.parsed_response
|
83
|
+
self
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def user_credentials
|
89
|
+
{
|
90
|
+
'Authorization' => "Bearer #{access_token.access_token}"
|
91
|
+
}
|
92
|
+
end
|
86
93
|
end
|
87
94
|
end
|
data/lib/rallio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rallio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JD Guzman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|