Sha256: b882a2bc3e3edbb42e41163ee92ec84c08ba708a23574558886c2359fc535ad4

Contents?: true

Size: 995 Bytes

Versions: 2

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true

require 'credit_gateway/base_repository'
require 'credit_gateway/behavioral_score'
require 'credit_gateway/behavioral_badge'
require 'credit_gateway/full_score'

module CreditGateway
  class BehavioralScoreRepository < BaseRepository
    # Params:
    # document_token - Token retrieved from ScoreDataRepository#prepare
    def specific_rating(document_token)
      result = post('/score/behavioralscore', params: { token: document_token })

      FullScore.build(json: result.body)
    end

    def latest_rating(company_id)
      url = format_url(
        '/score/behavioralscore/rating/:company_id',
        company_id: company_id.to_s
      )
      result = get(url)

      BehavioralScore.build(json: result.body)
    end

    def badge(company_id)
      url = format_url(
        '/score/behavioralscore/badge/:company_id',
        company_id: company_id.to_s
      )
      result = get(url)

      BehavioralBadge.build(json: result.body)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
credit_gateway-0.1.1 lib/credit_gateway/behavioral_score_repository.rb
credit_gateway-0.1.0 lib/credit_gateway/behavioral_score_repository.rb