Class: K2ConnectRuby::K2Entity::K2FinancialEntities::Polling::PollingRequest

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/k2-connect-ruby/k2_entity/polling/polling_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kwargs) ⇒ PollingRequest

Returns a new instance of PollingRequest.



19
20
21
22
23
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 19

def initialize(kwargs)
  kwargs.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#callback_urlObject

Returns the value of attribute callback_url.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 10

def callback_url
  @callback_url
end

#from_timeObject

Returns the value of attribute from_time.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 10

def from_time
  @from_time
end

#scopeObject

Returns the value of attribute scope.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 10

def scope
  @scope
end

#scope_referenceObject

Returns the value of attribute scope_reference.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 10

def scope_reference
  @scope_reference
end

#to_timeObject

Returns the value of attribute to_time.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 10

def to_time
  @to_time
end

Instance Method Details

#endpointObject



25
26
27
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 25

def endpoint
  K2ConnectRuby::K2Utilities::Config::K2Config.endpoint("poll")
end

#request_bodyObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 29

def request_body
  {
    scope: scope,
    scope_reference: scope_reference,
    from_time: from_time,
    to_time: to_time,
    _links: {
      callback_url: callback_url,
    },
  }
end

#till_scope?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/k2-connect-ruby/k2_entity/polling/polling_request.rb', line 41

def till_scope?
  scope == "till"
end