rallio 0.3.0 → 0.4.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: 5c4ea3d06f8622e3412ca3a95e0f1a68cb02ae40
4
- data.tar.gz: 972a7189aa36fa4840d3cf84b00d085509bba86c
3
+ metadata.gz: cbd8d25f45db24489018a9930769f7bfb7cd34b9
4
+ data.tar.gz: 7a06482f4e4904a30edb1f9602b673bdaedfda78
5
5
  SHA512:
6
- metadata.gz: 62b63506746d5e6f923cd628afe9c1697cf25fbf3cfb9734d1a9392297010c38edd28ec5d9265f9d4f13f84c3fedf70e9913cd209309d528969d58a43fbc664c
7
- data.tar.gz: d8226ce802c1209a0e0c78edf08ef2f7e96f3ce3e7d797e5c949e6971979630c49c5b6c905edddd4046f90d91d1d3e3e84dc80a6e746e4cd68944517157678d5
6
+ metadata.gz: b848fc0027e529507d8c0f4b571c9ca7ca02a7970767b19aca69f39ab9cb3c3119d3cb7129b519849e57aa797682d2689338dc529a045f1d7ab7a05d9e8630ea
7
+ data.tar.gz: f8d2bc9c3ffc0679d186b8f7319c5b1426631877dfa8c24fa818decde9bb4463ec3da660f2ee64626c2000d2e15c1f1b7fcefe874b8507304b56289ddb53a912
data/README.md CHANGED
@@ -248,14 +248,6 @@ franchisor.accounts
248
248
 
249
249
  ### Account
250
250
 
251
- These gives access to account info that a user has access to. In order to query
252
- the API using this class you will first need a user access token.
253
-
254
- ```ruby
255
- user.access_token
256
- # => <Rallio::AccessToken @access_token="4a25dd89e50bd0a0db1eeae65864fe6b", @user_id=100, @expires_at=nil, @scopes="user_info basic_access">
257
- ```
258
-
259
251
  #### .for
260
252
 
261
253
  Get all accounts for a given franchisor_id.
@@ -265,6 +257,26 @@ accounts = Rallio::Account.for(franchisor_id: 200)
265
257
  # => [<Rallio::Account:0x007f801bb0a610 @id=100, @name="Awesome Haircuts New York City", @short_name="AH-NYC", @url="https://awesomehaircuts.fake", @city="New York", @country_code="US", @time_zone="Eastern Time (US & Canada)">]
266
258
  ```
267
259
 
260
+ #### .created
261
+
262
+ Creates account for given franchisor_id.
263
+
264
+ ```ruby
265
+ payload = {
266
+ account: {
267
+ name: 'Awesome Test Account',
268
+ short_name: 'ATA-1',
269
+ url: 'https://ata.example',
270
+ city: 'Narnia',
271
+ country_code: 'US',
272
+ time_zone: 'Central Time (US & Canada)'
273
+ }
274
+ }
275
+
276
+ Rallio::Account.create(franchisor_id: 200, payload: payload)
277
+ # => { account: { name: 'Awesome Test Account', short_name: 'ATA-1', url: 'https://ata.example', city: 'Narnia', country_code: 'US', time_zone: 'Central Time (US & Canada)' } }
278
+ ```
279
+
268
280
  #### #reviews
269
281
 
270
282
  This is a convenience method to get reviews for a given account. All that is
@@ -272,6 +284,9 @@ needed is a `Rallio::Account` object instantiated with a valid account id. This
272
284
  calls the `Rallio::Review.all` method to get reviews.
273
285
 
274
286
  ```ruby
287
+ user.access_token
288
+ # => <Rallio::AccessToken @access_token="4a25dd89e50bd0a0db1eeae65864fe6b", @user_id=100, @expires_at=nil, @scopes="user_info basic_access">
289
+
275
290
  account = Rallio::Account.new(id: 9397)
276
291
  # => <Rallio::Account:0x007ff4d8160f60 @id=9397, @name=nil>
277
292
 
@@ -17,6 +17,10 @@ module Rallio
17
17
  response.parsed_response['accounts'].map { |a| new a }
18
18
  end
19
19
 
20
+ def self.create(franchisor_id:, payload:)
21
+ self.post("/franchisors/#{franchisor_id}/accounts", headers: app_credentials, body: payload).parsed_response
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def type
@@ -1,3 +1,3 @@
1
1
  module Rallio
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JD Guzman