Class: FedenaSdk::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fedena_sdk/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
11
12
# File 'lib/fedena_sdk/client.rb', line 7

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



22
23
24
# File 'lib/fedena_sdk/client.rb', line 22

def method_missing(method, *args)
  oauth2_client.send(method, *args)
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/fedena_sdk/client.rb', line 5

def access_token
  @access_token
end

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/fedena_sdk/client.rb', line 5

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



5
6
7
# File 'lib/fedena_sdk/client.rb', line 5

def client_secret
  @client_secret
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



5
6
7
# File 'lib/fedena_sdk/client.rb', line 5

def redirect_uri
  @redirect_uri
end

#uriObject

Returns the value of attribute uri.



5
6
7
# File 'lib/fedena_sdk/client.rb', line 5

def uri
  @uri
end

Instance Method Details

#authorize_uriObject



18
19
20
# File 'lib/fedena_sdk/client.rb', line 18

def authorize_uri
  oauth2_client.auth_code.authorize_url(redirect_uri: @redirect_uri)
end

#oauth2_clientObject



14
15
16
# File 'lib/fedena_sdk/client.rb', line 14

def oauth2_client
  @client ||= OAuth2::Client.new(@client_id, @client_secret, site: @uri)
end