class Rallio::Account

Represents an account object as it comes from Rallio.

@!attribute [rw] id

@return [Integer] unique id for account

@!attribute [rw] name

@return [String] account name

@!attribute [rw] short_name

@return [String] account short name

@!attribute [rw] url

@return [String] account url

@!attribute [rw] city

@return [String] account city

@!attribute [rw] country_code

@return [String] account country code

@!attribute [rw] time_zone

@return [String] account time zone

@!attribute [rw] franchisor_id

@return [String] franchisor_id account belongs to

@!attribute [rw] franchisor_name

@return [String] franchisor_name account belongs to

@!attribute [rw] facebook_connected

@return [Boolean] facebook has been associated

@!attribute [rw] facebook_needs_reconnection

@return [Boolean] facebook has lost its connection

@!attribute [rw] facebook_reputation

@return [Float] average review rating for facebook

@!attribute [rw] yelp_connected

@return [String] yelp has been associated

@!attribute [rw] yelp_needs_reconnection

@return [Boolean] yelp has lost its connection

@!attribute [rw] yelp_reputation

@return [Float] average review rating for yelp

@!attribute [rw] google_connected

@return [String] google has been associated

@!attribute [rw] google_needs_reconnection

@return [Boolean] google has lost its connection

@!attribute [rw] google_reputation

@return [Float] average review rating for google

Public Class Methods

create(franchisor_id:, account:) click to toggle source

Creates an account.

@param franchisor_id [Integer] franchisor_id to create account under @param account [Hash] @option account [String] :name @option account [String] :short_name slug or other identifier @option account [String] :url @option account [String] :city @option account [String] :country_code @option account [String] :time_zone @return [Rallio::Account] hash of account created

# File lib/rallio/account.rb, line 80
def self.create(franchisor_id:, account:)
  response = self.post("/franchisors/#{franchisor_id}/accounts", headers: app_credentials, body: { account: account })
  new response.parsed_response['account']
end
for(franchisor_id:) click to toggle source

Retreives accounts.

@param franchisor_id [Integer] franchisor_id to get accounts for @return [Array<Rallio::Account>]

# File lib/rallio/account.rb, line 64
def self.for(franchisor_id:)
  response = self.get("/franchisors/#{franchisor_id}/accounts", headers: app_credentials)
  response.parsed_response['accounts'].map { |a| new a }
end

Public Instance Methods

reviews(access_token:) click to toggle source

Retreives reviews for the account.

@param access_token [String] user access token for API access to account @return [Array<Rallio::Review>]

# File lib/rallio/account.rb, line 89
def reviews(access_token:)
  Review.all(type: type, id: id, access_token: access_token)
end

Private Instance Methods

type() click to toggle source
# File lib/rallio/account.rb, line 95
def type
  :accounts
end