Class: V2Intuity::Users::User

Inherits:
Object
  • Object
show all
Defined in:
lib/v2_intuity/users/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ User

Returns a new instance of User.



7
8
9
10
11
12
# File 'lib/v2_intuity/users/user.rb', line 7

def initialize(options = {})
  @validic_token = options.fetch(:validic_token, nil)
  @uid = options.fetch(:uid, nil)
  @time_zone = options.fetch(:location, nil)
  @country_code = options.fetch(:country_code, nil)
end

Instance Attribute Details

#applicationsObject

Returns the value of attribute applications.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def applications
  @applications
end

#country_codeObject

Returns the value of attribute country_code.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def country_code
  @country_code
end

#devicesObject

Returns the value of attribute devices.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def devices
  @devices
end

#time_zoneObject

Returns the value of attribute time_zone.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def time_zone
  @time_zone
end

#uidObject

Returns the value of attribute uid.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def uid
  @uid
end

#validic_tokenObject

Returns the value of attribute validic_token.



4
5
6
# File 'lib/v2_intuity/users/user.rb', line 4

def validic_token
  @validic_token
end

Instance Method Details

#get_marketplace(client, format_redirect = 'json', redirect_uri = V2Intuity::Endpoints::Marketplace::REDIRECT_URI) ⇒ Object

method finds the marketplace connected and disconnected json response



30
31
32
33
34
35
36
# File 'lib/v2_intuity/users/user.rb', line 30

def get_marketplace(client, format_redirect = 'json', redirect_uri = V2Intuity::Endpoints::Marketplace::REDIRECT_URI) # marketplace user defined token
  raise 'validic token is required' unless validic_token

  endpoint, options = build_options_marketplace(validic_token, format_redirect, redirect_uri)

  client.build_and_send_request(endpoint, options)
end

#refresh_marketplace(client) ⇒ Object

method refreshes marketplace user token.



20
21
22
23
24
25
26
27
# File 'lib/v2_intuity/users/user.rb', line 20

def refresh_marketplace(client)
  raise 'uid is required' unless uid

  options = { method: V2Intuity::Request::METHODS[:post], id: uid }
  endpoint = V2Intuity::Endpoints::Marketplace.new

  client.build_and_send_request(endpoint, options)
end

#send_request(method, client) ⇒ Object



14
15
16
17
# File 'lib/v2_intuity/users/user.rb', line 14

def send_request(method, client)
  endpoint, options = build_options(method)
  client.build_and_send_request(endpoint, options)
end