Class: Ecoportal::API::Internal::PolicyGroups

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ecoportal/api/internal/policy_groups.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PolicyGroups

Returns an instance object ready to make policy groups api requests.

Parameters:

  • client (Common::Client)

    a Common::Client object that holds the configuration of the api connection.



12
13
14
# File 'lib/ecoportal/api/internal/policy_groups.rb', line 12

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCommon::Client (readonly)

a Common::Client object that holds the configuration of the api connection.

Returns:



5
6
7
# File 'lib/ecoportal/api/internal/policy_groups.rb', line 5

def client
  @client
end

Instance Method Details

#each(&block) ⇒ Object



23
24
25
26
# File 'lib/ecoportal/api/internal/policy_groups.rb', line 23

def each(&block)
  return to_enum(:each) unless block
  get_all.each(&block)
end

#get_allEnumerable<PolicyGroup>

Gets all the policy groups via api request.

Returns:

  • (Enumerable<PolicyGroup>)

    an Enumerable with all the policy groups already wrapped as PolicyGroup objects.



18
19
20
21
# File 'lib/ecoportal/api/internal/policy_groups.rb', line 18

def get_all
  response = client.get("/policy_groups")
  Common::WrappedResponse.new(response, Internal::PolicyGroup)
end