Sha256: bcc60875c69cd98492838fb40ec120fa7acdbbf04bc5745d125054dc3711688a

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

module Conekta
  module APIOperations
    module CreateMember
      module ClassMethods
        def create_member(member, params={}, api_key=nil)
          path = "#{path}/#{member}"
          response, api_key = Conekta.request(:post, path, api_key, params)
          obj = Util.convert_to_conekta_object(response, api_key)
          obj.try("#{parent}".to_sym) = self
          if obj.class == ConektaObject
            count = self.try("#{member}".to_sym).count
            self.try("#{member}".to_sym)[count] = obj
          else
            self.try("#{member}".to_sym) = obj
          end
          obj
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conekta-0.3.1 lib/conekta/api_operations/create_member.rb