Class: Rallio::Franchisor

Inherits:
Base
  • Object
show all
Defined in:
lib/rallio/franchisor.rb

Overview

Represents an franchisor object as it comes from Rallio.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

app_credentials

Instance Attribute Details

#idInteger


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rallio/franchisor.rb', line 8

class Franchisor < Base
  attribute :id, Integer
  attribute :name, String

  # Retreives all franchisors for a given application.
  #
  # @return [Array<Rallio::Franchisor>]
  def self.all
    response = self.get('/franchisors', headers: app_credentials)
    response.parsed_response['franchisors'].map { |f| new(f) }
  end

  # Retreives all accounts for the Rallio::Franchisor
  # @see Rallio::Account
  #
  # @return [Array<Rallio::Account>]
  def accounts
    Rallio::.for(franchisor_id: id)
  end

  # Retreives reviews for the franchisor.
  #
  # @param access_token [String] user access token for API access to account
  # @return [Array<Rallio::Review>]
  def reviews(access_token:)
    Review.all(type: type, id: id, access_token: access_token)
  end

  private

  def type
    :franchisors
  end
end

#nameString


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rallio/franchisor.rb', line 8

class Franchisor < Base
  attribute :id, Integer
  attribute :name, String

  # Retreives all franchisors for a given application.
  #
  # @return [Array<Rallio::Franchisor>]
  def self.all
    response = self.get('/franchisors', headers: app_credentials)
    response.parsed_response['franchisors'].map { |f| new(f) }
  end

  # Retreives all accounts for the Rallio::Franchisor
  # @see Rallio::Account
  #
  # @return [Array<Rallio::Account>]
  def accounts
    Rallio::.for(franchisor_id: id)
  end

  # Retreives reviews for the franchisor.
  #
  # @param access_token [String] user access token for API access to account
  # @return [Array<Rallio::Review>]
  def reviews(access_token:)
    Review.all(type: type, id: id, access_token: access_token)
  end

  private

  def type
    :franchisors
  end
end

Class Method Details

.allArray<Rallio::Franchisor>

Retreives all franchisors for a given application.


15
16
17
18
# File 'lib/rallio/franchisor.rb', line 15

def self.all
  response = self.get('/franchisors', headers: app_credentials)
  response.parsed_response['franchisors'].map { |f| new(f) }
end

Instance Method Details

#accountsArray<Rallio::Account>

Retreives all accounts for the Rallio::Franchisor

See Also:


24
25
26
# File 'lib/rallio/franchisor.rb', line 24

def accounts
  Rallio::.for(franchisor_id: id)
end

#reviews(access_token:) ⇒ Array<Rallio::Review>

Retreives reviews for the franchisor.


32
33
34
# File 'lib/rallio/franchisor.rb', line 32

def reviews(access_token:)
  Review.all(type: type, id: id, access_token: access_token)
end