Sha256: 0c3e4e763a5c3aca22e96597359a0a36bbcdf50fb028e2a8a8045ed6dc203828

Contents?: true

Size: 923 Bytes

Versions: 17

Compression:

Stored size: 923 Bytes

Contents

module Centaman
  class Service::CostRate < Centaman::Service
    include Centaman::JsonWrapper
    attr_reader :first_name, :last_name, :email

    def after_init(args = {})
      @first_name = args.fetch(:first_name, nil)
      @last_name = args.fetch(:last_name, nil)
      @email = args.fetch(:email, nil)
    end

    def object_class
      Centaman::Object::CostRate
    end

    def endpoint
      '/ticket_services/TimedTicket'
    end

    def options
      super + [
        { key: 'FirstName', value: first_name },
        { key: 'LastName', value: last_name },
        { key: 'Email', value: email }
      ]
    end

    def build_objects(resp)
      return [] unless resp.respond_to?(:map)
      return build_object(resp) if resp.respond_to?(:merge)
      @tickets = resp.map do |ticket_hash|
        object_class.new(ticket_hash.merge(additional_hash_to_serialize_after_response))
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
centaman-8.0.0 lib/centaman/service/cost_rate.rb
centaman-7.0.5 lib/centaman/service/cost_rate.rb
centaman-7.0.4 lib/centaman/service/cost_rate.rb
centaman-7.0.3 lib/centaman/service/cost_rate.rb
centaman-7.0.2 lib/centaman/service/cost_rate.rb
centaman-7.0.1 lib/centaman/service/cost_rate.rb
centaman-7.0.0 lib/centaman/service/cost_rate.rb
centaman-6.0.8 lib/centaman/service/cost_rate.rb
centaman-6.0.7 lib/centaman/service/cost_rate.rb
centaman-6.0.5 lib/centaman/service/cost_rate.rb
centaman-6.0.4 lib/centaman/service/cost_rate.rb
centaman-6.0.3 lib/centaman/service/cost_rate.rb
centaman-6.0.2 lib/centaman/service/cost_rate.rb
centaman-6.0.1 lib/centaman/service/cost_rate.rb
centaman-6.0.0 lib/centaman/service/cost_rate.rb
centaman-5.0.8 lib/centaman/service/cost_rate.rb
centaman-5.0.7 lib/centaman/service/cost_rate.rb