class Recras::CombinationItem

links to 'arrangement_regels' in the API recras.github.io/docs/endpoints/arrangementen.html

Attributes

begins_at[RW]
description[RW]
ends_at[RW]
id[RW]

@note The is a required parameter.

json[RW]
location_id[RW]
minimum[RW]
name[RW]
number_of_people[RW]
price[RW]
product_id[RW]

Public Class Methods

attribute_mapping() click to toggle source

translates the mapping between the Recras API and the terms used in this gem

# File lib/recras/combination_item.rb, line 38
def self.attribute_mapping
  [["id", "id"],["locatie_id", "location_id"],["begin", "begins_at@@time"],["eind", "ends_at@@time"], ["beschrijving", "description"], ["verkoop", "price@@float"], ["aantal_personen", "number_of_people"], ["product_id", "product_id"]]
end
new(args=nil) click to toggle source

Initializer to transform a Hash into an Client object

@param [Hash] args

# File lib/recras/combination_item.rb, line 23
def initialize(args=nil)
  required_args = []
  return if args.nil?
  args.each do |k,v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
  set_values_from_json
end
plural_name() click to toggle source
# File lib/recras/combination_item.rb, line 32
def self.plural_name
  "combination_items"
end

Private Instance Methods

set_values_from_json() click to toggle source
# File lib/recras/combination_item.rb, line 44
def set_values_from_json
  self.price = json["product"]["verkoop"].to_f
  self.name = json["product"]["naam"]
  self.minimum = json["product"]["minimum_aantal"].to_i
end