Class: Fabricio::Service::OrganizationService

Inherits:
Object
  • Object
show all
Defined in:
lib/fabricio/services/organization_service.rb

Overview

Service responsible for fetching different Organization information

Instance Method Summary collapse

Constructor Details

#initialize(session, network_client) ⇒ Fabricio::Service::OrganizationService

Initializes a new OrganizationService object.



15
16
17
18
19
20
# File 'lib/fabricio/services/organization_service.rb', line 15

def initialize(session, network_client)
  @session = session

  @request_model_factory = Fabricio::Networking::OrganizationRequestModelFactory.new
  @network_client = network_client
end

Instance Method Details

#getFabricio::Model::Organization

Obtains current organization information



25
26
27
28
29
30
# File 'lib/fabricio/services/organization_service.rb', line 25

def get
  request_model = @request_model_factory.get_organization_request_model
  response = @network_client.perform_request(request_model)
  puts(response)
  Fabricio::Model::Organization.new(JSON.parse(response.body)[0])
end