class Toptranslation::Resource::Quote

Attributes

created_at[R]
estimated_delivery_date[R]
identifier[R]
product[R]
state[R]
value[R]

Public Class Methods

new(connection, options = {}) click to toggle source
# File lib/toptranslation/resource/quote.rb, line 6
def initialize(connection, options = {})
  @connection = connection
  @options = options
  update_from_response(options)
end

Public Instance Methods

accept() click to toggle source
# File lib/toptranslation/resource/quote.rb, line 12
def accept
  @connection.patch("/quotes/#{identifier}/accept", version: 2)
end
reject(reason = nil) click to toggle source
# File lib/toptranslation/resource/quote.rb, line 16
def reject(reason = nil)
  @connection.patch("/quotes/#{identifier}/reject", reason: reason, version: 2)
end

Private Instance Methods

update_from_response(response) click to toggle source
# File lib/toptranslation/resource/quote.rb, line 22
def update_from_response(response)
  @identifier = response['identifier'] if response['identifier']
  @state = response['state'] if response['state']
  @product = response['product'] if response['product']
  @value = response['value'] if response['value']
  @estimated_delivery_date = Time.parse(response['estimated_delivery_date']) if response['estimated_delivery_date']
  @created_at = Time.parse(response['created_at']) if response['created_at']
end