Class: FreshService::Client

Inherits:
Object
  • Object
show all
Includes:
V2::Group::Create, V2::Group::View, V2::ServiceRequest::Create, V2::ServiceRequest::Update, V2::Ticket::Create, V2::Ticket::Update, V2::Ticket::View, Configurable, Connection, Default
Defined in:
lib/fresh_service/client.rb,
lib/fresh_service/client/v2/group/view.rb,
lib/fresh_service/client/v2/ticket/view.rb,
lib/fresh_service/client/v2/group/create.rb,
lib/fresh_service/client/v2/ticket/create.rb,
lib/fresh_service/client/v2/ticket/update.rb,
lib/fresh_service/client/v2/service_request/create.rb,
lib/fresh_service/client/v2/service_request/update.rb

Overview

Client for the FreshService API

Defined Under Namespace

Modules: V2

Constant Summary

Constants included from Connection

FreshService::Connection::RETRY_HTTP_CODES

Instance Attribute Summary

Attributes included from Configurable

#api_endpoint, #api_key, #content_type, #env, #organisation, #user_agent

Instance Method Summary collapse

Methods included from V2::ServiceRequest::Update

#update_service_request

Methods included from V2::ServiceRequest::Create

#create_service_request

Methods included from V2::Group::View

#view_group

Methods included from V2::Group::Create

#create_group

Methods included from V2::Ticket::View

#view_ticket

Methods included from V2::Ticket::Update

#update_ticket

Methods included from V2::Ticket::Create

#create_ticket

Methods included from Configurable

#configure, keys, #reset!, #same_options?

Methods included from Connection

#get, #post, #put

Methods included from Default

api_endpoint, api_key, api_version_url, content_type, env, options, organisation, user_agent

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



31
32
33
34
35
36
37
38
# File 'lib/fresh_service/client.rb', line 31

def initialize(options = {})
  # Use options passed in, but fall back to module defaults
  FreshService::Configurable.keys.each do |key|
    value = options.key?(key) ? options[key] : FreshService.instance_variable_get(:"@#{key}")
    value = value.presence || FreshService::Default.send(:"#{key}")
    instance_variable_set(:"@#{key}", value)
  end
end